:root {
  color-scheme: dark;
  font-family: "Instrument Sans", system-ui, sans-serif;
  --bg: #141817;
  --card: #1d2421;
  --field: #222a26;
  --line: #37443c;
  --text: #f5f5eb;
  --muted: #b1beb3;
  --accent: #d9f986;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { max-width: 730px; margin: auto; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
h1, p { margin: 0; }
h1 { font-size: clamp(26px, 5.4vw, 38px); letter-spacing: -.045em; line-height: 1.06; }
p { line-height: 1.45; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.brand { display: flex; align-items: center; gap: 9px; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.brand img { border-radius: 12px; }
.brand strong { font-size: 19px; letter-spacing: -.03em; }
#queue-status { color: var(--accent); font-size: 12px; margin-left: auto; text-align: right; }
.filters { display: flex; gap: 8px; margin: 20px 0 12px; flex-wrap: wrap; }
input, select { background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 11px; min-height: 44px; font-size: 16px; }
input[type=search] { width: 100%; flex: 1 1 165px; min-width: 0; }
input::placeholder { color: var(--muted); }
#catalog-status { color: var(--muted); font-size: 13px; margin: 12px 0; }
#games { list-style: none; display: grid; gap: 7px; margin: 0; padding: 0; }
.game { display: grid; width: 100%; grid-template-columns: 70px minmax(0, 1fr) 14px; gap: 12px; align-items: center; text-align: left; padding: 9px; min-height: 84px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.game:active, #back:active { background: #304033; }
.game strong { display: block; font-weight: 650; line-height: 1.18; }
.game-thumbnail { display: grid; place-items: center; width: 70px; height: 64px; border-radius: 7px; background: #111614; overflow: hidden; }
.game-thumbnail img { width: 100%; height: 100%; object-fit: contain; }
.game-detail { display: flex; align-items: flex-start; flex-wrap: wrap; column-gap: 7px; row-gap: 4px; color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.28; }
.console-mark { display: inline-flex; align-items: center; min-height: 18px; max-width: 100%; font-weight: 650; }
.console-logo { display: block; max-width: 92px; max-height: 18px; object-fit: contain; padding: 3px 5px; background: #f3f3ed; border-radius: 3px; }
.game-region { align-self: center; min-width: 0; overflow-wrap: anywhere; }
.game .chevron { color: var(--accent); font-size: 22px; }
form { display: grid; gap: 12px; max-width: 430px; margin: 35px auto; }
form p { color: var(--muted); margin-bottom: 8px; }
.action { background: var(--accent); color: #16210c; border: 0; border-radius: 12px; padding: 11px 16px; min-height: 44px; font-weight: 750; }
.action:disabled { opacity: .55; }
.error { color: #ffadab; font-size: 13px; }
.shoot-title { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; margin-bottom: 11px; }
.shoot-game { display: flex; gap: 8px; align-items: center; }
#capture-thumbnail { flex: none; }
#capture-thumbnail .game-thumbnail { width: 42px; height: 48px; }
.shoot-title h1 { font-size: clamp(18px, 4.9vw, 27px); line-height: 1.12; }
.shoot-title p { font-size: 12px; color: var(--muted); margin-top: 4px; }
#back { display: grid; place-items: center; min-height: 44px; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 13px; }
#back svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
#shot-count { background: var(--card); color: var(--accent); font-weight: 740; font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; padding: 7px; border-radius: 8px; }
.viewfinder { background: #080a09; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; position: relative; display: grid; place-content: center; justify-items: center; min-height: 195px; height: min(58vh, calc(100svh - 275px)); padding: 18px; text-align: center; gap: 12px; }
.viewfinder video { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; }
#camera-message, #camera-retry { z-index: 1; }
.viewfinder.flash::after { content: ""; position: absolute; inset: 0; background: white; pointer-events: none; animation: flash .16s ease-out forwards; }
@keyframes flash { from { opacity: .52; } to { opacity: 0; } }
.controls { display: grid; grid-template-columns: 1fr 82px 1fr; align-items: center; justify-items: center; gap: 10px; margin-top: 12px; }
.finish { display: grid; gap: 3px; justify-self: start; font-size: 11px; color: var(--muted); }
.finish select { padding: 6px 7px; color: var(--text); }
#shutter { width: 74px; height: 74px; display: grid; place-items: center; padding: 5px; background: var(--bg); border: 2px solid var(--accent); border-radius: 50%; }
#shutter span { width: 100%; height: 100%; background: var(--accent); border-radius: 50%; }
#shutter:active span { transform: scale(.85); }
#shutter:disabled { opacity: .37; }
#last-shot { width: 50px; height: 50px; justify-self: end; border: 1px solid var(--line); background: var(--card); overflow: hidden; border-radius: 9px; }
#last-shot img { width: 100%; height: 100%; object-fit: cover; }
.transfer { text-align: center; color: var(--muted); margin-top: 9px; font-size: 12px; min-height: 18px; }
#capture-error { text-align: center; padding-top: 5px; }
#network-error { padding: 8px 0; }
body.capturing .brand { display: none; }
@media (orientation: landscape) and (max-height: 540px) {
  #capture { display: grid; grid-template-columns: minmax(0, 1fr) 92px; grid-template-rows: auto minmax(145px, 1fr) auto; gap: 6px 10px; min-height: calc(100svh - 30px); }
  .shoot-title, .transfer, #capture-error { grid-column: 1 / -1; margin: 0; }
  .viewfinder { height: auto; min-height: 145px; }
  .controls { display: flex; flex-direction: column; margin: 0; gap: 7px; }
  #shutter { width: 64px; height: 64px; }
  #last-shot { width: 38px; height: 38px; }
}
