:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f5ee;
  color: #21312b;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button { font: inherit; cursor: pointer; }
.shell { max-width: 1190px; margin: 0 auto; padding: 30px 36px 24px; }
.topline { display: flex; justify-content: space-between; align-items: center; padding-bottom: 22px; border-bottom: 1px solid #d6d9d0; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.language-switch { display: flex; gap: 3px; padding: 3px; border: 1px solid #d6d9d0; border-radius: 5px; }
.language-switch button { border: 0; border-radius: 3px; background: transparent; color: #718076; padding: 6px 9px; font-size: 12px; font-weight: 800; }
.language-switch button[aria-pressed="true"] { background: #415d4d; color: #fff; }
.language-switch button:focus-visible { outline: 2px solid #d9704c; outline-offset: 2px; }
.brand { font-weight: 900; font-size: 22px; letter-spacing: -.06em; }
.brand-mark { color: #d66d45; font-size: 19px; vertical-align: 2px; margin-right: 7px; }
.brand-tail { font-size: 11px; letter-spacing: .22em; margin-left: 4px; color: #7f8e7b; }
.mode, .eyebrow, .section-number, footer, .rule-note span { font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.mode { color: #78877c; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; padding: 48px 0 43px; }
.eyebrow { color: #ce6d4b; margin: 0 0 19px; }
h1 { margin: 0; font-size: clamp(43px, 6vw, 76px); letter-spacing: -.075em; line-height: 1.05; font-weight: 850; }
h1 em { color: #d46d49; font-style: normal; }
.intro { max-width: 430px; margin: 22px 0 0; color: #708077; font-size: 15px; line-height: 1.75; }
.hero-index { color: #b5bfb1; font-size: 42px; font-weight: 900; letter-spacing: -.07em; white-space: nowrap; }
.hero-index span { color: #d8ddd4; padding: 0 7px; }
.game-layout { display: grid; grid-template-columns: minmax(0, 710px) minmax(260px, 1fr); gap: 24px; align-items: start; }
.game-panel, .side-panel { background: #fffefa; border: 1px solid #e4e6db; box-shadow: 0 16px 45px #2b423510; }
.game-panel { padding: 24px; }
.game-toolbar { display: flex; gap: 12px; align-items: stretch; margin-bottom: 18px; }
.score-card { background: #edf1e9; border-radius: 4px; min-width: 110px; padding: 10px 17px; flex: 1; }
.score-card span { display: block; color: #7a8c7e; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.score-card strong { display: block; font-size: 27px; line-height: 1.25; letter-spacing: -.06em; }
.new-button { background: #d9704c; color: white; border: 0; border-radius: 4px; padding: 0 18px; font-size: 13px; font-weight: 800; min-width: 126px; }
.new-button span { margin-left: 8px; }
.new-button:hover, #try-again:hover { background: #c65f3d; }
.board-frame { position: relative; background: #aab8a4; padding: 12px; border-radius: 7px; }
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; aspect-ratio: 1; touch-action: none; }
.cell { display: flex; justify-content: center; align-items: center; min-width: 0; border-radius: 5px; background: #d2dcd0; font-size: clamp(24px, 5vw, 51px); font-weight: 850; letter-spacing: -.065em; color: #33483c; transition: background .1s ease; }
.tile-2 { background: #f5f3e8; }
.tile-4 { background: #eee8d0; }
.tile-8 { background: #efc588; color: #493c31; }
.tile-16 { background: #eda779; color: #fffaf1; }
.tile-32 { background: #ed8b67; color: #fffaf1; }
.tile-64 { background: #e77259; color: #fffaf1; }
.tile-128 { background: #e8cf83; font-size: clamp(23px, 4vw, 42px); }
.tile-256 { background: #dfbd6d; font-size: clamp(23px, 4vw, 42px); }
.tile-512 { background: #d6aa53; font-size: clamp(23px, 4vw, 42px); }
.tile-1024 { background: #cc8a51; color: white; font-size: clamp(20px, 3.5vw, 36px); }
.tile-2048 { background: #415d4d; color: white; font-size: clamp(20px, 3.5vw, 36px); }
.tile-super { background: #2a4538; color: white; font-size: clamp(18px, 3vw, 32px); }
.status { min-height: 21px; margin: 17px 2px 0; color: #73837a; font-size: 13px; }
.game-over { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; background: #f8f4e9df; text-align: center; }
.game-over[hidden] { display: none; }
.game-over span { color: #cf6f4e; letter-spacing: .22em; font-size: 12px; font-weight: 900; }
.game-over strong { font-size: 38px; letter-spacing: -.06em; }
#try-again { margin-top: 12px; border: 0; border-radius: 4px; padding: 11px 20px; background: #d9704c; color: #fff; font-size: 13px; font-weight: 800; }
.side-panel { min-height: 610px; padding: 29px 28px; }
.side-section + .side-section { border-top: 1px solid #e5e9de; margin-top: 26px; padding-top: 26px; }
.section-number { color: #d6714d; }
h2 { margin: 12px 0 8px; font-size: 23px; letter-spacing: -.05em; }
.side-section p, .rule-note p { margin: 0; font-size: 13px; line-height: 1.75; color: #718076; }
.side-section p strong { color: #d16d49; }
.keypad { margin-top: 22px; text-align: center; }
.keypad > div { display: flex; justify-content: center; gap: 7px; margin-top: 7px; }
.keypad button { width: 46px; height: 43px; border: 1px solid #d7e0d3; border-radius: 4px; background: #f2f5ef; color: #56705d; font-size: 21px; }
.keypad button:hover:not(:disabled) { background: #dfeade; }
.keypad button:disabled { opacity: .45; cursor: default; }
.ai-section button { display: flex; justify-content: space-between; width: 100%; margin-top: 14px; padding: 12px 15px; border: 1px solid #cfdbcc; border-radius: 4px; background: #edf3e9; color: #47624f; font-size: 13px; font-weight: 800; }
.ai-section button + button { margin-top: 8px; }
.ai-section button:hover:not(:disabled) { background: #dcead8; }
.ai-section button:disabled { opacity: .48; cursor: default; }
.rule-note { margin-top: 27px; padding-top: 20px; border-top: 1px solid #e5e9de; }
.rule-note span { color: #7c8e7d; }
.rule-note p { margin-top: 7px; }
footer { display: flex; justify-content: space-between; padding-top: 24px; color: #8a998c; }
@media (max-width: 820px) {
  .game-layout { grid-template-columns: 1fr; }
  .side-panel { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .side-section + .side-section { border: 0; margin: 0; padding: 0; }
  .rule-note { grid-column: 1 / -1; margin-top: 0; }
}
@media (max-width: 560px) {
  .shell { padding: 18px 14px 24px; }
  .topline { padding-bottom: 17px; }
  .mode { display: none; }
  .header-actions { gap: 0; }
  .hero { padding: 36px 0 28px; }
  .hero-index { display: none; }
  .game-panel { padding: 12px; }
  .game-toolbar { gap: 6px; }
  .score-card { min-width: 0; padding: 9px 11px; }
  .score-card strong { font-size: 20px; }
  .new-button { min-width: 95px; padding: 0 6px; font-size: 12px; }
  .board-frame { padding: 7px; }
  .board { gap: 7px; }
  .side-panel { display: block; padding: 25px; }
  .side-section + .side-section { border-top: 1px solid #e5e9de; margin-top: 26px; padding-top: 26px; }
  .rule-note { margin-top: 27px; }
  footer span { display: none; }
}
