
:root{
  /* Muted, bakery-inspired palette (less vibrant) */
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f6efe6;
  --ink: #2b2621;
  --muted: #6b625a;
  --border: rgba(43,38,33,0.12);

  --accent: #9b4f63;      /* muted berry */
  --accent-2: #b07a4a;    /* caramel */
  --shadow: 0 12px 30px rgba(43,38,33,0.10);

  --radius-lg: 18px;
  --radius-md: 12px;
}

*{ box-sizing:border-box; }

html, body{ height:100%; }

body{
  margin:0;
  font-family: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(155,79,99,0.10), transparent 60%),
    radial-gradient(700px 420px at 100% 10%, rgba(176,122,74,0.12), transparent 55%),
    linear-gradient(180deg, var(--bg), #ffffff 70%);
}

.wrap{
  width: min(1080px, 92vw);
  margin: 0 auto;
}

.site-header{
  position: sticky;
  top:0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(251,247,242,0.78);
  border-bottom: 1px solid var(--border);
}

.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 16px 0;
  gap: 16px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 220px;
}

.brand-mark{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.75), transparent 40%),
    linear-gradient(135deg, rgba(155,79,99,0.95), rgba(176,122,74,0.92));
  box-shadow: 0 10px 22px rgba(43,38,33,0.14);
}

.brand-name{
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.05;
}

.brand-tagline{
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.nav{
  display:flex;
  align-items:center;
  gap: 10px;
}

.nav-link{
  text-decoration:none;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.nav-link:hover{
  background: rgba(155,79,99,0.08);
  border-color: rgba(155,79,99,0.20);
}

.nav-link:active{ transform: translateY(1px); }

.hero{
  padding: 28px 0 14px;
}

.page-title{
  margin: 0;
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-weight: 700;
  font-size: clamp(28px, 3.6vw, 44px);
  letter-spacing: 0.2px;
}

.page-subtitle{
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 68ch;
  line-height: 1.5;
}

.card{
  margin: 18px 0 40px;
  padding: 20px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.controls{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.field{
  display:flex;
  flex-direction:column;
  gap: 8px;
  text-align:left;
}

.field-label{
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.3px;
}

select{
  appearance: none;
  width: 100%;
  padding: 12px 40px 12px 12px;
  border-radius: 999px;
  border: 1px solid rgba(43,38,33,0.14);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  outline: none;
  box-shadow: 0 4px 10px rgba(43,38,33,0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
  background-image:
    radial-gradient(circle at 30% 20%, rgba(155,79,99,0.08), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85)),
    linear-gradient(45deg, transparent 50%, rgba(43,38,33,0.55) 50%),
    linear-gradient(135deg, rgba(43,38,33,0.55) 50%, transparent 50%);
  background-position:
    0 0,
    0 0,
    calc(100% - 18px) 54%,
    calc(100% - 12px) 54%;
  background-size:
    100% 100%,
    100% 100%,
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
}

select:hover{ border-color: rgba(155,79,99,0.35); }
select:focus{
  border-color: rgba(155,79,99,0.55);
  box-shadow: 0 0 0 4px rgba(155,79,99,0.18), 0 10px 18px rgba(43,38,33,0.08);
}

.image-container{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 12px;
}

.stage{
  position:relative;
  display:inline-block;
  margin: 0 auto;
  padding: 12px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(43,38,33,0.10);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 34px rgba(43,38,33,0.12);
}

.hidden{ display:none; }

#resultImage{
  max-width: 560px;
  width: 100%;
  display:block;
  margin:0 auto;
  border-radius: 14px;
  border: 1px solid rgba(43,38,33,0.10);
}

/* Overlay wrapper */
.overlay-wrap{
  position:absolute;
  left:50%;
  top:55%;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  transform-origin: center center;
  cursor: grab;
  user-select: none;
  touch-action: none;
  max-width: 95%;
  display: grid;
  place-items: center;
}
.overlay-wrap.dragging{ cursor: grabbing; }

.overlay-text{
  display:block;
  width: 260px;
  min-width: 120px;
  max-width: 560px;
  padding: 10px 12px;
  border: 2px dashed rgba(43,38,33,0.28);
  border-radius: 14px;
  background: rgba(255,255,255,0.40);
  outline:none;
  line-height:1.15;
  white-space: pre-wrap;
  word-break: break-word;
  text-align:center;
  cursor: inherit;
  touch-action: none;
}

/* Used when we render the message via SVG text-on-a-path (Arch mode). */
.overlay-text.visually-hidden{
  position: absolute;
  opacity: 0;
}

.arc-svg{
  display: none;
  overflow: visible;
  pointer-events: none;
}

.arc-text{
  dominant-baseline: middle;
}

.overlay-text:focus{
  border-style: solid;
  background: rgba(255,255,255,0.62);
  box-shadow: 0 0 0 4px rgba(176,122,74,0.15);
}

.overlay-text.no-outline{
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.drag-hint{
  font-size:12px;
  margin-top:6px;
  opacity:0.75;
  text-align:center;
  color: var(--muted);
}

/* Handles */
.handle{
  position:absolute;
  width:12px;
  height:12px;
  background: var(--surface);
  border:2px solid rgba(43,38,33,0.50);
  border-radius:6px;
}

.h-nw{ left:-8px; top:-8px; cursor:nwse-resize; }
.h-ne{ right:-8px; top:-8px; cursor:nesw-resize; }
.h-sw{ left:-8px; bottom:26px; cursor:nesw-resize; }
.h-se{ right:-8px; bottom:26px; cursor:nwse-resize; }

/* Rotation */
.rotate-arm{
  position:absolute;
  left:50%;
  top:-26px;
  width:2px;
  height:18px;
  background: rgba(43,38,33,0.55);
  transform: translateX(-50%);
}

.rotate-handle{
  position:absolute;
  left:50%;
  top:-38px;
  width:14px;
  height:14px;
  background: var(--surface);
  border:2px solid rgba(43,38,33,0.55);
  border-radius:50%;
  transform: translateX(-50%);
  cursor: grab;
}

/* Editor under image */
.text-editor{
  width: min(720px, 100%);
  margin-top: 12px;
  text-align:left;
}

.toolbar{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  padding:12px;
  border:1px solid rgba(43,38,33,0.12);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.72);
}

.tool-btn{
  padding:8px 10px;
  border:1px solid rgba(43,38,33,0.14);
  background: rgba(255,255,255,0.90);
  border-radius: 12px;
  cursor:pointer;
  font-weight: 800;
  transition: transform 120ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.tool-btn:hover{
  border-color: rgba(155,79,99,0.28);
  box-shadow: 0 10px 18px rgba(43,38,33,0.08);
}
.tool-btn:active{ transform: translateY(1px); }

.toolbar select{
  padding:8px 12px;
  margin:0;
  font-size:14px;
}

.toolbar input[type="range"]{
  width: 170px;
  height: 36px;
}

#textColor{
  width: 42px;
  height: 36px;
  border: 1px solid rgba(43,38,33,0.16);
  border-radius: 12px;
  background: white;
  padding: 0;
}

.divider{
  width:1px;
  height:22px;
  background: rgba(43,38,33,0.12);
  margin:0 6px;
}

.editor-label{
  display:block;
  margin: 12px 2px 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.message-input{
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(43,38,33,0.14);
  border-radius: 14px;
  font-size: 16px;
  background: rgba(255,255,255,0.85);
}

.helper{
  margin-top:8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.status{
  margin-top: 8px;
  color: var(--muted);
}

/* Accessibility helper */
.sr-only{
  position:absolute;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  border:0;
}

.site-footer{
  padding: 18px 0 40px;
}

.footer-inner{
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.fineprint{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 860px){
  .controls{ grid-template-columns: 1fr; }
  .nav{ display:none; }
  .card{ padding: 16px; }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
  .overlay-wrap { padding: 12px; }
  .handle { width: 22px; height: 22px; border-radius: 8px; }
  .h-nw { left: -14px; top: -14px; }
  .h-ne { right: -14px; top: -14px; }
  .h-sw { left: -14px; bottom: 34px; }
  .h-se { right: -14px; bottom: 34px; }
  .rotate-arm { height: 26px; top: -36px; }
  .rotate-handle { width: 22px; height: 22px; top: -52px; }
}


/* Cookie Logo Styling */
.logo-dot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #d8a25f 0%, #c48a4a 60%, #b5763c 100%);
  position: relative;
  box-shadow: inset -3px -4px 6px rgba(0,0,0,0.15),
              0 4px 8px rgba(0,0,0,0.15);
}

/* Chocolate chips */
.logo-dot::before,
.logo-dot::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: #5a3a28;
  border-radius: 50%;
  box-shadow:
    12px 6px #5a3a28,
    20px 16px #5a3a28,
    6px 22px #5a3a28;
}


/* Drag handle */
.drag-handle{
  position:absolute;
  top:-34px;
  left:50%;
  transform:translateX(-50%);
  width:28px;
  height:28px;
  background:#fff;
  border:2px solid rgba(43,38,33,0.6);
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  cursor:grab;
  z-index:20;
  user-select:none;
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
.drag-handle:active{
  cursor:grabbing;
}
