.game-card[data-launch-mode='drift'] { background: linear-gradient(135deg,#ffe3c4,#d9d5ff); }
.game-card[data-launch-mode='drift'] .card-symbol { color: #e0864f; text-shadow: -26px 22px 0 #7c88e0,22px 27px 0 #4fb8a6; }
#drift-panel { position: fixed; inset: 0; z-index: 100; overflow: auto; padding: 24px 28px 90px; box-sizing: border-box; background: var(--ui-surface); background-color: var(--ui-paper); color: var(--ui-text); font: 14px/1.5 'Segoe UI',sans-serif; }
#drift-panel[hidden], #drift-panel [hidden] { display: none !important; }
.drift-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 860px; margin: 0 auto 22px; }
.drift-header h1 { margin: 2px 0; font: italic 900 clamp(30px,4vw,42px)/1.1 'Arial Black','Segoe UI',sans-serif; letter-spacing: -1.5px; }
.drift-header .ui-kicker { margin: 0; }
#drift-panel button { min-height: 44px; padding: 10px 16px; border: 1px solid var(--ui-border); border-radius: 4px 4px 14px 4px; background: var(--ui-card); color: var(--ui-text); font: 700 13px/1.4 'Segoe UI',sans-serif; cursor: pointer; }
#drift-panel button:hover { border-color: var(--ui-accent); }
#drift-panel :is(button,summary):focus-visible { outline: 3px solid var(--ui-accent); outline-offset: 3px; }
.drift-layout { display: grid; grid-template-columns: minmax(0,480px) minmax(200px,280px); gap: 28px; max-width: 800px; margin: auto; align-items: start; }
.drift-play { min-width: 0; }
.drift-board-wrap { position: relative; padding: 10px; border-radius: 8px 8px 28px 8px; background: #163b56; border: 1px solid var(--ui-border); box-shadow: 0 16px 40px #073d6720; }
#drift-board { position: relative; width: 100%; aspect-ratio: 1; direction: ltr; container-type: inline-size; touch-action: none; user-select: none; border-radius: 5px; outline: none; }
#drift-board:focus-visible { box-shadow: 0 0 0 3px var(--ui-accent); }
.drift-grid { position: absolute; inset: 0; display: grid; grid-template: repeat(4,1fr) / repeat(4,1fr); }
.drift-grid span { margin: 5px; border-radius: 8px 8px 16px 8px; background: #ffffff0f; }
.drift-tile { position: absolute; width: 25%; height: 25%; display: grid; place-items: center; isolation: isolate; color: #24435e; font: 900 10cqw/1 'Arial Black','Segoe UI',sans-serif; letter-spacing: -.04em; font-variant-numeric: tabular-nums; --tile: #eef6ff; }
.drift-tile::before { content: ''; position: absolute; inset: 5px; z-index: -1; border-radius: 8px 8px 16px 8px; background: linear-gradient(160deg,#ffffff55,transparent 55%),var(--tile); box-shadow: inset 0 -4px 0 #0b25401f,0 3px 0 #06182b55; }
.drift-tile[data-digits='3'] { font-size: 8.4cqw; }
.drift-tile[data-digits='4'] { font-size: 6.8cqw; }
.drift-tile[data-digits='5'], .drift-tile[data-digits='6'] { font-size: 5.2cqw; }
.drift-tile[data-tier='2'] { --tile: #d7ecff; }
.drift-tile[data-tier='3'] { --tile: #b4e6dc; }
.drift-tile[data-tier='4'] { --tile: #84d6c6; }
.drift-tile[data-tier='5'] { --tile: #5fc0ec; color: #fff; }
.drift-tile[data-tier='6'] { --tile: #6f9cf2; color: #fff; }
.drift-tile[data-tier='7'] { --tile: #9b86f5; color: #fff; }
.drift-tile[data-tier='8'] { --tile: #c47be8; color: #fff; }
.drift-tile[data-tier='9'] { --tile: #ee7bae; color: #fff; }
.drift-tile[data-tier='10'] { --tile: #ff9470; color: #fff; }
.drift-tile[data-tier='11'] { --tile: #ffc44f; color: #4d2e05; }
.drift-tile[data-tier='11']::before { box-shadow: inset 0 -4px 0 #a5640c33,0 0 18px #ffd36bb3; }
.drift-tile[data-tier='12'] { --tile: #1d2f50; color: #ffd36b; }
.drift-tile[data-tier='12']::before { outline: 2px solid #ffd36b; outline-offset: -4px; }
#drift-status { min-height: 42px; margin: 12px 4px 0; color: var(--ui-muted); font-size: 13px; }
.drift-sidebar { display: grid; gap: 16px; }
.drift-score-card, .drift-help { padding: 22px; border: 1px solid var(--ui-border); border-radius: 4px 4px 20px 4px; background: var(--ui-card); }
.drift-score-card > span { display: block; color: var(--ui-muted); font-weight: 700; font-size: 12px; }
#drift-score { display: block; font-size: clamp(32px,5vw,46px); line-height: 1.2; letter-spacing: -1px; font-weight: 900; font-variant-numeric: tabular-nums; margin: 8px 0 14px; }
.drift-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 16px; border-top: 1px solid var(--ui-border); }
.drift-metrics span { display: block; color: var(--ui-muted); font-size: 12px; }
.drift-metrics strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.drift-help summary { cursor: pointer; font-weight: 800; }
.drift-help p { color: var(--ui-muted); font-size: 13px; }
#drift-saved { color: var(--ui-muted); font-size: 11px; margin: 0 4px; }
#drift-result { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; border-radius: inherit; background: #102b49e8; color: white; backdrop-filter: blur(6px); }
#drift-result-title { font: italic 900 clamp(26px,5vw,40px)/1.1 'Arial Black','Segoe UI',sans-serif; margin: 12px 0; }
#drift-result-score { max-width: 28ch; color: #c0deef; }
.drift-result-art { font-size: 52px; color: #ffc44f; text-shadow: -32px 12px 0 #9b86f5,32px 12px 0 #5fc0ec; }
.drift-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
#drift-panel #drift-continue { background: #def7ff; color: #143853; min-width: 160px; }
#drift-confirm { max-width: min(420px,calc(100vw - 40px)); box-sizing: border-box; padding: 26px; margin: auto; border: 1px solid var(--ui-border); border-radius: 4px 4px 22px 4px; background: var(--ui-paper); color: var(--ui-text); }
#drift-confirm::backdrop { background: #102c5280; backdrop-filter: blur(8px); }
#drift-confirm h2 { margin: 0 0 12px; }
.drift-confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
body[data-game-mode='drift'] #hub-launch { bottom: 18px; right: auto; left: 24px; width: 166px; height: 44px; padding: 10px 12px; z-index: 150; }
body[data-game-mode='drift'] #hub-launch small { display: none; }
body[data-game-mode='drift'] #hub-launch strong { font-size: 15px; }
body[data-game-mode='drift'] #hub-launch b { top: 9px; right: 10px; font-size: 18px; }
body[data-game-mode='drift'] #mode-menu { bottom: 18px; right: 24px; width: 140px; z-index: 150; }
#drift-panel::after { content: ''; position: fixed; inset: auto 0 0; height: 76px; background: var(--ui-paper); border-top: 1px solid var(--ui-border); pointer-events: none; }
@media (max-width: 700px) {
  #drift-panel { padding: 18px 14px 84px; }
  .drift-header { margin-bottom: 16px; }
  .drift-layout { grid-template-columns: 1fr; gap: 12px; max-width: 480px; }
  .drift-sidebar { display: contents; }
  .drift-score-card { grid-row: 1; display: grid; grid-template-columns: 1fr 1.4fr; column-gap: 18px; align-items: center; padding: 14px 18px; }
  #drift-score { font-size: 30px; margin: 0; grid-column: 1; }
  .drift-metrics { grid-column: 2; grid-row: 1 / 3; border: 0; padding: 0; }
  .drift-metrics strong { font-size: 22px; }
  .drift-board-wrap { padding: 6px; }
  .drift-grid span { margin: 3px; }
  .drift-tile::before { inset: 3px; }
  .drift-help { padding: 16px 18px; }
  body[data-game-mode='drift'] #hub-launch { left: 14px; bottom: 14px; width: 160px; }
  body[data-game-mode='drift'] #mode-menu { right: 14px; bottom: 14px; width: 120px; }
}
@media (max-height: 520px) and (min-width: 620px) {
  #drift-panel { padding: 12px 20px 82px; }
  .drift-header { margin-bottom: 8px; }
  .drift-header h1 { font-size: 26px; }
  .drift-header .ui-kicker { display: none; }
  #drift-panel .drift-header button { min-height: 32px; padding: 6px 12px; }
  .drift-layout { grid-template-columns: minmax(170px,min(360px,calc(100dvh - 150px))) minmax(180px,250px); gap: 18px; max-width: 628px; justify-content: center; }
  .drift-sidebar { display: grid; }
  .drift-score-card { display: block; padding: 16px; }
  .drift-metrics { padding-top: 12px; border-top: 1px solid var(--ui-border); }
  .drift-help { padding: 14px; }
  #drift-status { min-height: 0; margin-top: 6px; }
}
