/* Touch-first game selection. Local assets only. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  color-scheme: dark;
  --bg: #102426;
  --surface: #203638;
  --border: #365052;
  --text: #f6f3e9;
  --muted: #aec1bd;
  --gold: #ebc888;
  --gold-dim: #ebc88850;
  --radius: 20px;
}
html { min-height: 100%; scrollbar-color: #58716c var(--bg); }
body {
  min-width: 320px;
  background: radial-gradient(ellipse at 75% 0%, #284541 0, transparent 55%), var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button, a { touch-action: manipulation; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 5px; }
.app { max-width: 2040px; margin: auto; padding: 0 48px 40px; }
.header { display: flex; align-items: center; gap: 14px; min-height: 90px; border-bottom: 1px solid #ffffff14; }
.logo-wrap { width: 46px; height: 46px; flex-shrink: 0; }
.logo-inner, .logo-inner img { width: 100%; height: 100%; object-fit: contain; }
.header-titles { flex: 1; min-width: 0; }
.header-title { font-size: 19px; letter-spacing: .02em; font-weight: 750; }
.header-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.marketplace-link { display: flex; gap: 9px; align-items: center; min-height: 48px; padding: 0 18px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); text-decoration: none; font-size: 14px; }
.marketplace-link:hover { color: var(--text); background: var(--surface); }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 30px 0 24px; }
.eyebrow { color: var(--gold); font-size: 11px; letter-spacing: .18em; font-weight: 750; margin-bottom: 7px; }
.intro h2 { font-size: clamp(28px, 2.6vw, 44px); font-weight: 750; letter-spacing: -.035em; line-height: 1.15; }
.intro-note { color: var(--muted); font-size: 14px; margin-bottom: 5px; }
.toolbar { position: relative; z-index: 10; display: flex; flex-direction: column; gap: 16px; padding-bottom: 23px; }
.toolbar-row { display: flex; align-items: center; gap: 24px; min-width: 0; }
.toolbar-divider, .pcounter-seats { display: none; }
.search-wrap { position: relative; display: flex; flex: 1; min-width: 0; gap: 8px; }
.search-field, .search-clear { min-height: 52px; color: var(--text); background: #ffffff07; border: 1px solid var(--border); border-radius: 12px; }
.search-field { display: flex; align-items: center; flex: 1; gap: 12px; padding: 0 18px; text-align: left; min-width: 0; }
.search-field i { color: var(--muted); }
.search-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-value.is-empty { color: var(--muted); }
.search-clear { width: 52px; flex-shrink: 0; }
.search-clear:disabled { display: none; }
.pcounter { display: flex; align-items: center; gap: 8px; }
.pcounter-hint { order: -1; color: var(--muted); font-size: 14px; margin-right: 8px; min-width: 82px; }
.pcounter-btn { min-width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--border); background: #ffffff07; color: var(--text); font-size: 23px; }
.pcounter-val { width: 30px; font-size: 21px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
#pall { min-width: 62px; font-size: 14px; margin-left: 5px; }
.pcounter-btn.active { color: var(--bg); background: var(--gold); border-color: var(--gold); font-weight: 750; }
.chips { display: flex; flex: 1; min-width: 0; gap: 8px; overflow-x: auto; padding: 3px 3px 8px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.chip { min-height: 46px; padding: 0 17px; flex-shrink: 0; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip i { margin-right: 8px; opacity: .8; }
.chip:hover { background: #ffffff08; }
.chip.active { color: var(--text); background: #334d49; border-color: #5d7770; }
.count-wrap { color: var(--muted); font-size: 13px; flex-shrink: 0; white-space: nowrap; }
.count-num { color: var(--text); font-weight: 700; }
.update-hint { display: block; color: var(--gold); font-size: 12px; }
.update-hint:empty { display: none; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; align-content: start; }
.game-card { position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: #1c3234; border: 1px solid #3b5452; border-radius: var(--radius); cursor: pointer; transition: border-color .18s, transform .18s; }
.game-card:hover { border-color: #829d8e; transform: translateY(-3px); }
.game-card:active { transform: scale(.99); }
.card-preview { position: relative; aspect-ratio: 2.2; overflow: hidden; background: radial-gradient(ellipse at center, #36574f, #152629); border-bottom: 1px solid #ffffff0c; }
.card-preview img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.preview-fallback { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; color: #c5d5c8; font-size: 13px; }
.preview-fallback i { font-size: 46px; }
.card-preview-label { position: absolute; z-index: 2; top: 14px; left: 14px; padding: 6px 10px; border: 1px solid #ffffff28; border-radius: 7px; background: #102426e8; color: #f6f3e9; font-size: 11px; font-weight: 650; }
.card-body { display: flex; flex-direction: column; flex: 1; gap: 11px; padding: 22px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-name { font-size: clamp(21px, 1.5vw, 28px); font-weight: 750; letter-spacing: -.025em; line-height: 1.15; overflow-wrap: anywhere; }
.card-info { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #ffffff20; border-radius: 50%; color: var(--muted); background: transparent; font-size: 16px; }
.card-desc { font-size: 15px; color: #c4d1cc; line-height: 1.5; min-height: 45px; }
.card-footer { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-top: auto; padding-top: 7px; }
.card-meta { color: #dee5dc; font-size: 14px; white-space: nowrap; }
.card-meta i { margin-right: 5px; color: #a0b7aa; }
.card-actions { display: grid; gap: 8px; min-width: 44%; position: relative; z-index: 6; }
.card-play { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 50px; padding: 10px 18px; border-radius: 12px; color: #182b28; background: var(--gold); text-decoration: none; font-size: 15px; font-weight: 750; transition: background .15s; }
.card-play:hover { background: #f7dba9; }
.card-play.is-disabled { pointer-events: none; opacity: .4; }
.card-update-status { display: none; color: var(--gold); font-size: 12px; }
.card-update-status.is-visible { display: block; }
.game-card.is-locked { opacity: .6; cursor: wait; }
.update-btn { min-height: 44px; padding: 8px 12px; color: var(--text); background: #ffffff0c; border: 1px solid var(--border); border-radius: 10px; }
.update-btn.is-danger { color: #ffb4aa; }
.empty { grid-column: 1 / -1; padding: 70px 20px; text-align: center; color: var(--muted); }
.empty .e-icon { font-size: 44px; margin-bottom: 16px; }
.empty button { margin-top: 20px; padding: 14px 20px; background: var(--gold); color: var(--bg); border: 0; border-radius: 12px; }
.empty > .card-play { display: inline-flex; margin-top: 24px; }
.touch-keyboard { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 8px); min-width: min(520px, calc(100vw - 40px)); padding: 14px; background: #1c3234; border: 1px solid #70877c; border-radius: 16px; box-shadow: 0 20px 60px #0008; }
.keyboard-row { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.keyboard-row:last-child { margin-bottom: 0; }
.keyboard-key { min-height: 48px; border: 1px solid var(--border); border-radius: 8px; background: #ffffff0c; color: var(--text); font-size: 17px; }
.keyboard-key:active { background: var(--gold); color: var(--bg); }
.keyboard-key--wide { grid-column: span 2; }
.overlay, .surface-blocker { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: #061616dc; backdrop-filter: blur(10px); }
.detail { position: relative; width: min(680px, 100%); max-height: 90vh; overflow-y: auto; padding: 28px; border: 1px solid #627b6f; border-radius: 24px; background: #1c3234; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 30px 100px #0007; }
.detail-preview { aspect-ratio: 2.2; border-radius: 14px; flex-shrink: 0; }
.detail-close { position: absolute; right: 40px; top: 40px; z-index: 3; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid #ffffff55; border-radius: 50%; background: #102426ed; color: var(--text); font-size: 20px; }
.detail-title { font-size: 32px; letter-spacing: -.025em; }
.detail-desc { color: #c4d1cc; font-size: 17px; line-height: 1.6; }
.detail-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); }
.card-tag { padding: 7px 11px; background: #ffffff09; border-radius: 8px; color: var(--muted); font-size: 13px; }
.detail-play { display: block; padding: 17px; border-radius: 12px; background: var(--gold); color: var(--bg); font-size: 18px; font-weight: 750; text-align: center; text-decoration: none; }
.surface-blocker { z-index: 500; }
.surface-blocker__box { width: min(440px, 100%); padding: 30px; border: 1px solid var(--border); border-radius: 20px; background: var(--bg); text-align: center; }
.surface-blocker__title { color: var(--gold); font-size: 22px; margin-bottom: 12px; }
.surface-blocker__text { color: var(--muted); margin-bottom: 18px; }
body.has-dialog { overflow: hidden; }
@media (min-width: 2200px) { .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1200px) {
  .app { padding: 0 26px 30px; }
  .game-grid { gap: 18px; }
  .card-body { padding: 17px; }
  .card-footer { flex-wrap: wrap; }
  .card-actions { flex: 1; }
  .toolbar-row { gap: 16px; }
  .pcounter-hint { display: none; }
  .intro-note { display: none; }
}
@media (max-height: 700px) and (min-width: 900px) {
  .header { min-height: 68px; }
  .intro { padding: 18px 0; }
  .intro h2 { font-size: 30px; }
  .eyebrow { display: none; }
  .toolbar { gap: 8px; padding-bottom: 14px; }
  .card-preview { aspect-ratio: 2.7; }
}
@media (max-width: 900px) { .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .count-wrap { display: none; } }
@media (max-width: 600px) {
  .app { padding: 0 18px 24px; }
  .header { min-height: 76px; }
  .header-title { font-size: 16px; }
  .marketplace-link { padding: 0 12px; font-size: 12px; }
  .header-sub { display: none; }
  .intro { padding: 24px 0 20px; }
  .toolbar-row:first-child { flex-wrap: wrap; }
  .search-wrap { flex-basis: 100%; }
  .pcounter-hint { display: block; }
  .game-grid { grid-template-columns: 1fr; }
  .card-preview { aspect-ratio: 2; }
  .detail { padding: 18px; }
  .detail-close { right: 28px; top: 28px; }
  .keyboard-key { font-size: 14px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
