/* 猜单词 —— 样式 */
:root{
  --bg:#0f172a;
  --panel:#1e293b;
  --text:#f1f5f9;
  --muted:#94a3b8;
  --accent:#38bdf8;
  --green:#4ade80;
  --yellow:#fbbf24;
  --gray:#78716c;
  --key-bg:#334155;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  line-height:1.5;
}
a { color:var(--accent); text-decoration:underline; text-decoration-thickness:2px; text-underline-offset:3px; }
a:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }

.skip-link {
  position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden;
}
.skip-link:focus { position:static; width:auto; height:auto; padding:1rem; background:#000; color:#fff; }

.site-header { background:var(--panel); border-bottom:1px solid #334155; padding:0.75rem 0; }
.header-inner { max-width:1000px; margin:0 auto; padding:0 1rem; display:flex; align-items:center; gap:1rem; flex-wrap:wrap; }
.brand { color:var(--text); text-decoration:none; font-weight:800; font-size:1.25rem; letter-spacing:0.05em; }
.main-nav { margin-left:auto; }
.nav-list { display:flex; gap:0.75rem; list-style:none; margin:0; padding:0; }
.nav-link { color:var(--muted); text-decoration:none; padding:0.4rem 0.75rem; border-radius:6px; }
.nav-link:hover, .nav-link:focus-visible { background:#334155; color:var(--text); }

.container { max-width:1000px; margin:0 auto; padding:0 1rem; }

.hero { padding:2.5rem 0; background:linear-gradient(180deg,#0f172a,#0b1021); }
.hero-grid { display:flex; flex-direction:column; gap:2rem; align-items:center; text-align:center; }
@media (min-width:768px){ .hero-grid{ flex-direction:row; text-align:left; align-items:center; } }
.eyebrow { color:var(--accent); font-size:0.9rem; text-transform:uppercase; letter-spacing:0.1em; margin:0 0 0.5rem; display:flex; align-items:center; justify-content:center; gap:0.5rem; }
@media (min-width:768px){ .eyebrow{ justify-content:flex-start; } }
.hero h1 { font-size:clamp(2rem,5vw,3rem); margin:0 0 1rem; line-height:1.1; }
.hero-lede { color:var(--muted); font-size:1.05rem; max-width:62ch; margin:0 0 1.5rem; }
.hero-actions { display:flex; gap:0.75rem; flex-wrap:wrap; justify-content:center; }
@media (min-width:768px){ .hero-actions{ justify-content:flex-start; } }
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:0.4rem;
  padding:0.6rem 1.2rem; border:1px solid transparent; border-radius:8px; font-weight:700;
  font-size:1rem; cursor:pointer; text-decoration:none; transition:transform .1s, background .2s;
}
.btn:active { transform:scale(0.97); }
.btn:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.btn-primary { background:var(--accent); color:#000; border-color:var(--accent); }
.btn-primary:hover { background:#7dd3fc; }
.btn-secondary { background:transparent; color:var(--text); border:1px solid #475569; }
.btn-secondary:hover { background:#334155; }
.btn-outline { background:transparent; color:var(--text); border:1px solid #475569; padding:0.45rem 1rem; font-size:0.95rem; }
.btn-outline:hover { background:#334155; }

.section { padding:2rem 0; }
.game-header { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:0.75rem; margin-bottom:1.25rem; }
.game-header h2 { margin:0; font-size:1.5rem; }
.game-controls { display:flex; gap:0.5rem; flex-wrap:wrap; }

.wordle-board { display:flex; flex-direction:column; align-items:center; gap:1rem; }
.grid {
  display:grid;
  grid-template-columns: repeat(5, 1fr);
  gap:0.5rem;
  max-width:400px;
  width:100%;
}
.tile {
  width:60px; height:60px; border-radius:6px; border:2px solid #334155;
  background:#1e293b; display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:1.75rem; text-transform:uppercase; user-select:none; touch-action:none;
}
.tile.empty { border-style:dashed; border-color:#334155; }
.tile.fill { border-style:solid; }
.tile.flip { animation: flip 0.6s ease-in-out; }
.tile.show { border-color:#475569; }
.tile.green { background:var(--green); border-color:var(--green); color:#000; }
.tile.yellow { background:var(--yellow); border-color:var(--yellow); color:#000; }
.tile.gray { background:var(--gray); border-color:var(--gray); color:#fff; }

@keyframes flip {
  0% { transform: rotateX(0); }
  45% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

.keyboard {
  max-width:600px; margin:1.5rem auto 0;
  display:flex; flex-direction:column; gap:0.5rem;
}
.keyboard .row {
  display:flex; justify-content:center; gap:0.4rem; flex-wrap:wrap;
}
.key {
  width:48px; height:58px; border-radius:8px; border:none;
  background:var(--key-bg); color:var(--text); font-weight:700; font-size:1rem;
  cursor:pointer; user-select:none; touch-action:none;
}
.key:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.key.wide { width:72px; }
.key.green { background:var(--green); color:#000; }
.key.yellow { background:var(--yellow); color:#000; }
.key.gray { background:var(--gray); color:#fff; }

.game-status {
  margin-top:1rem; padding:0.75rem 1rem; background:var(--panel); border-radius:8px;
  border:1px solid #334155; font-size:0.95rem; color:var(--muted);
}
.game-status strong { color:var(--text); }
#message { margin-top:0.5rem; min-height:1.3rem; color:var(--accent); font-weight:700; }

#how-to-play { margin-top:1.5rem; }
#how-to-play h3 { margin-top:0; font-size:1.1rem; color:var(--accent); }
#how-to-play ul { color:var(--muted); padding-left:1.2rem; }
#how-to-play li { margin:0.35rem 0; }

.preview-grid { display:flex; gap:1rem; justify-content:center; align-items:center; }
.preview-tile { width:64px; height:64px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:2rem; }
.tile-green { background:var(--green); color:#000; }
.tile-yellow { background:var(--yellow); color:#000; }
.tile-gray { background:var(--gray); color:#fff; }

.site-footer { margin-top:3rem; padding:1.5rem 0; border-top:1px solid #334155; color:var(--muted); font-size:0.9rem; text-align:center; }
.site-footer a { color:var(--accent); }

@media (prefers-reduced-motion: reduce){
  * { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
  .tile.flip { animation:none; }
}
