:root {
  --four-ink: #f2f3ed;
  --four-muted: #a3adbf;
  --four-lime: #d8f879;
  --four-red: #ff7184;
  --four-yellow: #ffd36c;
}
body[data-page="four"] {
  min-height: 100vh;
  margin: 0;
  color: var(--four-ink);
  background:
    radial-gradient(720px 520px at 82% 10%, rgba(95, 83, 164, .18), transparent 68%),
    radial-gradient(600px 500px at 8% 55%, rgba(55, 107, 118, .13), transparent 70%),
    linear-gradient(180deg, #111624 0%, #0a0e17 68%, #090c13 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.four-shell { width: min(1050px, 100%); margin: 0 auto; padding: 0 30px; }
.four-header { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(211,223,243,.1); }
.four-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--four-ink); font-size: 16px; font-weight: 780; letter-spacing: -.06em; text-decoration: none; }
.brand-mark { position: relative; display: grid; width: 32px; height: 32px; place-items: center; overflow: hidden; border: 1px solid rgba(216,248,121,.58); border-radius: 10px; color: var(--four-lime); background: rgba(216,248,121,.09); font-size: 15px; font-weight: 850; }
.brand-mark i { position: absolute; width: 7px; height: 7px; right: 5px; bottom: 5px; border-radius: 2px; background: var(--four-lime); transform: rotate(45deg); }
.brand-period { color: var(--four-lime); }
.back-link { color: #abb5c6; text-decoration: none; font-size: 12px; transition: color .18s ease; }
.back-link:hover { color: var(--four-lime); }
.back-link span { margin-right: 7px; color: var(--four-lime); }
.four-main { padding: 48px 0 58px; }
.four-intro { margin: 0 0 26px; }
.four-eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 11px; color: #bdc8d9; font-size: 9px; font-weight: 760; letter-spacing: .18em; }
.four-eyebrow span { width: 6px; height: 6px; border-radius: 50%; background: var(--four-lime); box-shadow: 0 0 12px rgba(216,248,121,.7); }
.four-intro h1 { margin: 0; font-size: clamp(46px, 6vw, 68px); line-height: .98; letter-spacing: -.075em; }
.four-intro h1 span { color: var(--four-lime); }
.four-intro > p:last-child { margin: 11px 0 0; color: var(--four-muted); font-size: 13px; line-height: 1.6; }
.four-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 17px; }
.board-wrap, .game-panel { border: 1px solid rgba(211,223,243,.13); border-radius: 21px; background: linear-gradient(155deg, rgba(25,33,51,.91), rgba(14,19,30,.96)); box-shadow: 0 24px 70px rgba(0,0,0,.23); }
.board-wrap { min-width: 0; padding: 18px; }
.board-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 1px 14px; }
.board-label, .panel-label { color: #8f9bb0; font-size: 9px; font-weight: 760; letter-spacing: .15em; }
.keyboard-hint { color: #808da2; font-size: 10px; }
kbd { display: inline-grid; min-width: 17px; height: 18px; place-items: center; margin-left: 2px; border: 1px solid rgba(211,223,243,.16); border-radius: 5px; color: #bac5d7; background: rgba(255,255,255,.04); font: inherit; font-size: 9px; }
.connect-board { display: grid; width: min(100%, 540px); margin-inline: auto; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(4px, 1vw, 9px); padding: clamp(8px, 1.5vw, 14px); border: 1px solid rgba(171,187,246,.22); border-radius: 17px; background: linear-gradient(145deg, #343d78, #252c5b 70%, #20264d); box-shadow: inset 0 8px 20px rgba(9,12,31,.25), 0 20px 40px rgba(0,0,0,.24); }
.column-button { position: relative; display: grid; grid-template-rows: repeat(6, 1fr); gap: clamp(4px, .9vw, 8px); min-width: 0; padding: 0; border: 0; border-radius: 10px; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.column-button::before { position: absolute; z-index: 1; top: -8px; right: 2px; left: 2px; height: 5px; border-radius: 8px; background: transparent; content: ""; transition: background .15s ease, box-shadow .15s ease; }
.column-button:hover::before, .column-button:focus-visible::before { background: var(--four-lime); box-shadow: 0 0 12px rgba(216,248,121,.65); }
.column-button:focus-visible { outline: 2px solid var(--four-lime); outline-offset: 4px; }
.column-button:disabled { cursor: default; }
.disc { position: relative; display: block; width: 100%; aspect-ratio: 1; border: 2px solid rgba(11,15,39,.37); border-radius: 50%; background: radial-gradient(circle at 35% 28%, #171b3b, #10142f 75%); box-shadow: inset 0 3px 8px rgba(0,0,0,.48), 0 1px 0 rgba(255,255,255,.08); transition: background .2s ease, transform .2s ease, box-shadow .2s ease; }
.disc.red { border-color: rgba(255,216,222,.24); background: radial-gradient(circle at 34% 28%, #ffabb5, #ff7184 49%, #c9435a); box-shadow: inset 0 3px 7px rgba(255,255,255,.28), 0 4px 11px rgba(222,65,91,.23); animation: drop-in .2s ease-out; }
.disc.yellow { border-color: rgba(255,246,206,.33); background: radial-gradient(circle at 34% 28%, #fff0a5, #ffd36c 53%, #d69a37); box-shadow: inset 0 3px 7px rgba(255,255,255,.32), 0 4px 11px rgba(230,174,65,.2); animation: drop-in .2s ease-out; }
.disc.last-move { outline: 2px solid rgba(255,255,255,.82); outline-offset: -4px; }
.disc.winning { animation: winner-pulse .72s ease-in-out infinite alternate; outline: 3px solid #fff5b9; outline-offset: -5px; }
@keyframes drop-in { from { transform: translateY(-8px) scale(.82); } to { transform: translateY(0) scale(1); } }
@keyframes winner-pulse { to { filter: brightness(1.3); transform: scale(.93); } }
.board-legend { display: flex; justify-content: center; gap: 20px; padding: 13px 0 0; color: #9aa6ba; font-size: 10px; }
.board-legend span { display: flex; align-items: center; gap: 7px; }
.board-legend i, .score-token { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.red-dot, .score-red { background: var(--four-red); box-shadow: 0 0 9px rgba(255,113,132,.32); }
.yellow-dot, .score-yellow { background: var(--four-yellow); box-shadow: 0 0 9px rgba(255,211,108,.3); }
.game-panel { display: flex; flex-direction: column; gap: 12px; padding: 15px; }
.turn-card, .score-card { padding: 13px; border: 1px solid rgba(211,223,243,.09); border-radius: 14px; background: rgba(5,9,16,.25); }
.turn-content { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
.turn-token { width: 15px; height: 15px; border-radius: 50%; background: var(--four-red); box-shadow: 0 3px 12px rgba(255,113,132,.35); }
.turn-token.yellow { background: var(--four-yellow); box-shadow: 0 3px 12px rgba(255,211,108,.35); }
.turn-content strong { font-size: 16px; letter-spacing: -.03em; }
.turn-card p { min-height: 29px; margin: 8px 0 0; color: var(--four-muted); font-size: 10px; line-height: 1.5; }
.score-card { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.score-card > div { display: grid; grid-template-columns: 10px 1fr; align-items: center; gap: 5px 7px; min-width: 0; }
.score-card > div strong { grid-column: 2; color: var(--four-ink); font-size: 17px; }
.score-card > div > span:nth-child(2) { overflow: hidden; color: #a9b4c6; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.score-divider { color: #68748a; }
.mode-controls { display: grid; gap: 7px; }
.mode-controls label { margin-top: 3px; color: #9da9bc; font-size: 10px; font-weight: 700; }
.mode-controls select { width: 100%; height: 39px; padding: 0 10px; border: 1px solid rgba(211,223,243,.14); border-radius: 10px; outline: 0; color: var(--four-ink); background: #151c2a; font: inherit; font-size: 11px; }
.mode-controls select:focus-visible { border-color: rgba(216,248,121,.63); box-shadow: 0 0 0 3px rgba(216,248,121,.1); }
.mode-controls select option { color: var(--four-ink); background: #151c2a; }
.round-info { display: flex; align-items: center; justify-content: space-between; padding: 3px 1px; color: #929db0; font-size: 10px; }
.round-info strong { color: #d2dae6; font-size: 10px; }
.new-game { display: flex; min-height: 42px; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 11px; color: #151b12; background: var(--four-lime); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; transition: background .18s ease, transform .18s ease; }
.new-game:hover { transform: translateY(-1px); background: #e4ff9a; }
.new-game span { font-size: 17px; }
.reset-score { padding: 3px; border: 0; color: #9ca8ba; background: transparent; font: inherit; font-size: 10px; cursor: pointer; }
.reset-score:hover { color: var(--four-red); }
.rules { padding-top: 10px; border-top: 1px solid rgba(211,223,243,.1); color: #a4afc0; }
.rules summary { color: #d1d8e4; font-size: 10px; font-weight: 700; cursor: pointer; }
.rules p { margin: 9px 0 0; font-size: 10px; line-height: 1.6; }
.four-footer { display: flex; align-items: center; gap: 20px; min-height: 68px; border-top: 1px solid rgba(211,223,243,.1); color: #7e899c; font-size: 10px; }
.four-footer > span:first-child { color: #c5ccda; font-weight: 750; }
.four-footer > a { margin-left: auto; color: #c8d1df; text-decoration: none; }
.four-footer > a:hover { color: var(--four-lime); }
.four-footer b { margin-left: 5px; color: var(--four-lime); }
@media (max-width: 760px) {
  .four-shell { padding-inline: 20px; }
  .four-layout { grid-template-columns: minmax(0, 1fr) 255px; gap: 12px; }
  .board-wrap { padding: 12px; }
  .game-panel { padding: 12px; }
}
@media (max-width: 620px) {
  .four-shell { padding-inline: 15px; }
  .four-main { padding-top: 34px; }
  .four-layout { grid-template-columns: 1fr; }
  .game-panel { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .turn-card, .score-card, .mode-controls, .round-info, .new-game, .reset-score, .rules { min-width: 0; }
  .mode-controls { grid-row: span 2; }
  .rules { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .four-shell { padding-inline: 10px; }
  .four-header { height: 66px; }
  .four-main { padding-top: 27px; }
  .four-intro { margin-bottom: 19px; }
  .board-wrap { padding: 9px; border-radius: 16px; }
  .board-topline { margin-bottom: 11px; }
  .keyboard-hint { font-size: 9px; }
  .connect-board { gap: 3px; padding: 7px; border-radius: 13px; }
  .column-button { gap: 3px; }
  .disc { border-width: 1px; }
  .game-panel { gap: 8px; padding: 9px; }
  .turn-card, .score-card { padding: 10px; }
  .turn-content strong { font-size: 13px; }
  .four-footer { gap: 8px; font-size: 9px; }
  .four-footer > span:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
