:root {
  color-scheme: light;
  font-family: ui-rounded, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color: #443b2c;
  background: #eaf0d9;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body {
  --home-sky: var(--sky-top);
  --home-upper: var(--sky-upper);
  --home-lower: var(--sky-bottom);
  --home-ground: var(--ground-a);
  --hero-ink: #443b2c;
  --hero-muted: #6d735e;
  margin: 0;
  min-height: 100vh;
  background:
    url("textures/noise.svg") repeat,
    radial-gradient(circle at 90% 5%, #ffe8a899, transparent 28%),
    linear-gradient(180deg, var(--home-sky) 0%, var(--home-upper) 38%, var(--home-lower) 83%, var(--home-ground) 100%);
  background-size: 160px 160px, auto, auto;
  background-attachment: fixed;
}
.sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.cloud { position: absolute; left: 0; width: 260px; opacity: 0.65; animation: cloud-drift 80s linear infinite; will-change: transform; }
.cloud-one { top: 1%; animation-delay: -12s; }
.cloud-two { top: 2%; width: 310px; animation-duration: 110s; animation-delay: -67s; }
.cloud-three { bottom: 7%; width: 180px; opacity: 0.3; animation-duration: 95s; animation-delay: -35s; }
main { position: relative; width: min(1120px, 100%); margin: 0 auto; padding: 40px 28px 24px; }
.welcome { text-align: center; margin-bottom: 32px; color: var(--hero-ink); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; color: var(--hero-muted); }
.brand img { width: 30px; height: 36px; }
h1 { margin: 13px 0 10px; font-size: clamp(2rem, 4.5vw, 3.25rem); letter-spacing: -0.045em; line-height: 1.12; }
.welcome p { margin: 0; color: var(--hero-muted); font-size: 1.05rem; }
.games { display: grid; grid-template-columns: 1.12fr 1fr 1fr; gap: 18px; }
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  min-width: 0;
  border: 1px solid #fff8e5;
  border-radius: 24px;
  background: #fffaf0eF;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 7px 18px #66532b10, inset 0 1px 0 #ffffff;
  transition: transform 180ms ease, box-shadow 180ms ease;
  overflow: hidden;
}
.game-card:hover { transform: translateY(-5px); box-shadow: 0 13px 25px #66532b23; }
.game-card:focus-visible { outline: 3px solid #a45b20; outline-offset: 5px; }
.category { font-size: 0.68rem; font-weight: 750; letter-spacing: 0.09em; text-transform: uppercase; color: #7e785f; }
h2 { margin: 0 0 7px; font-size: 1.23rem; line-height: 1.25; letter-spacing: -0.025em; }
.card-copy p { margin: 0; color: #7c765f; font-size: 0.87rem; line-height: 1.6; }
.card-arrow { position: absolute; right: 18px; bottom: 20px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e8ddba80; color: #827244; font-size: 1.1rem; }
.card-copy { padding-right: 16px; }
.piece-scene { position: relative; height: 126px; margin: 12px 0 15px; }
.piece-scene::before { content: ""; position: absolute; left: 8%; right: 8%; bottom: 0; height: 55px; border-radius: 50%; background: radial-gradient(ellipse, var(--scene-color, #cbd8ac) 0%, transparent 70%); opacity: 0.55; }
.piece-main { position: absolute; left: 12%; bottom: 0; width: 100px; height: 122px; object-fit: contain; transform: rotate(-7deg); }
.piece-opponent { position: absolute; right: 10%; bottom: 3px; width: 68px; height: 86px; object-fit: contain; transform: rotate(8deg); }
.piece-partner { position: absolute; left: 36%; bottom: 5px; width: 78px; height: 100px; object-fit: contain; transform: rotate(4deg); }
.piece-scene--pair .piece-main { left: 2%; width: 88px; }
.piece-scene--pair .piece-opponent { right: 0; width: 60px; }
.game-card--queen { --scene-color: #ecd28d; background: #fff6e4ef; }
.game-card--two-rooks { --scene-color: #a9ced5; background: #f3f9f0ef; }
.game-card--puzzle { --scene-color: #c4b6df; background: #f7f0ffef; }
.game-card--puzzle .piece-main { width: 120px; left: 4%; }
.game-card--puzzle .piece-opponent { width: 85px; }
.puzzle-sparkle { position: absolute; top: 12px; right: 24%; color: #a58a46; font-size: 23px; }
.game-card--sweets { grid-row: span 2; padding: 26px; background: linear-gradient(155deg, #fff3cc, #f5e6b6 65%, #e1dfa6); }
.game-card--sweets .category { color: #947130; }
.game-card--sweets .card-copy { margin-top: auto; padding: 0; }
.game-card--sweets h2 { font-size: 2rem; }
.game-card--sweets .card-copy p { font-size: 0.98rem; color: #7c6945; }
.sweet-scene { position: relative; height: 260px; margin: 20px -12px 15px; }
.mini-board { position: absolute; width: 220px; height: 190px; left: 50%; top: 55px; transform: translateX(-50%) rotate(-12deg); border: 7px solid #a0ad73; border-radius: 20px; background: repeating-conic-gradient(#f5eccb 0% 25%, #afc587 0% 50%) 50% / 80px 80px; box-shadow: 0 12px 0 #879759, 0 22px 25px #7c6e3a30; }
.sweet-rook { position: absolute; width: 112px; height: 145px; top: 20px; left: 12%; transform: rotate(-10deg); filter: drop-shadow(0 7px 3px #443b2c25); }
.sweet-candy { position: absolute; width: 65px; height: 65px; right: 3%; top: 3px; transform: rotate(20deg); }
.sweet-donut { position: absolute; width: 52px; height: 52px; left: 4%; bottom: 9px; transform: rotate(-16deg); }
.sweet-monster { position: absolute; width: 86px; height: 95px; right: 5%; bottom: 19px; transform: rotate(10deg); }
.sparkle { position: absolute; color: #b98426; }
.sparkle-one { font-size: 28px; left: 42%; top: 0; }
.sparkle-two { font-size: 22px; right: -2%; top: 94px; }
.play-link { margin-top: 22px; display: inline-flex; align-items: center; gap: 22px; padding: 12px 18px; border-radius: 999px; border: 1px solid #ac6627; background: linear-gradient(#dc9a4c, #c9762f); color: #fffaf0; font-weight: 700; font-size: 0.9rem; box-shadow: 0 4px 8px #a4662420; }
.play-link span { font-size: 1.2rem; }
footer { margin-top: 25px; text-align: center; font-size: 0.8rem; color: var(--hero-muted); }
body[data-theme="space"] {
  --hero-ink: #fffaf0; --hero-muted: #e3e8f5;
}


@keyframes cloud-drift {
  from { transform: translateX(-320px); }
  to { transform: translateX(100vw); }
}
@media (max-width: 820px) {
  main { padding: 28px 20px 24px; }
  .games { grid-template-columns: 1fr 1fr; }
  .game-card--sweets { grid-column: span 2; grid-row: auto; min-height: 230px; }
  .sweet-scene { position: absolute; width: 260px; right: 20px; top: 0; margin: 0; height: 210px; }
  .mini-board { top: 20px; height: 155px; width: 185px; }
  .sweet-rook { width: 94px; height: 114px; top: 5px; }
  .sweet-candy { width: 48px; height: 48px; }
  .sweet-monster { width: 70px; height: 80px; }
  .sweet-donut { bottom: 0; }
  .game-card--sweets .card-copy { max-width: 50%; margin-top: 24px; }
}
@media (max-width: 520px) {
  main { padding: 24px 16px; }
  .welcome { margin-bottom: 24px; }
  .welcome p { font-size: 0.92rem; }
  .games { gap: 12px; }
  .game-card { padding: 16px; border-radius: 20px; }
  .game-card--sweets { padding: 20px; min-height: 230px; }
  .sweet-scene { width: 175px; right: 0; top: 20px; }
  .mini-board { width: 140px; height: 135px; }
  .sweet-rook { left: 7%; width: 80px; }
  .sweet-monster { right: 4%; width: 60px; }
  .sweet-candy { right: 0; width: 40px; }
  .sweet-donut { left: 0; width: 38px; }
  .game-card--sweets h2 { font-size: 1.6rem; }
  .game-card--sweets .card-copy p { font-size: 0.85rem; }
  .game-card--sweets .category { max-width: 50%; }
  .piece-scene { height: 100px; margin: 8px -8px 12px; }
  .piece-main { width: 76px; height: 100px; left: 0; }
  .piece-opponent { right: 0; width: 50px; height: 70px; }
  .piece-partner { left: 27%; width: 64px; height: 84px; }
  .piece-scene--pair .piece-main { width: 66px; left: -4%; }
  .piece-scene--pair .piece-opponent { width: 43px; right: -4%; }
  .game-card--puzzle .piece-main { width: 88px; left: -7%; }
  .game-card--puzzle .piece-opponent { width: 62px; right: -5%; }
  .puzzle-sparkle { font-size: 16px; right: 18%; }
  .category { font-size: 0.59rem; letter-spacing: 0.04em; }
  h2 { font-size: 1rem; }
  .card-copy p { font-size: 0.76rem; line-height: 1.45; }
  .card-copy { padding: 0 0 28px; }
  .card-arrow { width: 23px; height: 23px; right: 13px; bottom: 13px; font-size: 0.95rem; }
  .play-link { gap: 12px; padding: 10px 14px; font-size: 0.8rem; }
}
@media (max-width: 340px) {
  .games { grid-template-columns: 1fr; }
  .game-card--sweets { grid-column: auto; }
  .sweet-scene { opacity: 0.65; width: 140px; }
  .piece-scene { margin-inline: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .cloud { animation: none; will-change: auto; }
  .cloud-one { left: -60px; }
  .cloud-two { left: auto; right: -25px; }
  .cloud-three { left: 3%; }
  .game-card { transition: none; }
  .game-card:hover { transform: none; }
}
