/* ═══ slovolov — clean minimal design ═══════════════════════════════════════ */

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

:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --border: #e8e6e1;
  --border-strong: #d0cec8;
  --text: #16150f;
  --text-2: #6f6d66;
  --text-3: #a5a39b;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;

  /* rarity scale: gray → green → blue → purple → orange → red */
  --tier-gray:   #888780;
  --tier-green:  #639922;
  --tier-blue:   #378add;
  --tier-purple: #7f77dd;
  --tier-orange: #ef9f27;
  --tier-red:    #e24b4a;

  /* tier pills (bg = light tint, fg = dark shade of same ramp) */
  --pill-red-bg: #fcebeb;    --pill-red-fg: #a32d2d;
  --pill-orange-bg: #faeeda; --pill-orange-fg: #854f0b;
  --pill-purple-bg: #eeedfe; --pill-purple-fg: #534ab7;
  --pill-blue-bg: #e6f1fb;   --pill-blue-fg: #185fa5;
  --pill-green-bg: #eaf3de;  --pill-green-fg: #3b6d11;
  --pill-gray-bg: #f1efe8;   --pill-gray-fg: #6f6d66;

  --win-bg: #fcebeb; --win-border: #f7c1c1; --win-text: #791f1f;
  --warn-bg: #faeeda; --warn-border: #fac775; --warn-text: #633806;
  --err-bg: #fcebeb; --err-text: #a32d2d;
}

[data-theme="dark"] {
  --bg: #131311;
  --surface: #1b1b19;
  --border: #2a2a27;
  --border-strong: #3d3d39;
  --text: #ecece6;
  --text-2: #8f8d85;
  --text-3: #5b5953;

  --tier-gray:   #6f6e68;
  --tier-green:  #97c459;
  --tier-blue:   #85b7eb;
  --tier-purple: #afa9ec;
  --tier-orange: #fac775;
  --tier-red:    #f09595;

  /* tier pills — dark: bg = deep shade, fg = light tint */
  --pill-red-bg: #3a1414;    --pill-red-fg: #f7c1c1;
  --pill-orange-bg: #33230a; --pill-orange-fg: #fac775;
  --pill-purple-bg: #26215c; --pill-purple-fg: #cecbf6;
  --pill-blue-bg: #0a2540;   --pill-blue-fg: #b5d4f4;
  --pill-green-bg: #1d2e0d;  --pill-green-fg: #c0dd97;
  --pill-gray-bg: #262623;   --pill-gray-fg: #a5a39b;

  --win-bg: #2a1213; --win-border: #501313; --win-text: #f7c1c1;
  --warn-bg: #241a05; --warn-border: #633806; --warn-text: #fac775;
  --err-bg: #2a1213; --err-text: #f09595;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  transition: background .2s, color .2s;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ═══ Header ════════════════════════════════════════════════════════════════ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0;
}

.logo {
  font-family: Georgia, "Times New Roman", "Noto Serif", serif;
  font-size: 1.375rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -.01em;
}

.header-actions { display: flex; gap: 2px; }

.icon-btn {
  width: 34px; height: 34px;
  border: none; background: none;
  border-radius: 50%;
  color: var(--text-3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); background: var(--border); }
.icon-btn.active { color: var(--tier-red); }

.hard-mode-bar {
  font-size: .75rem;
  color: var(--warn-text);
  background: var(--warn-bg);
  text-align: center;
  padding: 5px 1rem;
  margin-top: .75rem;
}

/* ═══ Date strip ═════════════════════════════════════════════════════════════ */
.date-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0;
}

.date-nav {
  width: 32px; height: 32px;
  border: none; background: none;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s;
}
.date-nav svg { width: 18px; height: 18px; }
.date-nav:hover:not(:disabled) { color: var(--text); }
.date-nav:disabled { opacity: .25; cursor: default; }

.date-center { text-align: center; }
.date-main { font-size: .875rem; font-weight: 500; }
.date-sub  { font-size: .6875rem; color: var(--text-3); margin-top: 1px; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 1.25rem 0;
}

/* ═══ Main ═══════════════════════════════════════════════════════════════════ */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 1rem;
}

/* ═══ Banners ════════════════════════════════════════════════════════════════ */
.banner {
  margin: 1rem 1.25rem 0;
  border-radius: var(--radius);
  padding: .875rem 1rem;
  font-size: .875rem;
  text-align: center;
  line-height: 1.5;
}
.banner-giveup { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); }

/* ═══ Win screen (variant A) ═════════════════════════════════════════════════ */
.win-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.25rem 1rem;
  animation: wsIn .4s cubic-bezier(.3,1,.4,1);
}
@keyframes wsIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.ws-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--pill-red-fg);
  text-transform: uppercase;
  letter-spacing: .12em;
}
.ws-word {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 8px 0 4px;
  word-break: break-word;
}
.ws-sub { font-size: .875rem; color: var(--text-2); margin-bottom: 1.75rem; }

.ws-spark {
  width: 100%;
  height: 72px;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.ws-spark svg { width: 100%; height: 100%; display: block; }
.ws-spark-label {
  position: absolute; top: -4px; right: 0;
  font-size: .625rem; color: var(--text-3);
}

.ws-stats { display: flex; gap: 10px; width: 100%; margin-bottom: 1.75rem; }
.ws-stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 8px;
}
.ws-stat b { display: block; font-size: 1.375rem; font-weight: 700; line-height: 1.1; }
.ws-stat span { font-size: .6875rem; color: var(--text-2); }

.ws-btns { display: flex; gap: 8px; width: 100%; }
.ws-b1 {
  flex: 1; height: 46px;
  border: none; border-radius: 23px;
  background: var(--text); color: var(--bg);
  font-size: .9375rem; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: opacity .15s;
}
.ws-b1:hover { opacity: .85; }
.ws-b2 {
  flex: 1; height: 46px;
  border: 1.5px solid var(--border-strong); border-radius: 23px;
  background: none; color: var(--text);
  font-size: .9375rem; font-family: var(--font);
  cursor: pointer; transition: background .15s;
}
.ws-b2:hover { background: var(--border); }

.ws-footer {
  margin-top: 1.5rem;
  font-size: .8125rem;
  color: var(--text-3);
}
.ws-link {
  border: none; background: none;
  color: var(--text-2);
  font-size: .8125rem;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}
.ws-link:hover { color: var(--text); }

.share-btn {
  display: inline-block;
  margin-top: 8px;
  background: var(--tier-red);
  color: #fff;
  border: none; border-radius: 20px;
  padding: 5px 16px;
  font-size: .8125rem; font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
}

/* ═══ Input ══════════════════════════════════════════════════════════════════ */
.input-area {
  padding: 1rem 1.25rem 0;
}

.input-pill {
  display: flex;
  align-items: center;
  height: 52px;
  border: 1.5px solid var(--border-strong);
  border-radius: 26px;
  padding: 0 7px 0 20px;
  background: var(--surface);
  gap: 8px;
  transition: border-color .15s;
}
.input-pill:focus-within { border-color: var(--text); }

input[type="text"] {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  outline: none;
  height: 100%;
}
input[type="text"]::placeholder { color: var(--text-3); }
input[type="text"]:disabled { opacity: .5; }

#guess-btn {
  width: 38px; height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s, transform .1s;
}
#guess-btn svg { width: 18px; height: 18px; }
#guess-btn:hover { opacity: .85; }
#guess-btn:active { transform: scale(.94); }
#guess-btn:disabled { opacity: .35; cursor: default; }

.error-msg {
  margin: 8px 1.25rem 0;
  font-size: .8125rem;
  color: var(--err-text);
  background: var(--err-bg);
  border-radius: var(--radius);
  padding: 8px 12px;
}

/* ═══ First-visit hint ═══════════════════════════════════════════════════════ */
.first-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 1.25rem 0;
  padding: 10px 8px 10px 14px;
  font-size: .8125rem;
  color: var(--text-2);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.first-hint button {
  margin-left: auto;
  border: none; background: none;
  color: var(--text-3);
  font-size: 1.1rem; line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  flex-shrink: 0;
}
.first-hint button:hover { color: var(--text); }

/* ═══ Pinned latest guess ════════════════════════════════════════════════════ */
.last-guess {
  padding: 10px 1.25rem 0;
}
.last-guess .guess-row {
  border: 1.5px solid var(--border-strong);
  animation: pinnedPop .3s cubic-bezier(.3,1.4,.5,1);
}
@keyframes pinnedPop {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ═══ Meta row ═══════════════════════════════════════════════════════════════ */
.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 1.25rem 0;
  min-height: 32px;
}
.meta-count { font-size: .75rem; color: var(--text-3); font-variant-numeric: tabular-nums; margin-right: auto; }

.warmth-chip {
  font-size: .6875rem;
  font-weight: 500;
  border-radius: 20px;
  padding: 2px 9px;
}
.warmth-chip.hot   { color: var(--tier-red);    background: color-mix(in srgb, var(--tier-red) 12%, transparent); }
.warmth-chip.warm  { color: var(--tier-orange); background: color-mix(in srgb, var(--tier-orange) 14%, transparent); }
.warmth-chip.tepid { color: var(--tier-purple); background: color-mix(in srgb, var(--tier-purple) 14%, transparent); }
.warmth-chip.same  { color: var(--text-2);      background: var(--border); }
.warmth-chip.cool  { color: var(--tier-blue);   background: color-mix(in srgb, var(--tier-blue) 12%, transparent); }
.warmth-chip.cold  { color: var(--tier-gray);   background: color-mix(in srgb, var(--tier-gray) 14%, transparent); }

.nudge-chip {
  font-size: .6875rem;
  font-weight: 500;
  color: var(--tier-orange);
  background: color-mix(in srgb, var(--tier-orange) 14%, transparent);
  border-radius: 20px;
  padding: 2px 9px;
  animation: pop .25s ease;
}
@keyframes pop { from { opacity:0; transform:scale(.85); } to { opacity:1; transform:scale(1); } }

/* ═══ Neighbours ═════════════════════════════════════════════════════════════ */
.neighbours { padding: 1rem 1.25rem 0; }
.neighbours-title {
  font-size: .6875rem;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.neighbours-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.neighbours-list li {
  font-size: .8125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 11px;
  display: flex; align-items: center; gap: 5px;
}
.nb-rank { font-size: .6875rem; color: var(--text-3); }
.nb-word { font-weight: 500; }

/* ═══ Guess list ═════════════════════════════════════════════════════════════ */
.guess-list {
  padding: 6px 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guess-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.guess-row.is-new { animation: slideIn .25s ease; }
@keyframes slideIn { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }

.guess-word {
  font-size: .9375rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* dot thermometer + percentage — design B */
.dots { display: flex; gap: 3.5px; flex-shrink: 0; }
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--border);
}
.dot.t-red    { background: var(--tier-red); }
.dot.t-orange { background: var(--tier-orange); }
.dot.t-purple { background: var(--tier-purple); }
.dot.t-blue   { background: var(--tier-blue); }
.dot.t-green  { background: var(--tier-green); }
.dot.t-gray   { background: var(--tier-gray); }

.g-pct {
  font-size: .8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  width: 52px;
  text-align: right;
  flex-shrink: 0;
}
.g-pct.t-red    { color: var(--pill-red-fg); }
.g-pct.t-orange { color: var(--pill-orange-fg); }
.g-pct.t-purple { color: var(--pill-purple-fg); }
.g-pct.t-blue   { color: var(--pill-blue-fg); }
.g-pct.t-green  { color: var(--pill-green-fg); }
.g-pct.t-gray   { color: var(--pill-gray-fg); }

.empty-state {
  text-align: center;
  color: var(--text-3);
  font-size: .8125rem;
  padding: 3rem 1.25rem;
}

/* ═══ Bottom nav ═════════════════════════════════════════════════════════════ */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 8px 1rem calc(8px + env(safe-area-inset-bottom));
  position: sticky;
  bottom: 0;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: none;
  color: var(--text-3);
  font-size: .625rem;
  font-family: var(--font);
  cursor: pointer;
  padding: 4px 12px;
  transition: color .15s;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active, .nav-item:hover { color: var(--text); }

/* ═══ Sheets (bottom drawers) ════════════════════════════════════════════════ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 8px 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 560px;
  max-height: 80dvh;
  overflow-y: auto;
  animation: sheetUp .25s cubic-bezier(.3,1,.4,1);
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }

.sheet-handle {
  width: 36px; height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 4px auto 16px;
}

.sheet h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.sheet p { font-size: .875rem; color: var(--text-2); margin-bottom: .75rem; line-height: 1.55; }
.sheet strong { color: var(--text); }
.help-tip { font-size: .75rem !important; color: var(--text-3) !important; }

/* scale legend in help */
.scale-legend { margin: .75rem 0 1rem; display: flex; flex-direction: column; gap: 6px; }
.scale-row { display: flex; align-items: center; gap: 10px; font-size: .8125rem; }
.scale-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.scale-label { width: 90px; font-weight: 500; font-variant-numeric: tabular-nums; }
.scale-desc { color: var(--text-2); }

/* ═══ Archive ════════════════════════════════════════════════════════════════ */
.archive-list { display: flex; flex-direction: column; }
.archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  font-size: .875rem;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.archive-item:last-child { border-bottom: none; }
.archive-date { font-weight: 500; }
.archive-status { font-size: .75rem; color: var(--text-3); }
.archive-item.is-won .archive-status { color: var(--tier-green); }
.archive-item.is-today .archive-date::after {
  content: "dnes";
  font-size: .625rem;
  font-weight: 500;
  color: var(--tier-red);
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ═══ Leaderboard ════════════════════════════════════════════════════════════ */
.lb-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.lb-table td { padding: 10px 2px; border-bottom: 1px solid var(--border); }
.lb-table tr:last-child td { border-bottom: none; }
.lb-pos { width: 40px; }
.lb-guesses { font-weight: 600; }
.lb-time { text-align: right; color: var(--text-3); font-size: .75rem; }

/* ═══ Stats ══════════════════════════════════════════════════════════════════ */
.stats-label {
  font-size: .6875rem;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 420px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: .75rem .5rem;
  text-align: center;
}
.stat-card .sc-val { font-size: 1.25rem; font-weight: 600; line-height: 1.1; }
.stat-card .sc-lbl { font-size: .6875rem; color: var(--text-3); margin-top: 3px; }

/* ═══ Share ══════════════════════════════════════════════════════════════════ */
.share-canvas {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}
.share-actions { display: flex; gap: 8px; }
.btn-dark {
  flex: 1; height: 42px;
  border: none; border-radius: var(--radius);
  background: var(--text); color: var(--bg);
  font-size: .875rem; font-weight: 500; font-family: var(--font);
  cursor: pointer;
}
.btn-light {
  flex: 1; height: 42px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: none; color: var(--text);
  font-size: .875rem; font-family: var(--font);
  cursor: pointer;
}

/* ═══ Utilities ══════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

.archive-play { color: var(--tier-blue); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
