:root {
  --paper: #faf3e7;
  --ink: #211b14;
  --ink-soft: #5d5346;
  --accent: #e2572b;
  --accent-dark: #c4441d;
  --highlight: #ffd66b;
  --card: #fffdf8;
  --line: #e8ddca;
  --good: #2e7d4f;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 24px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.logo {
  font-family: "Fraunces", serif;
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
  cursor: pointer;
}

.logo .ish {
  color: var(--accent);
  font-style: italic;
  font-weight: 500;
}

.tagline {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

/* ---------- hero / search ---------- */
.hero h1 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: clamp(1.9rem, 6vw, 3rem);
  line-height: 1.15;
  margin: 36px 0 28px;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

/* mode tabs */
.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.mode-tab {
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 9px 18px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s ease;
}

.mode-tab.active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 3px 3px 0 var(--accent);
}

/* decode dropzone */
.dropzone {
  display: block;
  background: var(--card);
  border: 2px dashed var(--ink);
  border-radius: 14px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.12s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: #fdf3ec;
}

.dz-icon { font-size: 2.2rem; margin-bottom: 10px; }

.dz-text { line-height: 1.5; color: var(--ink); }

.dz-hint { font-size: 0.8rem; color: var(--ink-soft); }

.dz-file {
  margin-top: 14px;
  font-weight: 700;
  color: var(--accent);
}

#decodeBtn {
  margin-top: 12px;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 12px 28px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
}

#decodeBtn:hover { background: var(--accent-dark); }

.privacy-note {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* decode result */
.doc-badge {
  text-transform: capitalize;
  background: var(--ink);
  color: var(--paper);
}

.term-table { width: 100%; border-collapse: collapse; }

.term-table td {
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.term-table .term-name { font-weight: 700; white-space: nowrap; }

.term-table .term-value { font-weight: 500; }

.term-table .term-meaning {
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: block;
  margin-top: 2px;
}

.goodnews {
  border-left: 4px solid var(--good);
  background: #e9f4ee;
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.jargon-word {
  font-weight: 700;
  font-style: italic;
}

.goal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.goal-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 4px 4px 0 var(--ink);
}

.goal-prefix {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 1.15rem;
  white-space: nowrap;
  color: var(--ink-soft);
}

#goalInput {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
  color: var(--ink);
  min-width: 0;
}

#goBtn {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 12px 28px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

#goBtn:hover { background: var(--accent-dark); }

#goBtn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.chip {
  background: transparent;
  border: 1.5px solid var(--ink-soft);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #fdeae2;
}

/* ---------- saved playbooks ---------- */
.saved { margin-top: 44px; }

.saved h2 {
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.saved-list { display: flex; flex-direction: column; gap: 8px; }

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.saved-item:hover { border-color: var(--accent); }

.saved-item .si-title { font-weight: 500; }

.saved-item .si-meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.saved-item .si-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
}
.saved-item .si-del:hover { opacity: 1; }

/* ---------- loading ---------- */
.loading {
  text-align: center;
  padding: 80px 0;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loadingMsg {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink-soft);
}

/* ---------- result ---------- */
.result { padding-top: 8px; }

.back-btn {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 4px;
}
.back-btn:hover { color: var(--accent); }

.pb-title {
  font-family: "Fraunces", serif;
  font-weight: 800;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  line-height: 1.15;
  margin-bottom: 10px;
}

.pb-summary { color: var(--ink-soft); margin-bottom: 16px; line-height: 1.5; }

.pb-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.badge {
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 12px;
  border: 1.5px solid var(--ink);
}

.badge.easy { background: #d9efe2; }
.badge.moderate { background: var(--highlight); }
.badge.hard { background: #f7c8b8; }
.badge.time { background: var(--card); }

/* progress */
.progress-wrap {
  position: sticky;
  top: 0;
  background: var(--paper);
  padding: 10px 0 14px;
  z-index: 5;
}

.progress-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.progress-bar {
  height: 12px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* section cards */
.pb-section { margin-top: 28px; }

.pb-section > h2 {
  font-family: "Fraunces", serif;
  font-size: 1.35rem;
  margin-bottom: 14px;
}

.phase {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
}

.phase-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.phase-head h3 { font-family: "Fraunces", serif; font-size: 1.1rem; }

.phase-time {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.task {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.task input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.task .t-label { font-weight: 500; }

.task .t-detail {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-top: 3px;
  line-height: 1.45;
}

.task.done .t-label {
  text-decoration: line-through;
  color: var(--ink-soft);
}

/* budget table */
.budget-table { width: 100%; border-collapse: collapse; }

.budget-table td {
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.budget-table .b-cost {
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}

.budget-table .b-note {
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: block;
  margin-top: 2px;
}

.budget-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.05rem;
  background: var(--highlight);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 12px;
}

/* contacts & reminders & watch outs */
.card-list { display: flex; flex-direction: column; gap: 10px; }

.info-card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.info-card .ic-title { font-weight: 700; }

.info-card .ic-body {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.45;
}

.info-card .ic-find {
  font-size: 0.82rem;
  margin-top: 6px;
  color: var(--good);
}

.watch {
  border-left: 4px solid var(--accent);
  background: #fdeee6;
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.error-box {
  background: #fdeee6;
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  padding: 16px;
  margin-top: 20px;
}

/* ---------- footer ---------- */
footer {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 32px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

/* ---------- What do I say? ---------- */
.mode-tabs { flex-wrap: wrap; }

#sayInput {
  width: 100%;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 4px 4px 0 var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  color: var(--ink);
  resize: vertical;
  outline: none;
}

#sayBtn {
  margin-top: 12px;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 12px 28px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

#sayBtn:hover { background: var(--accent-dark); }

#sayBtn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

#sayChips { margin-top: 20px; }

.script-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.script-subject {
  font-weight: 700;
  font-size: 0.92rem;
}

.copy-btn {
  background: var(--highlight);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.copy-btn:hover { background: #ffe79a; }

.script-text {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.script-opener {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 10px;
}

.script-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
  margin: 12px 0 6px;
}

.script-list {
  margin: 0 0 4px 20px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.script-list li { margin-bottom: 6px; }

/* ---------- reminder signup ---------- */
.remind-signup {
  background: var(--highlight);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 14px;
  box-shadow: 4px 4px 0 var(--ink);
}

.remind-signup.done-signup {
  background: #d9efe2;
  box-shadow: none;
  font-weight: 500;
}

.rs-title { font-family: "Fraunces", serif; font-weight: 700; font-size: 1.05rem; }

.rs-sub { font-size: 0.85rem; color: var(--ink-soft); margin: 4px 0 12px; }

.rs-row { display: flex; gap: 8px; flex-wrap: wrap; }

#remindEmail {
  flex: 1;
  min-width: 180px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  background: var(--card);
  outline: none;
}

#remindBtn {
  background: var(--accent);
  color: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 10px 18px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

#remindBtn:hover { background: var(--accent-dark); }
#remindBtn:disabled { opacity: 0.6; cursor: wait; }

.rs-msg { font-size: 0.85rem; color: var(--accent-dark); margin-top: 8px; }

.hidden { display: none !important; }

/* confetti */
.confetti {
  position: fixed;
  top: -30px;
  z-index: 100;
  pointer-events: none;
  animation: fall 2.6s ease-in forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(540deg);
    opacity: 0.6;
  }
}

@media (max-width: 540px) {
  .goal-prefix { font-size: 1rem; }
  #goalInput { font-size: 1rem; }
  .tagline { display: none; }
}
