/* ── WORDLE PAGE ─────────────────────────────────────────────────────────── */

:root {
  --wl-correct: #3a9c4f;
  --wl-partial: #b8860b;
  --wl-wrong:   #1a1a24;
  --wl-higher:  #b8860b;
  --wl-lower:   #b8860b;
  --wl-cell-w:  104px;
  --wl-char-w:  210px;
}

.wordle-page .footer { display: none; }
.wordle-main { padding: 0 0 170px; overflow-x: clip; }

/* ── HEADER ── */
.wl-header {
  text-align: center;
  padding: 36px 20px 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.wl-header-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  margin-bottom: 16px;
}
.wl-back-link {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s;
}
.wl-back-link:hover { color: var(--gold); }

.wl-day-badge {
  font-family: var(--font-hero);
  font-size: 13px;
  letter-spacing: 2px;
  line-height: 1;
  color: var(--gold-dim);
  background: var(--gold-glow);
  border: 1px solid var(--gold-dim);
  padding: 6px 12px 4px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
}
.wl-how-btn {
  justify-self: end;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
}
.wl-how-btn:hover { color: var(--text); }

.wl-title {
  font-family: var(--font-hero);
  font-size: clamp(44px, 8vw, 76px);
  letter-spacing: 4px;
  line-height: 1;
  margin-bottom: 8px;
}
.wl-subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 14px;
}

/* Day navigation + solve counter */
.wl-day-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 28px;
}
.wl-day-nav-btn {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg3);
  transition: color 0.15s, border-color 0.15s;
}
.wl-day-nav-btn:hover { color: var(--gold); border-color: var(--gold-dim); }

.wl-solve-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}
.wl-solve-icon { color: var(--gold-dim); font-size: 11px; }
#wlSolveCount {
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

/* Yesterday badge on day indicator */
.wl-day-badge.wl-day-yesterday {
  background: rgba(184,134,11,0.06);
  border-color: rgba(184,134,11,0.3);
  color: var(--text-dim);
}

/* ── MYSTERY PANEL ── */
.wl-mystery {
  max-width: 360px;
  margin: 0 auto 44px;
  padding: 0 20px;
  position: relative;
  text-align: center;
}
.wl-mystery::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 560px;
  height: 380px;
  background: radial-gradient(ellipse, rgba(201,162,39,0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.wl-mystery-inner {
  position: relative;
  z-index: 1;
  background: linear-gradient(145deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid rgba(201,162,39,0.25);
  border-radius: 20px;
  padding: 40px 24px 32px;
  overflow: hidden;
  transition: border-color 0.4s, box-shadow 0.4s;
}
.wl-mystery-inner::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,162,39,0.5), transparent);
  pointer-events: none;
}
.wl-mystery-icon {
  width: 90px;
  height: 90px;
  display: block;
  margin: 0 auto 16px;
  filter: sepia(1) saturate(2.5) brightness(0.85) drop-shadow(0 0 14px rgba(201,162,39,0.4));
  animation: wl-float 3.5s ease-in-out infinite;
}
@keyframes wl-float {
  0%, 100% { transform: translateY(0px); opacity: 0.6; }
  50%       { transform: translateY(-8px); opacity: 1; }
}
.wl-mystery-label {
  font-family: var(--font-hero);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Revealed mystery state */
.wl-mystery-inner.revealed {
  border-color: var(--gold-dim);
  box-shadow: 0 0 60px rgba(201,162,39,0.14);
}
.wl-mystery-reveal-img {
  width: 90px;
  height: 90px;
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto 14px;
  border: 2px solid rgba(201,162,39,0.5);
}
.wl-mystery-reveal-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.wl-mystery-reveal-name {
  font-family: var(--font-hero);
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--text);
}

/* ── HOW TO PLAY MODAL ── */
.wl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.wl-modal {
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  position: relative;
}
.wl-modal h2 {
  font-family: var(--font-hero);
  font-size: 22px;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.wl-modal p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.wl-modal-note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.wl-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}
.wl-modal-close:hover { color: var(--text); }

.wl-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}
.wl-legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.wl-legend-cell {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.wl-legend-cell.wl-state-correct  { background: var(--wl-correct); }
.wl-legend-cell.wl-state-partial  { background: var(--wl-partial); }
.wl-legend-cell.wl-state-wrong    { background: var(--wl-wrong); border: 1px solid var(--border-hi); }
.wl-legend-cell.wl-state-higher   { background: var(--wl-higher); }
.wl-legend-cell.wl-state-lower    { background: var(--wl-lower); }

/* ── BOARD ── */
.wl-board-wrap {
  overflow-x: auto;
  padding: 0 16px 32px;
  -webkit-overflow-scrolling: touch;
}
.wl-board {
  min-width: calc(var(--wl-char-w) + var(--wl-cell-w) * 9 + 10 * 6px);
  width: max-content;
  margin: 0 auto;
  max-width: 100%;
}

/* Header row */
.wl-header-row {
  display: flex;
  gap: 6px;
  padding: 0 0 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 10px;
}
.wl-th {
  width: var(--wl-cell-w);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  padding: 6px 2px;
  flex-shrink: 0;
}
.wl-th-char {
  width: var(--wl-char-w);
  text-align: left;
  padding-left: 10px;
}

/* Rows */
.wl-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wl-row {
  display: flex;
  gap: 6px;
}

/* ── CELLS ── */
.wl-cell {
  width: var(--wl-cell-w);
  height: 88px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--wl-wrong);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.wl-cell-char {
  width: var(--wl-char-w);
  justify-content: flex-start;
  gap: 10px;
  padding: 0 10px;
  background: var(--card);
  border-color: var(--border-hi);
}

.wl-char-img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg3);
}
.wl-char-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.wl-char-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.wl-cell-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  padding: 6px;
  width: 100%;
}
.wl-cell-val {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
}
.wl-arrow {
  font-size: 15px;
  display: block;
  line-height: 1;
}

/* Haki chips */
.wl-haki-val {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  width: 100%;
}
.wl-haki-chip {
  background: rgba(255,255,255,0.18);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.wl-haki-abbr { display: none; }

/* State colors */
.wl-state-correct {
  background: var(--wl-correct);
  border-color: var(--wl-correct);
  box-shadow: 0 0 20px rgba(58,156,79,0.32), inset 0 1px 0 rgba(255,255,255,0.12);
}
.wl-state-partial {
  background: var(--wl-partial);
  border-color: var(--wl-partial);
  box-shadow: 0 0 20px rgba(184,134,11,0.32), inset 0 1px 0 rgba(255,255,255,0.12);
}
.wl-state-wrong {
  background: var(--wl-wrong);
  border-color: var(--border);
}
.wl-state-higher {
  background: var(--wl-higher);
  border-color: var(--wl-higher);
  box-shadow: 0 0 20px rgba(184,134,11,0.32), inset 0 1px 0 rgba(255,255,255,0.12);
}
.wl-state-lower {
  background: var(--wl-lower);
  border-color: var(--wl-lower);
  box-shadow: 0 0 20px rgba(184,134,11,0.32), inset 0 1px 0 rgba(255,255,255,0.12);
}

/* ── FLIP ANIMATION ── */
@keyframes wl-flip {
  0%   { transform: scaleY(1); }
  45%  { transform: scaleY(0); }
  55%  { transform: scaleY(0); }
  100% { transform: scaleY(1); }
}
.wl-cell.wl-animating {
  animation: wl-flip 0.5s ease forwards;
}

/* ── GAME HUD (sticky bottom) ── */
.wl-game-hud {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(10, 10, 14, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 10px 16px 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
}
.wl-hud-inner {
  max-width: 700px;
  margin: 0 auto;
}
.wl-hud-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.wl-hud-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
}
.wl-hud-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.wl-hud-count {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.wl-hud-controls {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

/* ── AUTOCOMPLETE ── */
.wl-autocomplete {
  flex: 1;
  position: relative;
}
.wl-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}
.wl-search {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 15px 16px 15px 42px;
  outline: none;
  transition: border-color 0.15s;
}
.wl-search::placeholder { color: var(--text-dim); }
.wl-search:focus { border-color: var(--gold-dim); }

/* Dropdown opens UPWARD */
.wl-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  top: auto;
  left: 0;
  right: 0;
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  max-height: 320px;
  overflow-y: auto;
  z-index: 400;
  display: none;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.6);
}
.wl-dropdown.open { display: block; }

.wl-drop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}
.wl-drop-item:last-child { border-bottom: none; }
.wl-drop-item:hover, .wl-drop-item.selected { background: var(--card-hover); }
.wl-drop-item.guessed {
  opacity: 0.35;
  pointer-events: none;
}
.wl-drop-img {
  width: 34px;
  height: 34px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg2);
  flex-shrink: 0;
}
.wl-drop-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.wl-drop-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.wl-drop-alias {
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.wl-drop-faction {
  font-size: 11px;
  color: var(--text-muted);
}

.wl-guess-btn {
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-hero);
  font-size: 18px;
  letter-spacing: 1px;
  padding: 15px 28px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  white-space: nowrap;
  flex-shrink: 0;
}
.wl-guess-btn:hover:not(:disabled) { background: var(--gold2); transform: translateY(-1px); }
.wl-guess-btn:active:not(:disabled) { transform: translateY(0); }
.wl-guess-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── RESULT BANNER ── */
.wl-result {
  max-width: 600px;
  margin: 32px auto 0;
  padding: 0 16px;
  text-align: center;
}
.wl-result-inner {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin-bottom: 16px;
}
.wl-result-img {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto 14px;
  border: 2px solid var(--border-hi);
}
.wl-result-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.wl-result-label {
  font-family: var(--font-hero);
  font-size: 28px;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.wl-result-label.win  { color: var(--wl-correct); }
.wl-result-label.lose { color: var(--red); }
.wl-result-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.wl-result-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.wl-result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.wl-share-btn {
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-hero);
  font-size: 15px;
  letter-spacing: 1px;
  padding: 11px 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.wl-share-btn:hover { background: var(--gold2); }

.wl-char-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  padding: 11px 18px;
  transition: color 0.15s, border-color 0.15s;
}
.wl-char-link:hover { color: var(--text); border-color: var(--gold-dim); }

/* share toast */
.wl-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 99px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}
.wl-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* label hidden by default (shown in mobile card layout) */
.wl-cell-label { display: none; }

/* ── TABLET (≤700px) — shrink table cells ── */
@media (max-width: 700px) {
  :root { --wl-cell-w: 82px; --wl-char-w: 158px; }
  .wl-cell { height: 74px; }
  .wl-haki-full { display: none; }
  .wl-haki-abbr { display: inline; }
  .wl-char-img { width: 44px; height: 44px; }
  .wl-char-name { font-size: 12px; }
  .wl-cell-val { font-size: 11px; }
  .wl-guess-btn { padding: 15px 18px; font-size: 15px; }
  .wl-title { font-size: 38px; }
  .wl-mystery-icon { width: 96px; }
  .wl-mystery-inner { padding: 28px 16px 22px; }
}

/* ── MOBILE (≤640px) — card layout, no horizontal scroll ── */
@media (max-width: 640px) {
  /* board */
  .wl-header-row { display: none; }
  .wl-board-wrap { overflow-x: visible; padding: 0 12px 24px; }
  .wl-board { min-width: 0; width: 100%; }
  .wl-rows { gap: 10px; }

  /* each guess = card */
  .wl-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2px;
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border-hi);
    border-radius: 14px;
    overflow: hidden;
    padding: 0;
    flex-wrap: unset;
  }

  /* character spans full width */
  .wl-cell-char {
    grid-column: 1 / -1;
    width: 100%;
    height: 52px;
    border-radius: 0;
    border: none;
    background: rgba(10, 10, 16, 0.95);
    padding: 0 12px;
  }
  .wl-char-img { width: 36px; height: 36px; border-radius: 6px; }
  .wl-char-name { font-size: 13px; font-weight: 600; -webkit-line-clamp: 1; }

  /* 9 data cells in 3×3 grid */
  .wl-cell:not(.wl-cell-char) {
    width: 100%;
    height: 66px;
    border-radius: 0;
    border: none;
    flex-direction: column;
  }

  /* show inline column labels */
  .wl-cell-label {
    display: block;
    font-size: 9px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    line-height: 1;
    margin-bottom: 4px;
  }
  /* on coloured cells, label stays readable */
  .wl-state-correct .wl-cell-label,
  .wl-state-partial .wl-cell-label,
  .wl-state-higher .wl-cell-label,
  .wl-state-lower .wl-cell-label { color: rgba(255,255,255,0.6); }

  .wl-cell-val { font-size: 11px; }
  .wl-arrow { font-size: 11px; }

  /* state borders off (card gap acts as separator) */
  .wl-state-correct,
  .wl-state-partial,
  .wl-state-higher,
  .wl-state-lower { border: none; }

  /* header + mystery */
  .wl-header { padding: 20px 14px 14px; }
  .wl-title { font-size: 26px; letter-spacing: 2px; }
  .wl-subtitle { font-size: 13px; margin-bottom: 10px; }
  .wl-mystery { margin-bottom: 20px; padding: 0 12px; }
  .wl-mystery-inner { padding: 22px 14px 18px; }
  .wl-mystery-icon { width: 78px; }

  /* HUD tweaks */
  .wl-game-hud { padding: 8px 12px 12px; }
  .wl-search { font-size: 16px; padding: 13px 14px 13px 40px; }
  .wl-guess-btn { padding: 13px 16px; font-size: 15px; }
}

/* ── Lift HUD above bottom-nav (bottom-nav = 58px, shown ≤768px) ── */
@media (max-width: 768px) {
  .wl-game-hud { bottom: calc(58px + env(safe-area-inset-bottom)); }
  .wordle-main { padding-bottom: calc(260px + env(safe-area-inset-bottom)); }
}
