/* The tablet game "Wissen sichern" (templates/pre_event/game.html), ported from the team's draft
   "Wissen-sichern_Spiel_Tablet.html" (2026-10-20). Roboto comes from the site's fonts.css. */
/* Tablet kiosk version of the "Wissen sichern" mini-game. Full screen, touch first, scoreboard stored on this device. */
:root {
  --bg: #0A0B09; --bg-2: #111310; --surface: #171A14; --fg: #EEF1E8; --muted: #959C8B; --line: #262A21;
  --lime: #D8FF00; --on-lime: #0A0B09;
  --f-display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  touch-action: manipulation; overscroll-behavior: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
input { user-select: text; -webkit-user-select: text; }
img { display: block; max-width: 100%; -webkit-user-drag: none; }
button { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.label { font-family: var(--f-mono); font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
h3 { font-family: var(--f-display); font-weight: 800; margin: 0; line-height: 1.05; text-wrap: balance; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; font-weight: 600; font-size: 18px; padding: 14px 30px; border: 1.5px solid var(--lime); background: var(--lime); color: var(--on-lime); cursor: pointer; font-family: var(--f-body); transition: transform .15s, background .2s, color .2s; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--fg); border-color: rgba(251,251,251,.35); }
.btn .arr { font-family: var(--f-mono); }

/* App frame */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.top-l { display: flex; align-items: center; gap: 18px; min-width: 0; }
.top-l img { height: 18px; width: auto; flex: none; }
.top-t { display: flex; flex-direction: column; min-width: 0; padding-left: 18px; border-left: 1px solid var(--line); }
.top-t b { font-family: var(--f-display); font-stretch: 72%; font-weight: 800; text-transform: uppercase; font-size: 1.35rem; line-height: 1; white-space: nowrap; }
.top-t .label { font-size: 11px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-r { display: flex; align-items: center; gap: 18px; flex: none; }
.coop { display: flex; align-items: center; gap: 10px; }
.coop img { height: 18px; width: auto; }
.fs { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; background: none; border: 1px solid var(--line); color: var(--fg); font: 600 13px var(--f-body); cursor: pointer; }
.fs svg { width: 16px; height: 16px; }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 0; }

/* Game */
.g-shell { --cM: #D8FF00; --cE: #5CE1E6; --cH: #FF9F43; --cS: #B38CFF; --lost: #6B2A22;
  position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.g-hud { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.g-hud > div { padding: 12px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.g-hud > div + div { border-left: 1px solid var(--line); }
.g-hud strong { font-family: var(--f-display); font-stretch: 70%; font-weight: 800; font-size: 2.3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.g-hud .combo strong { color: var(--lime); }
.g-time { height: 4px; background: var(--line); }
.g-time div { height: 100%; background: var(--lime); transform-origin: left; transform: scaleX(1); }
.g-log { font-family: var(--f-mono); font-size: 14px; padding: 10px 20px; border-bottom: 1px solid var(--line); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 42px; }
.g-log b { color: var(--fg); font-weight: 500; }
.g-log.bad b { color: #FF7A5C; }
.g-log.ai b { color: var(--lime); }

.g-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 260px; }
.g-wrap { min-width: 0; min-height: 0; display: grid; place-items: center; padding: 16px; }
.g-board { --ts: 52px; display: grid; grid-template-columns: repeat(10, var(--ts)); grid-auto-rows: var(--ts); gap: 6px; }
.t { position: relative; border: 0; padding: 0; background: #2E2E2E; font-family: var(--f-mono); font-size: calc(var(--ts) * .3); font-weight: 500; color: transparent; overflow: hidden; transition: background .25s, transform .15s; touch-action: none; }
.t::after { content: ""; position: absolute; left: 0; bottom: 0; height: 4px; width: calc(var(--p, 0) * 100%); background: var(--c, transparent); }
.t.gap { background: transparent; box-shadow: inset 0 0 0 2px var(--c); color: var(--c); animation: gIn .3s cubic-bezier(.2,1.5,.4,1); }
.t.gap.urgent { animation: gPulse .5s ease-in-out infinite; }
.t.done { background: color-mix(in srgb, var(--c) 34%, #2E2E2E); }
.t.done.fresh { background: var(--c); animation: gPop .45s cubic-bezier(.2,1.6,.4,1); }
.t.ai { box-shadow: inset 0 0 0 2px var(--lime); }
.t.ai::before { content: "AI"; position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--ts) * .22); color: var(--lime); letter-spacing: .05em; }
.t.lost { background: var(--lost); color: #FF9A85; }
.t.lost::before { content: "×"; position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--ts) * .4); }
.t.shake { animation: gShake .35s; }
.cM { --c: var(--cM); } .cE { --c: var(--cE); } .cH { --c: var(--cH); } .cS { --c: var(--cS); }
@keyframes gIn { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes gPop { 0% { transform: scale(.5); } 100% { transform: scale(1); } }
@keyframes gPulse { 50% { box-shadow: inset 0 0 0 4px var(--c); } }
@keyframes gShake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.g-experts { border-left: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.ex { flex: 1; max-height: 112px; min-height: 72px; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 6px 14px; align-items: center; text-align: left; padding: 12px 14px; background: var(--surface); border: 2px solid transparent; color: var(--fg); font-family: var(--f-body); cursor: pointer; transition: border-color .15s, background .15s, transform .12s; touch-action: none; }
.ex.sel { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.ex.flash { transform: scale(.96); }
.ex .key { grid-row: 1 / 3; width: 48px; height: 48px; display: grid; place-items: center; background: var(--c); color: var(--on-lime); font-family: var(--f-display); font-stretch: 75%; font-weight: 800; font-size: 1.6rem; }
.ex .nm { font-weight: 600; font-size: 16px; line-height: 1.2; }
.ex .nm span { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.ex .learn { display: flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 11px; color: var(--muted); min-width: 0; }
.ex .bar { flex: 1; height: 4px; background: var(--line); min-width: 24px; }
.ex .bar i { display: block; height: 100%; width: 0; background: var(--c); transition: width .3s; }
.ex.learned .learn { color: var(--lime); }

.g-overlay { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 28px; background: rgba(17,17,17,.9); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); overflow-y: auto; }
.g-overlay h3 { font-size: clamp(2rem, 4.4vw, 3.4rem); font-stretch: 72%; text-transform: uppercase; }
.g-overlay p { margin: 0; color: #E2E2E2; max-width: 48ch; font-size: 18px; }
.g-rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 760px; width: 100%; margin: 4px 0; }
.g-rules div { border: 1px solid var(--line); padding: 16px; text-align: left; font-size: 15.5px; color: #E2E2E2; display: flex; flex-direction: column; gap: 8px; }
.g-rules b { font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--lime); font-weight: 500; }
.g-result { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 600px; width: 100%; }
.g-result div { border: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.g-result strong { font-family: var(--f-display); font-stretch: 70%; font-weight: 800; font-size: 2.6rem; line-height: 1; color: var(--lime); font-variant-numeric: tabular-nums; }
.g-count { font-family: var(--f-display); font-stretch: 68%; font-weight: 800; font-size: clamp(7rem, 22vw, 14rem); line-height: 1; color: var(--lime); animation: cnt .8s ease-out both; }
@keyframes cnt { from { transform: scale(1.5); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); opacity: 1; } }

.g-form { display: flex; flex-direction: column; gap: 10px; align-items: center; width: 100%; max-width: 640px; }
.g-fields { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; gap: 10px; width: 100%; align-items: end; }
.g-fields label { display: flex; flex-direction: column; gap: 6px; text-align: left; font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); min-width: 0; }
.g-fields input { font: 500 18px/1.3 var(--f-body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); padding: 14px; min-height: 56px; width: 100%; min-width: 0; border-radius: 0; -webkit-appearance: none; appearance: none; }
.g-fields input:focus { outline: none; border-color: var(--lime); }
.g-msg { font-family: var(--f-mono); font-size: 15px; color: var(--lime); margin: 0; }
.g-msg.warn { color: #FF9A85; }
.g-acts { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.g-auto { font-family: var(--f-mono); font-size: 12px; color: var(--muted); letter-spacing: .06em; }

/* Scoreboard */
.sb { border-left: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; }
.sb-head { padding: 18px 20px 16px; border-bottom: 1px solid var(--line); }
.sb-head h3 { margin-top: 8px; font-size: 1.9rem; font-stretch: 72%; text-transform: uppercase; }
.sb-src { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; }
.sb-src i { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); }
.sb-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.sb-list:empty { flex: 0 0 auto; }
.sb-empty { flex: 1; }
.sb-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 50px 64px; gap: 10px; align-items: center; padding: 11px 20px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.sb-row.th { padding-block: 9px; position: sticky; top: 0; background: var(--bg-2); z-index: 1; }
.sb-row.th span { font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sb-rank { font-family: var(--f-display); font-stretch: 70%; font-weight: 800; font-size: 1.6rem; line-height: 1; color: var(--muted); }
.sb-row:nth-child(2) .sb-rank { color: var(--lime); }
.sb-who { min-width: 0; display: flex; flex-direction: column; }
.sb-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-who span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-num { font-family: var(--f-mono); font-size: 14px; text-align: right; }
.sb-num.pts { font-family: var(--f-display); font-stretch: 75%; font-weight: 800; font-size: 1.4rem; }
.sb-num.kn { display: none; }
.sb-row.me { background: color-mix(in srgb, var(--lime) 10%, transparent); box-shadow: inset 4px 0 0 var(--lime); animation: meIn .6s ease-out; }
@keyframes meIn { from { background: color-mix(in srgb, var(--lime) 35%, transparent); } }
.sb-row.gap { padding-block: 4px; color: var(--muted); font-family: var(--f-mono); font-size: 12px; }
.sb-empty { margin: 0; padding: 22px 20px; color: var(--muted); }
.sb-foot { padding: 14px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); line-height: 1.45; }
.sb-foot b { color: var(--fg); font-weight: 600; }
.sb-admin { padding: 16px 20px; border-top: 1px solid var(--line); background: #2A1A16; display: flex; flex-direction: column; gap: 10px; }
.sb-admin p { margin: 0; font-size: 14px; color: #FFC2B5; }
.sb-admin .row { display: flex; gap: 10px; }
.sb-admin .btn { min-height: 48px; font-size: 15px; padding: 10px 16px; }
.sb-admin .btn.danger { background: #FF7A5C; border-color: #FF7A5C; }

/* Portrait tablet: stack game over scoreboard */
@media (orientation: portrait) {
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(250px, 34%); }
  .g-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .g-experts { border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px 16px; }
  .ex { max-height: none; min-height: 80px; grid-template-columns: 40px minmax(0, 1fr); padding: 10px; gap: 4px 10px; }
  .ex .key { width: 40px; height: 40px; font-size: 1.35rem; }
  .ex .learn { grid-column: 1 / -1; }
  .sb { border-left: 0; border-top: 1px solid var(--line); }
  .sb-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; padding: 14px 20px; }
  .sb-head h3 { font-size: 1.6rem; }
  .sb-src { margin-top: 0; }
  .sb-row { grid-template-columns: 44px minmax(0, 1fr) 70px 70px 80px; }
  .sb-num.kn { display: block; }
  .sb-foot { display: none; }
}
@media (max-width: 760px) {
  .top { padding: 10px 14px; }
  .coop span, .fs span, .top-t .label { display: none; }
  .g-hud > div { padding: 10px 12px; }
  .g-hud strong { font-size: 1.7rem; }
  .g-rules, .g-result { grid-template-columns: minmax(0, 1fr); }
  .g-fields { grid-template-columns: minmax(0, 1fr); }
  .g-overlay { justify-content: flex-start; }
  .g-experts { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ==== AICon 2026 CI layer: matched to aicon26.com (Roboto, neutral greys, 12px radius, uppercase tracked buttons) ==== */
:root { --bg: #111111; --bg-2: #1A1A1A; --surface: #2B2B2B; --card: #252525; --fg: #FBFBFB; --muted: #A8A8A8; --line: #333333;
  --lime: #D8FF00; --lime-soft: #E6FF59; --on-lime: #131313; --cream: #F9FFD9;
  --f-display: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; --f-body: var(--f-display); --f-mono: var(--f-display); }
*, *::before, *::after { font-stretch: normal !important; }
.label { font-weight: 700; letter-spacing: .12em; }
h3 { font-weight: 700; color: var(--cream); letter-spacing: -.02em; }
.btn { border-radius: 12px; border-width: 2px; text-transform: uppercase; font-weight: 700; font-size: 15px; letter-spacing: .1em; color: var(--on-lime); }
.btn.ghost { color: var(--lime); border-color: var(--lime); background: transparent; }
.btn .arr { display: none; }
.top { background: #1A1A1A; border-bottom: 0; }
.top-t b { text-transform: none; font-weight: 900; font-size: 1.3rem; letter-spacing: -.01em; }
.fs { border-radius: 10px; border-color: #3A3A3A; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-size: 12px; }
.g-hud strong, .g-result strong, .sb-rank, .sb-num.pts, .ex .key, .g-count { font-weight: 900; }
.g-log { font-size: 14.5px; }
.t { border-radius: 7px; background: #2E2E2E; }
.t.done { background: color-mix(in srgb, var(--c) 34%, #2E2E2E); }
.ex { border-radius: 12px; background: var(--card); }
.ex .key { border-radius: 9px; }
.g-overlay { background: rgba(17,17,17,.93); }
.g-overlay h3 { text-transform: none; font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; }
.g-rules div, .g-result div { border-radius: 12px; border-color: rgba(251,251,251,.85); background: rgba(219,219,219,.1); }
.g-rules b { font-weight: 700; }
.g-fields input { border-radius: 10px; background: var(--surface); border-color: #3A3A3A; font-weight: 400; }
.g-msg, .g-auto { font-weight: 500; }
.g-count { color: var(--lime); }
.sb { background: var(--bg-2); }
.sb-head h3 { text-transform: none; font-size: 1.8rem; }
.sb-row.me { border-radius: 0; }
.sb-admin .btn { font-size: 13px; }
