/* Practice Hub — dark minimal theme, same palette as ideas and recipes */

:root {
  --bg: #141311;
  --surface: #1e1c18;
  --border: #322e27;
  --text: #f0ece4;
  --muted: #a8a094;
  --green: #7bc98a;
  --amber: #e8a33d;
  --amber-tint: rgba(232, 163, 61, 0.12);
  --green-tint: rgba(123, 201, 138, 0.15);
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: 92px; /* room for tab bar */
}

/* ---------- icons ---------- */
/* Line icons from app.js. Sized by the font-size of whatever holds them. */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.125em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- header ---------- */
.topbar {
  padding: 28px 16px 0;
  max-width: 560px;
  margin: 0 auto;
}

.topbar h1 {
  margin: 16px 0 0;
  font-size: 2rem;
}

/* "← Robert Naanos": quiet link back to the main site */
.back { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.back:hover { color: var(--text); }

/* ---------- main ---------- */
#view {
  padding: 16px;
  max-width: 560px;
  margin: 0 auto;
}

.view-title {
  font-size: 1.4rem;
  margin: 4px 2px 14px;
}

/* ---------- home grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 12px 16px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}

.card:active { transform: scale(0.96); }

.card-emoji { font-size: 2rem; }
.card-name { font-size: 1.15rem; font-weight: 700; }
.card-mins { font-size: 0.95rem; color: var(--muted); }

/* ---------- timer ---------- */
.timer-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 26px 18px;
  text-align: center;
}

/* "← All activities" / "← All stories": same quiet link as .back.
   The padding makes the tap target taller than the text. */
.timer-back {
  display: block;
  margin-bottom: 6px;
  padding: 6px 12px 10px 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
}

.timer-back:hover { color: var(--text); }

.timer-emoji { font-size: 3rem; }
.timer-name { font-size: 1.3rem; font-weight: 700; margin: 6px 0 2px; }

/* 10 / 20 / 30 min: real radio buttons, drawn as a row of pills */
.time-options { display: flex; gap: 8px; justify-content: center; margin: 12px 0 4px; }
.time-option { cursor: pointer; }
.time-option input { position: absolute; opacity: 0; pointer-events: none; }
.time-option span {
  display: block;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}
.time-option input:checked + span { border-color: var(--amber); background: var(--amber-tint); color: var(--text); }
.time-option input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }

.timer-display {
  font-size: 4.2rem;
  font-weight: 800;
  letter-spacing: 2px;
  margin: 10px 0 18px;
  font-variant-numeric: tabular-nums;
}

.timer-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 16px 30px;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  min-width: 120px;
}

.btn:active { transform: scale(0.95); }

.btn-start { background: var(--green); color: var(--bg); }
.btn-pause { background: var(--amber); color: var(--bg); }
.btn-reset { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.btn-done  { background: var(--amber); color: var(--bg); margin-top: 6px; }

/* ---------- writing panel ---------- */
.writing-panel {
  margin-top: 22px;
  background: var(--bg);
  border-radius: 18px;
  padding: 16px;
  text-align: left;
}

.writing-panel h3 { margin: 0 0 10px; font-size: 1.1rem; }

.prompt-btn {
  background: var(--amber);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 12px;
}

.prompt-btn:active { transform: scale(0.95); }

.word-count {
  text-align: right;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* ---------- today checklist ---------- */
.todo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.todo-row.done { opacity: 0.75; }

.todo-emoji { font-size: 2rem; }
.todo-info { flex: 1; }
.todo-name { font-weight: 700; font-size: 1.08rem; }
.todo-sub { color: var(--muted); font-size: 0.92rem; }

.todo-check {
  font-size: 1.7rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
}

.todo-row.done .todo-check { background: var(--green-tint); }

/* ---------- streak ---------- */
.streak-hero {
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 26px 16px;
  margin-bottom: 16px;
}

.streak-num { font-size: 3.4rem; font-weight: 800; }
.streak-label { color: var(--muted); font-size: 1.05rem; margin-top: 4px; }

.dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 12px;
}

.dot {
  font-size: 1.6rem;
  opacity: 0.35;
}

.dot.hit { opacity: 1; }
.dot.hit .icon { fill: currentColor; }

.dot-day {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  width: 34px;
}

/* ---------- history ---------- */
.hist-day {
  font-weight: 700;
  margin: 16px 2px 8px;
  font-size: 1.05rem;
}

.hist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.hist-emoji { font-size: 1.5rem; }
.hist-words { margin-left: auto; color: var(--muted); font-size: 0.9rem; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  font-size: 1.05rem;
}

/* ---------- completion overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.overlay-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 34px 28px;
  text-align: center;
  max-width: 340px;
  border: 1px solid var(--border);
}

.overlay-card h2 { margin: 8px 0 6px; font-size: 1.7rem; }
.overlay-card p { color: var(--muted); margin: 0 0 20px; font-size: 1.05rem; }
.overlay-emoji { font-size: 3.4rem; }

/* ---------- confetti ---------- */
.confetti {
  position: fixed;
  top: -50px;
  z-index: 9999;
  pointer-events: none;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes confetti-fall {
  to { transform: translateY(115vh) rotate(420deg); }
}

/* ---------- story mode ---------- */
.story-choices { display: flex; gap: 10px; margin-bottom: 12px; }
.story-choice {
  flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 16px 10px; cursor: pointer; font-family: inherit; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.story-choice:active { transform: scale(0.96); }
.story-choice.continue { border-color: var(--amber); background: var(--amber-tint); }
.choice-emoji { font-size: 2rem; }
.choice-label { font-weight: 700; font-size: 1rem; }
.choice-sub { font-size: 0.8rem; color: var(--muted); }

.shelf-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
  font-family: inherit; color: var(--text); text-align: left;
}
.shelf-row:active { transform: scale(0.98); }
.shelf-emoji { font-size: 1.8rem; }
.shelf-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shelf-snippet { font-weight: 700; font-size: 0.98rem; }
.shelf-meta { color: var(--muted); font-size: 0.85rem; }
.shelf-go { font-size: 1.6rem; color: var(--muted); }

.pick-title { margin: 2px 0 12px; font-size: 1.1rem; }
.starter-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.starter-card {
  background: var(--surface); border: 1px dashed var(--amber); border-radius: 14px;
  padding: 14px; font-size: 1rem; line-height: 1.45; cursor: pointer;
  font-family: inherit; color: var(--text); text-align: left;
}
.starter-card:active { transform: scale(0.98); background: var(--amber-tint); }

.story-start {
  background: var(--surface); border-left: 4px solid var(--amber); border-radius: 12px;
  padding: 12px 14px; margin: 10px 0 14px;
}
.story-start-label {
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px;
}
.story-start p { margin: 0; font-size: 1.02rem; line-height: 1.5; font-style: italic; }

.chapter {
  background: var(--surface); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid var(--border);
}
.chapter p { margin: 6px 0 0; font-size: 1rem; line-height: 1.5; white-space: pre-wrap; }
.chapter-num {
  display: inline-block; font-size: 0.8rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  background: var(--amber-tint); color: var(--amber);
}

#chapter-text {
  width: 100%; min-height: 150px; border-radius: 14px; border: 1px solid var(--border);
  padding: 12px; font-size: 1.02rem; font-family: inherit; resize: vertical;
  background: var(--surface); color: var(--text); margin-top: 4px;
}

.goal-bar { height: 10px; background: var(--border); border-radius: 999px; margin: 10px 0 4px; overflow: hidden; }
.goal-fill {
  height: 100%; width: 0%; background: var(--amber);
  border-radius: 999px; transition: width 0.3s;
}

.read-story { background: var(--surface); border-radius: 16px; padding: 18px; margin: 10px 0 16px; border: 1px solid var(--border); }
.read-story h3 { margin: 0 0 10px; font-size: 1.15rem; }
.read-story p { font-size: 1.02rem; line-height: 1.6; margin: 0 0 12px; white-space: pre-wrap; }
.read-starter { font-style: italic; color: var(--muted); border-left: 4px solid var(--amber); padding-left: 12px; }
.read-chapter-head { margin-bottom: 2px !important; }

#save-chapter, #continue-story { width: 100%; margin-top: 12px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}

.tab {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  border-radius: 14px;
}

.tab.active { color: var(--amber); background: var(--amber-tint); }

.tab-emoji { font-size: 1.5rem; }
.tab-label { font-size: 0.78rem; font-weight: 700; }
