/* ===== MAGYAR WORDLE ===== */

:root {
  --bg:           #070D0B;
  --surface:      #0E1812;
  --surface2:     #141F19;
  --border:       rgba(52,211,153,0.10);
  --border-hover: rgba(52,211,153,0.28);
  --accent:       #34D399;
  --accent-glow:  rgba(52,211,153,0.14);
  --text:         #D4EDE5;
  --muted:        rgba(212,237,229,0.45);
  --t:            0.2s;

  --correct:      #16A34A;
  --present:      #B45309;
  --absent:       #2D3748;
  --correct-key:  #15803D;
  --present-key:  #92400E;
  --absent-key:   #1E2A24;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── BACK ── */
.back {
  position: fixed; top: 1.25rem; left: 1.5rem; z-index: 100;
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; font-weight: 500;
  color: var(--muted); text-decoration: none;
  transition: color var(--t);
  letter-spacing: 0.02em;
}
.back:hover { color: var(--text); }
.back svg { opacity: 0.7; transition: opacity var(--t); }
.back:hover svg { opacity: 1; }

/* ── HERO ── */
.hero {
  min-height: 36vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  padding: 6rem 1.5rem 2.5rem;
  text-align: center;
}

.hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 50% 60%, rgba(52,211,153,0.10) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 50% 90%, rgba(52,211,153,0.04) 0%, transparent 60%);
  animation: aurora 14s ease-in-out infinite alternate;
}

@keyframes aurora {
  0%   { opacity: 0.5; transform: scale(1) rotate(0deg); }
  100% { opacity: 0.8; transform: scale(1.12) rotate(2deg); }
}

.badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid rgba(52,211,153,0.22); border-radius: 50px;
  padding: 0.35rem 1rem; margin-bottom: 1.2rem;
  background: rgba(52,211,153,0.06);
  animation: fade-up 0.8s cubic-bezier(.16,1,.3,1) 0.3s both;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.65); }
}

.hero h1 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 400; line-height: 1; letter-spacing: -0.02em;
  color: var(--text); margin-bottom: 1rem;
  animation: fade-up 0.9s cubic-bezier(.16,1,.3,1) 0.45s both;
}
.hero h1 .accent-text { font-style: italic; color: var(--accent); }

.hero-subtitle {
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  color: var(--muted); max-width: 360px; line-height: 1.7;
  animation: fade-up 0.9s cubic-bezier(.16,1,.3,1) 0.6s both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── MAIN ── */
main {
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 5rem;
}

.game-container {
  display: flex; flex-direction: column; align-items: center;
  gap: 1.5rem;
  width: 100%; max-width: 480px;
  padding: 0 1rem;
  animation: fade-up 0.7s cubic-bezier(.16,1,.3,1) 0.15s both;
}

/* ── BOARD ── */
.board {
  display: flex; flex-direction: column; gap: 6px;
}

.row {
  display: flex; gap: 6px;
}

.cell {
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 1.6rem; font-weight: 700;
  letter-spacing: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  user-select: none;
  transition: border-color 0.15s ease;
}

.cell[data-state="tbd"]     { border-color: rgba(52,211,153,0.4); }
.cell[data-state="correct"] { background: var(--correct); border-color: var(--correct); color: #fff; }
.cell[data-state="present"] { background: var(--present); border-color: var(--present); color: #fff; }
.cell[data-state="absent"]  { background: var(--absent);  border-color: var(--absent);  color: var(--muted); }

/* ── Cell animations ── */
@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.cell.pop { animation: pop 0.1s ease; }

@keyframes flip {
  0%   { transform: scaleY(1); }
  50%  { transform: scaleY(0.01); }
  100% { transform: scaleY(1); }
}
.cell.flip { animation: flip 0.36s ease-in-out; }

@keyframes bounce-win {
  0%, 100% { transform: translateY(0); }
  40%  { transform: translateY(-18px); }
  70%  { transform: translateY(-8px); }
}
.cell.bounce { animation: bounce-win 0.5s cubic-bezier(.16,1,.3,1); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
}
.row.shake { animation: shake 0.5s ease; }

/* ── KEYBOARD ── */
.keyboard {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  width: 100%;
}

.key-row {
  display: flex; gap: 5px; justify-content: center;
}

.key {
  min-width: 36px; height: 52px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem; font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t), transform 0.08s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.key:hover { border-color: var(--border-hover); background: var(--surface); }
.key:active { transform: scale(0.92); }

.key-wide { min-width: 58px; font-size: 0.72rem; letter-spacing: 0.04em; }

.key[data-state="correct"] { background: var(--correct-key); border-color: var(--correct); color: #fff; }
.key[data-state="present"] { background: var(--present-key); border-color: #D97706; color: #fff; }
.key[data-state="absent"]  { background: var(--absent-key);  border-color: transparent; color: var(--muted); }

/* ── TOAST ── */
.toast {
  position: fixed; top: 5rem; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 0.6rem 1.2rem; border-radius: 8px;
  font-size: 0.88rem; font-weight: 600;
  pointer-events: none;
  opacity: 0; transition: opacity 0.2s ease;
  z-index: 200; white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ── MODAL ── */
.modal {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  width: 100%; max-width: 380px;
  position: relative;
  animation: fade-up 0.35s cubic-bezier(.16,1,.3,1) both;
}

.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: transparent; border: none;
  color: var(--muted); font-size: 1rem; cursor: pointer;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: color var(--t), background var(--t);
}
.modal-close:hover { color: var(--text); background: var(--surface2); }

.modal-title {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 400; color: var(--text);
  text-align: center; margin-bottom: 0.35rem;
}

.modal-subtitle {
  font-size: 0.85rem; color: var(--muted);
  text-align: center; margin-bottom: 1.2rem;
}

.modal-word-reveal {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.75rem 1.25rem;
  margin-bottom: 1.4rem;
}
.modal-word-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.modal-word { font-family: 'Instrument Serif', serif; font-size: 1.6rem; font-style: italic; color: var(--accent); letter-spacing: 0.06em; }

.modal-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem; margin-bottom: 1.2rem;
}
.stat-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.6rem 0.4rem;
}
.stat-num { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.62rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: center; }

.modal-dist-title {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.6rem;
}

.distribution { display: flex; flex-direction: column; gap: 4px; margin-bottom: 1.4rem; }

.dist-row {
  display: flex; align-items: center; gap: 6px;
}
.dist-num {
  font-size: 0.8rem; font-weight: 600; color: var(--muted);
  min-width: 12px; text-align: right;
}
.dist-bar {
  min-width: 28px; height: 22px;
  background: var(--absent); border-radius: 4px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 6px;
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
  transition: width 0.5s cubic-bezier(.16,1,.3,1);
}
.dist-bar.highlight { background: var(--correct); color: #fff; }

.modal-actions { display: flex; justify-content: center; margin-bottom: 1rem; }

.share-btn {
  background: var(--accent); color: #07140F;
  border: none; border-radius: 12px;
  padding: 0.7rem 1.8rem;
  font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: opacity var(--t);
}
.share-btn:hover { opacity: 0.88; }

.modal-next {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-size: 0.8rem; color: var(--muted);
}
.next-timer {
  font-family: 'Inter', monospace; font-weight: 600;
  color: var(--accent); letter-spacing: 0.04em;
}

/* ── INFO SECTION ── */
.info-section {
  max-width: 560px; width: 100%;
  padding: 2.5rem 1.5rem 0;
}
.info-section h2 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 400; color: var(--text);
  margin-bottom: 0.75rem; margin-top: 1.5rem;
}
.info-section h2:first-child { margin-top: 0; }
.info-section p {
  font-size: 0.88rem; color: var(--muted); line-height: 1.7;
  margin-bottom: 0.5rem;
}
.info-section strong { color: var(--text); font-weight: 500; }

/* ── FOOTER ── */
footer {
  display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem; color: var(--muted);
}
footer a { color: var(--muted); text-decoration: none; transition: color var(--t); }
footer a:hover { color: var(--text); }

/* ── RESPONSIVE ── */
@media (max-width: 540px) {
  .hero { padding: 5rem 1rem 2rem; min-height: 30vh; }
  .cell { width: 52px; height: 52px; font-size: 1.3rem; }
  .key { min-width: 30px; height: 46px; font-size: 0.78rem; }
  .key-wide { min-width: 48px; }
  .modal-box { padding: 1.5rem 1.25rem; }
  .modal-stats { grid-template-columns: repeat(4, 1fr); gap: 0.35rem; }
}

@media (max-width: 380px) {
  .cell { width: 46px; height: 46px; font-size: 1.15rem; border-radius: 6px; }
  .key { min-width: 26px; height: 42px; font-size: 0.72rem; padding: 0 4px; }
  .key-wide { min-width: 42px; }
}

/* ── Focus ── */
.key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.share-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.modal-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
