:root{
  --pink:#ec4899;
  --pink-dark:#db2777;
  --pink-soft:#fce7f3;
  --purple:#8b5cf6;
  --purple-soft:#ede9fe;
  --gold:#fbbf24;
  --mint:#d1fae5;
  --blue:#dbeafe;
  --text:#4a2d4f;
  --muted:#7c6280;
  --bg1:#fff8fc;
  --bg2:#fffdfd;
  --card:#ffffffee;
  --line:#f3d3e6;
  --shadow:0 18px 45px rgba(219,39,119,.12);

  --tile-empty:#ffffff;
  --tile-border:#e9cddd;
  --tile-correct:#22c55e;
  --tile-present:#f59e0b;
  --tile-absent:#c7b8c3;
  --key-bg:#ffffff;
  --key-text:#5a3a5c;
}

*{
  box-sizing:border-box;
}

html{
  scroll-behavior:smooth;
}

body{
  margin:0;
  font-family: Tahoma, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at top right, #ffe3f1 0%, transparent 28%),
    radial-gradient(circle at bottom left, #ece4ff 0%, transparent 30%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 100%);
  min-height:100vh;
}

button,
select{
  font:inherit;
}

.page-shell{
  min-height:100vh;
  width:min(calc(100% - 18px), 980px);
  margin:auto;
  padding:12px 0 20px;
}

.game-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.back-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:46px;
  padding:0 16px;
  border-radius:16px;
  text-decoration:none;
  background:#fff;
  border:1px solid var(--line);
  color:var(--pink-dark);
  font-weight:800;
  box-shadow:0 10px 22px rgba(219,39,119,.08);
}

.brand-badge{
  min-height:46px;
  padding:0 16px;
  border-radius:16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg,var(--pink),var(--purple));
  color:#fff;
  font-weight:900;
  box-shadow:0 12px 25px rgba(139,92,246,.18);
}

.game-wrap{
  display:grid;
  gap:16px;
}

.hero-card,
.board-card,
.keyboard-card{
  background:var(--card);
  border:1px solid rgba(255,255,255,.95);
  border-radius:28px;
  box-shadow:var(--shadow);
  padding:18px;
  backdrop-filter:blur(10px);
}

.hero-card{
  display:grid;
  grid-template-columns:1.1fr .95fr;
  gap:16px;
  align-items:center;
}

.mini-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:9px 14px;
  border-radius:999px;
  background:#fff;
  border:1px solid #f7d4e4;
  color:var(--pink-dark);
  font-size:13px;
  font-weight:900;
  margin-bottom:10px;
}

.hero-copy h1{
  margin:0 0 10px;
  color:var(--pink-dark);
  font-size:clamp(28px,4vw,42px);
  line-height:1.1;
}

.hero-text{
  margin:0;
  color:var(--muted);
  line-height:1.9;
  font-size:16px;
}

.hero-controls{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}

.info-box{
  background:#fff;
  border:1px solid var(--line);
  border-radius:20px;
  padding:14px;
  text-align:center;
}

.info-label{
  display:block;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
  margin-bottom:6px;
}

.info-value{
  display:block;
  color:var(--pink-dark);
  font-size:20px;
  font-weight:900;
}

.select-group{
  grid-column:1 / -1;
  display:grid;
  gap:8px;
}

.select-group label{
  font-weight:800;
  color:var(--muted);
  font-size:14px;
}

.select-group select{
  width:100%;
  min-height:50px;
  border-radius:16px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  padding:0 14px;
  outline:none;
}

.select-group select:focus{
  border-color:var(--pink);
  box-shadow:0 0 0 4px rgba(236,72,153,.12);
}

.primary-btn{
  grid-column:1 / -1;
  min-height:52px;
  border:none;
  border-radius:18px;
  cursor:pointer;
  color:#fff;
  font-weight:900;
  background:linear-gradient(135deg,var(--pink),var(--purple));
  box-shadow:0 14px 25px rgba(219,39,119,.16);
  transition:.2s ease;
}

.primary-btn:hover{
  transform:translateY(-2px);
}

.hint-box{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  padding:14px 16px;
  border-radius:18px;
  background:linear-gradient(135deg,#fff1f7,#f8f4ff);
  border:1px solid var(--line);
  margin-bottom:12px;
}

.hint-title{
  font-weight:900;
  color:var(--pink-dark);
}

.hint-text{
  color:var(--muted);
  font-weight:700;
}

.message-bar{
  min-height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:10px 14px;
  border-radius:16px;
  background:#fff;
  border:1px solid var(--line);
  color:var(--muted);
  font-weight:800;
  margin-bottom:14px;
}

.message-bar.success{
  background:#ecfdf5;
  border-color:#bbf7d0;
  color:#166534;
}

.message-bar.error{
  background:#fff1f2;
  border-color:#fecdd3;
  color:#be123c;
}

.board{
  display:grid;
  gap:10px;
  justify-content:center;
  margin-bottom:16px;
}

.board-row{
  display:grid;
  gap:10px;
}

.tile{
  width:68px;
  height:68px;
  border-radius:18px;
  background:var(--tile-empty);
  border:2px solid var(--tile-border);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:28px;
  font-weight:900;
  color:var(--text);
  transition:.15s ease;
  user-select:none;
}

.tile.filled{
  border-color:#d8a8c4;
  background:#fffafd;
}

.tile.correct{
  background:var(--tile-correct);
  border-color:var(--tile-correct);
  color:#fff;
}

.tile.present{
  background:var(--tile-present);
  border-color:var(--tile-present);
  color:#fff;
}

.tile.absent{
  background:var(--tile-absent);
  border-color:var(--tile-absent);
  color:#fff;
}

.tile.shake{
  animation:shake .35s ease-in-out;
}

@keyframes shake{
  0%,100%{transform:translateX(0)}
  25%{transform:translateX(-6px)}
  50%{transform:translateX(6px)}
  75%{transform:translateX(-4px)}
}

.legend{
  display:grid;
  gap:8px;
}

.legend-item{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--muted);
  font-weight:700;
  font-size:14px;
}

.legend-tile{
  width:18px;
  height:18px;
  border-radius:6px;
  display:inline-block;
}

.legend-tile.correct{background:var(--tile-correct)}
.legend-tile.present{background:var(--tile-present)}
.legend-tile.absent{background:var(--tile-absent)}

.keyboard{
  display:grid;
  gap:8px;
}

.keyboard-row{
  display:flex;
  justify-content:center;
  gap:6px;
  flex-wrap:wrap;
}

.key{
  min-width:48px;
  height:52px;
  border:none;
  border-radius:14px;
  cursor:pointer;
  background:var(--key-bg);
  color:var(--key-text);
  font-weight:900;
  box-shadow:0 6px 14px rgba(0,0,0,.05);
  border:1px solid #f0dbe6;
  transition:.15s ease;
}

.key:hover{
  transform:translateY(-1px);
}

.key.wide{
  min-width:82px;
  padding:0 12px;
}

.key.correct{
  background:var(--tile-correct);
  color:#fff;
  border-color:var(--tile-correct);
}

.key.present{
  background:var(--tile-present);
  color:#fff;
  border-color:var(--tile-present);
}

.key.absent{
  background:var(--tile-absent);
  color:#fff;
  border-color:var(--tile-absent);
}

.result-overlay{
  position:fixed;
  inset:0;
  background:rgba(50,24,48,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:100;
}

.result-overlay.hidden{
  display:none;
}

.result-box{
  width:min(100%, 420px);
  background:#fff;
  border-radius:28px;
  padding:24px;
  box-shadow:0 24px 50px rgba(0,0,0,.2);
  text-align:center;
}

.result-box h2{
  margin:0 0 10px;
  color:var(--pink-dark);
  font-size:30px;
}

.result-box p{
  margin:0 0 14px;
  color:var(--muted);
  line-height:1.8;
}

.answer-line{
  margin-bottom:18px;
  padding:14px;
  border-radius:16px;
  background:var(--pink-soft);
  color:var(--text);
  font-weight:800;
}

.answer-line strong{
  color:var(--pink-dark);
  font-size:24px;
  margin-inline-start:8px;
}

@media (max-width: 760px){
  .hero-card{
    grid-template-columns:1fr;
  }

  .tile{
    width:58px;
    height:58px;
    font-size:24px;
  }
}

@media (max-width: 480px){
  .page-shell{
    width:min(calc(100% - 12px), 980px);
  }

  .hero-card,
  .board-card,
  .keyboard-card{
    padding:14px;
    border-radius:22px;
  }

  .hero-controls{
    grid-template-columns:1fr 1fr;
  }

  .tile{
    width:52px;
    height:52px;
    border-radius:14px;
    font-size:22px;
  }

  .key{
    min-width:40px;
    height:48px;
    font-size:14px;
  }

  .key.wide{
    min-width:72px;
  }
}