/* ═══════════════════════════════════════════════════════════════
   CODENAMES DUO — Stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ── Fonts & Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #080810;
  --bg2:         #0e0e1c;
  --surface:     rgba(18,18,36,0.85);
  --surface2:    rgba(24,24,44,0.9);
  --border:      rgba(200,168,80,0.15);
  --border2:     rgba(200,168,80,0.3);
  --gold:        #c9a84c;
  --gold-dim:    rgba(201,168,76,0.6);
  --text:        #e8e0cc;
  --text-dim:    rgba(232,224,204,0.5);
  --text-faint:  rgba(232,224,204,0.25);

  --green:       #1a7a3e;
  --green-glow:  rgba(26,122,62,0.5);
  --green-light: #22a052;

  --red:         #7a1a1a;
  --red-glow:    rgba(122,26,26,0.5);
  --red-light:   #a02222;

  --neutral:     #252535;
  --neutral2:    #1e1e2e;

  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 8px 32px rgba(0,0,0,0.6);
  --shadow-sm:   0 4px 16px rgba(0,0,0,0.4);

  --font-title:  'Cinzel', serif;
  --font-body:   'Inter', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── Animated background ── */
.bg-anim {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(-45deg, #06060f, #0e0a1a, #0a1018, #06100a);
  background-size: 400% 400%;
  animation: bgShift 20s ease infinite;
  pointer-events: none;
}

.bg-anim::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(201,168,76,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(26,122,62,0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(122,26,26,0.05) 0%, transparent 40%);
}

@keyframes bgShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

/* ══════════════════════════════════════════════
   COMPONENTS
   ══════════════════════════════════════════════ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.08);
  opacity: 0;
  transition: opacity 0.15s;
}
.btn:hover::before { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #a07830, #c9a84c, #a07830);
  background-size: 200% auto;
  color: #080810;
  box-shadow: 0 4px 20px rgba(201,168,76,0.3);
  transition: background-position 0.4s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.btn-primary:hover {
  background-position: right center;
  box-shadow: 0 6px 30px rgba(201,168,76,0.5);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }

.btn-danger {
  background: linear-gradient(135deg, #6b1010, #a02222);
  color: #fff;
  box-shadow: 0 4px 16px rgba(160,34,34,0.3);
}
.btn-danger:hover { box-shadow: 0 6px 24px rgba(160,34,34,0.5); }

.btn-sm { padding: 8px 16px; font-size: 0.8rem; }

.btn-icon-only {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-icon { font-size: 1.2rem; font-weight: 300; }

/* ── Panel ── */
.panel {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  animation: fadeSlideUp 0.5s ease both;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-label {
  font-family: var(--font-title);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 14px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* ── Role badge ── */
.role-badge, .game-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.badge-a, .badge-role-a {
  background: rgba(201,168,76,0.12);
  border: 1px solid rgba(201,168,76,0.4);
  color: var(--gold);
}
.badge-b, .badge-role-b {
  background: rgba(76,148,201,0.12);
  border: 1px solid rgba(76,148,201,0.4);
  color: #4c94c9;
}
.badge-role-a::before { content: 'A'; }
.badge-role-b::before { content: 'B'; }

/* ══════════════════════════════════════════════
   HOME PAGE
   ══════════════════════════════════════════════ */
.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: relative;
  z-index: 1;
  padding: 28px 20px 20px;
  text-align: center;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 2rem;
  color: var(--gold);
  animation: pulse 3s ease-in-out infinite;
  display: block;
  line-height: 1;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.1); }
}

.logo h1 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--text);
  line-height: 1;
}
.logo h1 em {
  color: var(--gold);
  font-style: normal;
}

.home-main {
  flex: 1;
  position: relative;
  z-index: 1;
  padding: 8px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

/* ── Resume card ── */
.panel-resume { animation-delay: 0.05s; }

.resume-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.resume-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.resume-icon {
  font-size: 1.8rem;
}
.resume-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.resume-role {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.resume-actions {
  display: flex;
  gap: 8px;
}

/* ── Create panel ── */
.panel-create { animation-delay: 0.1s; }

.create-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.create-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.btn-create {
  width: 100%;
  padding: 14px 24px;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

/* ── Games list ── */
.panel-list { animation-delay: 0.15s; }

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.games-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-faint);
}
.empty-icon { font-size: 2rem; }
.empty-state p { font-size: 0.85rem; }

.game-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  animation: fadeSlideUp 0.3s ease both;
  transition: border-color 0.2s;
}
.game-item:hover { border-color: var(--border2); }

.game-item-info { flex: 1; min-width: 0; }
.game-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-item-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 3px;
}

.game-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
}
.status-waiting {
  background: rgba(201,168,76,0.1);
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.25);
}
.status-full {
  background: rgba(76,148,201,0.1);
  color: #4c94c9;
  border: 1px solid rgba(76,148,201,0.25);
}
.status-dot-waiting {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  animation: blink 1.5s ease-in-out infinite;
}
.status-dot-full {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4c94c9;
}

/* ══════════════════════════════════════════════
   GAME PAGE
   ══════════════════════════════════════════════ */
.game-page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(8,8,16,0.7);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.game-title-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.game-name {
  font-family: var(--font-title);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.game-role-badge { font-size: 0.65rem; }

/* ── Status bar ── */
.status-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(8,8,16,0.5);
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-dim);
  flex-shrink: 0;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: background 0.3s, box-shadow 0.3s;
}
.status-dot.connected {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.status-dot.error { background: var(--red-light); }

/* ── Game main ── */
.game-main {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  gap: 12px;
  min-height: 0;
}

/* ── Legend ── */
.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.legend-cell {
  width: 16px; height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}
.legend-green   { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.legend-black   { background: var(--red);   box-shadow: 0 0 6px var(--red-glow); }
.legend-neutral { background: var(--neutral); border: 1px solid rgba(255,255,255,0.08); }
.legend-guessed {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
}
.legend-guessed::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: rgba(255,255,255,0.5);
}

/* ── Grid ── */
.grid-wrapper {
  width: 100%;
  max-width: min(100%, 480px);
  flex-shrink: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: 100%;
  transition: transform 0.3s ease;
}

.grid.grid-b {
  transform: rotate(180deg);
}

/* ── Cell ── */
.cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.cell:hover { transform: scale(1.04); }
.cell:active { transform: scale(0.96); }

.grid-b .cell:hover { transform: scale(1.04); }
.grid-b .cell:active { transform: scale(0.96); }

/* Cell children never capture pointer events — all clicks go to .cell */
.cell-face,
.cell-icon,
.cell-check { pointer-events: none; }

/* Cell face (front visible state) */
.cell-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Cell icon (counter-rotated for agent B) */
.cell-icon {
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  line-height: 1;
  transition: transform 0.35s ease, opacity 0.35s ease;
  display: block;
}
.grid-b .cell-icon {
  transform: rotate(180deg);
}

/* Checkmark overlay — real DOM element, never blocks clicks */
.cell-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 900;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 0 24px rgba(255,255,255,0.45), 0 2px 8px rgba(0,0,0,0.9);
  background: rgba(0,0,0,0.8);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.cell.guessed .cell-check {
  opacity: 1;
  animation: checkIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
/* Counter-rotate for agent B */
.grid-b .cell .cell-check {
  transform: rotate(180deg);
}
.grid-b .cell.guessed .cell-check {
  animation: checkInB 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes checkIn {
  from { opacity: 0; transform: scale(0.2) rotate(-15deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes checkInB {
  from { opacity: 0; transform: rotate(180deg) scale(0.2); }
  to   { opacity: 1; transform: rotate(180deg) scale(1); }
}

/* ── Cell types ── */
.cell-green {
  background: linear-gradient(145deg, #0e4d28, #1a7a3e, #148032);
  border-color: rgba(26,160,82,0.35);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 16px rgba(26,122,62,0.25), inset 0 1px 0 rgba(255,255,255,0.06);
}
.cell-green:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 28px rgba(26,160,82,0.45), inset 0 1px 0 rgba(255,255,255,0.08);
}

.cell-black {
  background: linear-gradient(145deg, #2a0808, #6b0000, #560a0a);
  border-color: rgba(160,34,34,0.35);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 16px rgba(122,26,26,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
}
.cell-black:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 28px rgba(160,34,34,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
}

.cell-neutral {
  background: linear-gradient(145deg, #181828, #252538, #1e1e30);
  border-color: rgba(255,255,255,0.07);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.03);
}
.cell-neutral:hover {
  border-color: rgba(255,255,255,0.14);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ── Guessed state ── */
.cell.guessed .cell-face {
  opacity: 0.1;
  transform: scale(0.85);
}
.cell.guessed .cell-icon {
  opacity: 0;
  transform: scale(0.4);
}
.grid-b .cell.guessed .cell-icon {
  opacity: 0;
  transform: rotate(180deg) scale(0.4);
}

/* Cell tap ripple */
.cell-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: scale(0);
  animation: ripple 0.5s ease-out forwards;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* ── Counters ── */
.counters {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.counter { text-align: center; }
.counter-num {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
}
.counter-lbl {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}
.counter-sep { color: var(--border2); font-size: 1.2rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 32px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.8);
  animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-icon { font-size: 2.5rem; margin-bottom: 12px; }
.modal-title { font-family: var(--font-title); font-size: 1.2rem; margin-bottom: 10px; }
.modal-text  { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 24px; line-height: 1.6; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ══════════════════════════════════════════════
   RESPONSIVE / MOBILE TWEAKS
   ══════════════════════════════════════════════ */
@media (max-width: 380px) {
  .grid { gap: 4px; }
  .cell-icon { font-size: 1rem; }
  .legend { gap: 10px; }
  .legend-item { font-size: 0.65rem; }
}

@media (max-height: 700px) {
  .game-main { gap: 8px; padding: 8px 14px; }
  .legend { gap: 10px; }
  .counters { padding: 8px 16px; }
  .counter-num { font-size: 1.1rem; }
}

/* Prevent bounce on iOS */
@supports (-webkit-touch-callout: none) {
  .game-page  { height: -webkit-fill-available; }
  .words-page { height: -webkit-fill-available; }
}

/* ══════════════════════════════════════════════
   WORDS PAGE
   ══════════════════════════════════════════════ */

/* Home page button variant */
.badge-words {
  background: rgba(120,80,200,0.12);
  border: 1px solid rgba(120,80,200,0.4);
  color: #a07ee0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.btn-words {
  background: linear-gradient(135deg, #4a2880, #7b4cc8, #4a2880);
  background-size: 200% auto;
  color: #fff;
  box-shadow: 0 4px 20px rgba(120,80,200,0.3);
  transition: background-position 0.4s ease, transform 0.15s ease, box-shadow 0.2s ease;
  text-decoration: none;
}
.btn-words:hover {
  background-position: right center;
  box-shadow: 0 6px 30px rgba(120,80,200,0.5);
}

/* Layout */
.words-page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.words-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(8,8,16,0.7);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.words-title-block {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.words-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  color: var(--text);
}

.words-main {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  padding: 10px;
  min-height: 0;
}

/* Grid */
.word-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 7px;
  width: 100%;
  min-height: 0;
}

/* Card */
.word-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background:
    linear-gradient(145deg,
      rgba(255,255,255,0.04) 0%,
      transparent 45%,
      rgba(0,0,0,0.12) 100%
    ),
    linear-gradient(to bottom,
      #1d1604 50%,
      #131326 50%
    );
  border: 1px solid rgba(201,168,76,0.22);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.15s ease, filter 0.15s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
  padding: 5px 4px;
  min-height: 0;
}
.word-card:hover {
  border-color: rgba(201,168,76,0.5);
  filter: brightness(1.18);
  box-shadow: 0 4px 18px rgba(0,0,0,0.5), 0 0 14px rgba(201,168,76,0.1);
  transform: scale(1.025);
}
.word-card:active { transform: scale(0.975); }

/* Word text — shown top (rotated) and bottom (normal) */
.wc-text {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  font-size: clamp(0.5rem, 1.55vw, 0.95rem);
  line-height: 1.1;
  padding: 0 2px;
  pointer-events: none;
  transition: opacity 0.3s ease;
  word-break: break-word;
  hyphens: auto;
}
.wc-top { transform: rotate(180deg); }

.wc-divider {
  width: 100%;
  height: 1px;
  background: rgba(201,168,76,0.35);
  flex-shrink: 0;
  pointer-events: none;
}

/* Overlay when found */
.wc-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.78);
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.wc-check {
  font-size: clamp(1.2rem, 3.5vw, 2rem);
  font-weight: 900;
  color: rgba(255,255,255,0.88);
  text-shadow: 0 0 20px rgba(255,255,255,0.4);
  pointer-events: none;
}
.word-card.found .wc-overlay { opacity: 1; }
.word-card.found .wc-text    { opacity: 0.18; }

/* Found animation */
.word-card.found .wc-check {
  animation: checkIn 0.38s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* iPad-specific optimisations */
@media (min-width: 768px) {
  .words-main  { padding: 12px 14px; }
  .word-grid   { gap: 9px; }
  .words-header { padding: 12px 18px; }
}

@media (min-width: 1024px) {
  .words-main  { padding: 14px 18px; }
  .word-grid   { gap: 10px; }
}
