/* ============================================================
   ONE PIECE GUESS — wanted-poster parchment, ink, bounty red.
   Sibling of the Exaryn design system (paper / hairlines / mono).
   ============================================================ */

:root {
  --paper: #f0e6cf;
  --paper-raise: #e9dcbe;
  --ink: #2b1d12;
  --muted: #6d5c48;
  --line: #d3c4a2;
  --accent: #b93a1b;
  --exact: #3e7c4f;
  --close: #c98f1e;
  --wrong: #948871;
  --display: "Rye", "Instrument Serif", Georgia, serif;
  --sans: "Inter", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --pad: clamp(16px, 4vw, 40px);
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* aged-paper vignette */
  background-image: radial-gradient(ellipse at center, transparent 55%, rgba(97, 71, 32, 0.14));
  background-attachment: fixed;
  min-height: 100vh;
}

::selection { background: var(--accent); color: var(--paper); }

.mono {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

a { color: inherit; text-decoration: none; }

/* ============ HEADER ============ */

.site-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px var(--pad);
  border-bottom: 2px solid var(--ink);
}

.wordmark { font-family: var(--display); font-size: 20px; }
.wordmark .mark { color: var(--accent); }

.site-nav { display: flex; gap: 20px; margin-left: auto; }
.site-nav a { padding: 4px 0; border-bottom: 1px solid transparent; transition: border-color 0.15s, color 0.15s; }
.site-nav a:hover { color: var(--accent); border-color: var(--accent); }

/* ============ POSTER HERO ============ */

.poster {
  text-align: center;
  padding: clamp(28px, 5vw, 56px) var(--pad) 24px;
  border-bottom: 2px solid var(--ink);
}

.poster-top { color: var(--muted); letter-spacing: 0.3em; }

.poster-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(64px, 14vw, 150px);
  line-height: 0.95;
  letter-spacing: 0.04em;
  margin-top: 10px;
  color: var(--ink);
  text-shadow: 3px 3px 0 rgba(185, 58, 27, 0.25);
}

.poster-sub {
  margin-top: 14px;
  font-size: clamp(15px, 1.8vw, 18px);
  color: var(--muted);
}

.poster-meta { margin-top: 16px; color: var(--accent); }
.poster-meta .dot { color: var(--muted); margin: 0 6px; }

.mode-row { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }

.mode-btn {
  all: unset;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  border: 1px solid var(--ink);
  transition: background 0.15s, color 0.15s;
}

.mode-btn:hover { background: var(--paper-raise); }
.mode-btn.active { background: var(--ink); color: var(--paper); }

/* ============ GAME ============ */

.game { max-width: 1060px; margin: 0 auto; padding: 24px var(--pad) 48px; }

.guess-box { position: relative; max-width: 520px; margin: 0 auto; }

#guess-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 17px;
  padding: 14px 16px;
  background: var(--paper);
  border: 2px solid var(--ink);
  color: var(--ink);
  outline: none;
  box-shadow: 4px 4px 0 rgba(43, 29, 18, 0.18);
}

#guess-input:focus { border-color: var(--accent); }
#guess-input:disabled { opacity: 0.5; }

.suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  z-index: 20;
  list-style: none;
  background: var(--paper);
  border: 2px solid var(--ink);
  max-height: 290px;
  overflow-y: auto;
  box-shadow: 4px 4px 0 rgba(43, 29, 18, 0.18);
}

.suggestions button {
  all: unset;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
}

.suggestions button:hover, .suggestions button.focused { background: var(--ink); color: var(--paper); }
.suggestions .ep { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); align-self: center; }
.suggestions button:hover .ep, .suggestions button.focused .ep { color: var(--paper); opacity: 0.7; }

/* ============ HINTS ============ */

.hints { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }

.hint {
  all: unset;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 7px 12px;
  border: 1px dashed var(--muted);
  color: var(--muted);
  transition: border-color 0.15s, color 0.15s;
}

.hint:disabled { cursor: default; opacity: 0.6; }
.hint.unlocked { border-style: solid; border-color: var(--accent); color: var(--accent); }
.hint.revealed { border-style: solid; border-color: var(--ink); color: var(--ink); background: var(--paper-raise); }

/* ============ BOARD ============ */

.board-scroll { overflow-x: auto; margin-top: 22px; padding-bottom: 6px; }

.board { min-width: 900px; }

.board-head, .guess-row {
  display: grid;
  grid-template-columns: 1.35fr repeat(8, 1fr);
  gap: 6px;
}

.board-head { margin-bottom: 6px; }
.board-head span { text-align: center; color: var(--muted); font-size: 10px; padding: 4px 2px; }
.board-head span:first-child { text-align: left; padding-left: 8px; }

.guess-row { margin-bottom: 6px; }

.cell {
  min-height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  padding: 6px 4px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.25;
  border: 1px solid rgba(43, 29, 18, 0.25);
  color: #fdf9ee;
  animation: flip 0.45s ease both;
  word-break: break-word;
}

.guess-row .cell:nth-child(2) { animation-delay: 0.05s; }
.guess-row .cell:nth-child(3) { animation-delay: 0.1s; }
.guess-row .cell:nth-child(4) { animation-delay: 0.15s; }
.guess-row .cell:nth-child(5) { animation-delay: 0.2s; }
.guess-row .cell:nth-child(6) { animation-delay: 0.25s; }
.guess-row .cell:nth-child(7) { animation-delay: 0.3s; }
.guess-row .cell:nth-child(8) { animation-delay: 0.35s; }
.guess-row .cell:nth-child(9) { animation-delay: 0.4s; }

@keyframes flip {
  from { transform: rotateX(90deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.cell.name {
  background: var(--ink);
  font-family: var(--display);
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.cell.exact { background: var(--exact); }
.cell.close { background: var(--close); }
.cell.wrong { background: var(--wrong); }

.cell .arrow { font-size: 15px; line-height: 1; }
.cell .sub { font-size: 10px; opacity: 0.85; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }

.cell-demo {
  display: inline-block;
  width: 11px; height: 11px;
  vertical-align: -1px;
  margin-right: 4px;
  border: 1px solid rgba(43, 29, 18, 0.3);
}

.cell-demo.exact { background: var(--exact); }
.cell-demo.close { background: var(--close); }
.cell-demo.wrong { background: var(--wrong); }

/* ============ RESULT ============ */

.result {
  margin-top: 26px;
  border: 2px solid var(--ink);
  background: var(--paper-raise);
  padding: 26px var(--pad);
  text-align: center;
  box-shadow: 6px 6px 0 rgba(43, 29, 18, 0.18);
}

.result .verdict { font-family: var(--display); font-size: clamp(26px, 4vw, 44px); }
.result .verdict.win { color: var(--exact); }
.result .verdict.lose { color: var(--accent); }

.result .answer-name { font-family: var(--display); font-size: clamp(22px, 3vw, 34px); margin-top: 10px; }
.result .answer-epithet { color: var(--accent); font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; margin-top: 4px; }
.result .answer-facts { margin-top: 14px; color: var(--muted); font-size: 14.5px; max-width: 54ch; margin-left: auto; margin-right: auto; }

.result .share-row { display: flex; justify-content: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.share-btn {
  all: unset;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 11px 22px;
  background: var(--accent);
  color: #fdf9ee;
  border: 2px solid var(--ink);
  transition: filter 0.15s;
}

.share-btn:hover { filter: brightness(1.1); }
.share-btn.secondary { background: transparent; color: var(--ink); }

.result .countdown { margin-top: 18px; color: var(--muted); font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.result .countdown b { color: var(--accent); }

/* ============ LEGEND / STATS / FOOTER ============ */

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 10.5px;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 10.5px;
}

.stats b { color: var(--accent); }

.site-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
  padding: 26px var(--pad) 40px;
  border-top: 2px solid var(--ink);
  color: var(--muted);
  font-size: 10.5px;
}

.site-footer a { color: var(--accent); }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 700px) {
  .poster-title { text-shadow: 2px 2px 0 rgba(185, 58, 27, 0.25); }
  .board { min-width: 760px; }
}

@media (prefers-reduced-motion: reduce) {
  .cell { animation: none; }
}
