/* Самолётик: a squared school-notebook sheet; the multiplier curve is drawn in ballpoint ink,
   the red margin rule is the Y axis, a paper plane rides the curve. Players can buy paper themes. */
@font-face { font-family: "Caveat"; font-weight: 600; font-display: swap; src: url(fonts/caveat-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Caveat"; font-weight: 600; font-display: swap; src: url(fonts/caveat-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Caveat"; font-weight: 700; font-display: swap; src: url(fonts/caveat-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Caveat"; font-weight: 700; font-display: swap; src: url(fonts/caveat-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap; src: url(fonts/golos-text-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap; src: url(fonts/golos-text-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-weight: 500; font-display: swap; src: url(fonts/golos-text-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 500; font-display: swap; src: url(fonts/golos-text-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-display: swap; src: url(fonts/golos-text-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-display: swap; src: url(fonts/golos-text-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-weight: 700; font-display: swap; src: url(fonts/golos-text-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 700; font-display: swap; src: url(fonts/golos-text-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --desk: #1f222a;
  --paper: #fbfaf3;
  --grid: #d9e5f1;
  --margin: #e39d98;
  --ink: #2541a6;
  --graphite: #353842;
  --go: #2c8a4d;
  --cash: #e5871a;
  --crash: #cc3a30;
  --muted: #7d808a;
  --font-display: "Caveat", "Segoe Print", "Comic Sans MS", cursive;
  --font-body: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cell: 20px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--desk); color: var(--graphite);
  font: 15px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
.desk { display: grid; justify-content: center; padding: 20px 12px 40px; }
.sheet {
  width: min(560px, 100vw - 24px);
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  border-radius: 6px; box-shadow: 0 1px 0 rgba(0,0,0,.3), 0 22px 44px rgba(0,0,0,.38);
  padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); color: var(--graphite);
}
@media (max-width: 600px) {
  .desk { padding: 0; }
  .sheet { width: 100vw; border-radius: 0; box-shadow: none; min-height: 100vh; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

/* paper themes */
.game.theme-lined { background-image: linear-gradient(var(--grid) 1px, transparent 1px); background-size: 100% 24px; }
.game.theme-mm {
  --paper: #fffaf1; --grid: rgba(222,132,70,.36); --margin: #e0796f;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(rgba(222,132,70,.15) 1px, transparent 1px), linear-gradient(90deg, rgba(222,132,70,.15) 1px, transparent 1px);
  background-size: 20px 20px, 20px 20px, 4px 4px, 4px 4px;
}
.game.theme-board {
  --paper: #25412f; --grid: rgba(255,255,255,.055); --ink: #f3f0e2; --graphite: #e9e6d6; --muted: #b8c4b6; --margin: #e5cc5f;
  color-scheme: dark;
}
.panel, .card, .item, #plist li, .modal-box, .info details { --ink: #2541a6; --graphite: #353842; --muted: #7d808a; color: var(--graphite); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
h1 { font: 700 clamp(38px, 10vw, 46px)/1 var(--font-display); color: var(--ink); margin: 0; letter-spacing: .3px; }
.right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wallet { display: flex; align-items: center; gap: 7px; }
.coin { width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 32%, #ffe59a, #e3a628 58%, #b07510); box-shadow: inset 0 0 0 1.5px rgba(110,70,0,.45); }
#balance { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--graphite); }
.badge-plus { font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #7b8496, #c9ced9 45%, #7b8496);
  border-radius: 999px; padding: 2px 7px; letter-spacing: .3px; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.badge-plus[hidden] { display: none; }
.hbtn { position: relative; font: 600 13px var(--font-body); color: var(--ink); background: transparent;
  border: 1.5px solid currentColor; border-radius: 999px; padding: 4px 11px; cursor: pointer; }
.hbtn .dot { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--crash); box-shadow: 0 0 0 2px var(--paper); }
.hbtn .dot[hidden] { display: none; }
button { font-family: var(--font-body); }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #2541a6; outline-offset: 2px; }
.conn { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: #fff; background: var(--crash); border-radius: 8px; padding: 6px 10px; }
.conn.ok { display: none; }
.conn.wait { background: #8a7a3a; }

/* history */
.history { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; min-height: 40px;
  -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
.history::-webkit-scrollbar { display: none; }
.chip { flex: none; font-size: 12.5px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
  padding: 5px 9px; border-radius: 999px; border: 1.5px solid currentColor; background: rgba(255,255,255,.85); }
.chip.lo { color: #4f5fae; } .chip.mid { color: var(--go); } .chip.hi { color: #b8650c; } .chip.top { color: var(--crash); background: #fff1ef; }
.chip.fresh { animation: pop .45s ease-out; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* stage */
.stage { position: relative; height: clamp(240px, 62vw, 330px); margin: 6px 0 0; touch-action: manipulation; }
#sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fair { font-size: 12px; color: var(--muted); margin: 4px 0 12px; min-height: 18px; overflow-wrap: anywhere; }
.fair code, .mono { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--graphite); overflow-wrap: anywhere; }

/* bet panels */
.bets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel { background: rgba(255,255,255,.9); border: 2px solid var(--ink); border-radius: 14px; padding: 10px; display: grid; gap: 8px; min-width: 0; }
.amount { display: grid; grid-template-columns: 38px minmax(0,1fr) 38px; gap: 6px; }
.amount input { width: 100%; height: 38px; text-align: center; font: 700 18px var(--font-body); font-variant-numeric: tabular-nums;
  color: var(--graphite); background: #fff; border: 1.5px solid rgba(37,65,166,.35); border-radius: 10px; }
.step { height: 38px; border-radius: 10px; border: 1.5px solid rgba(37,65,166,.35); background: #fff; color: var(--ink);
  font-size: 21px; font-weight: 700; line-height: 1; cursor: pointer; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.quick button { font-size: 12px; font-weight: 600; padding: 5px 0; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(37,65,166,.25); background: #fff; color: var(--ink); font-variant-numeric: tabular-nums; }
.panel :disabled { opacity: .45; cursor: default; }
.main { min-height: 60px; border: 0; border-radius: 12px; color: #fff; cursor: pointer; display: grid; place-content: center; gap: 1px;
  padding: 6px 8px; font-size: 17px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); transition: transform .06s, background-color .15s; touch-action: manipulation; }
.main small { font-size: 12px; font-weight: 500; opacity: .92; }
.main.go { background: var(--go); } .main.cancel { background: var(--crash); } .main.cash { background: var(--cash); }
.main.wait { background: #7d808a; }
.main.done { background: #ecebe6; color: var(--graphite); box-shadow: none; cursor: default; }
.main.done.won { background: #e3f2e8; color: var(--go); }
.panel .main:disabled { opacity: 1; }
.main:not(:disabled):active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); }
.autos { display: grid; gap: 5px; font-size: 13px; }
.autorow { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 26px; }
.autos label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.tgt { display: inline-flex; align-items: center; gap: 3px; }
.autos input[type="checkbox"] { width: 16px; height: 16px; accent-color: #2541a6; margin: 0; }
.autos input[type="text"] { width: 56px; height: 26px; text-align: center; font: 600 13px var(--font-body); font-variant-numeric: tabular-nums;
  border: 1.5px solid rgba(37,65,166,.35); border-radius: 7px; background: #fff; color: var(--graphite); }
.panel .note { font-size: 12px; color: var(--crash); margin: 0; }
.panel .note:empty { display: none; }

/* blocks */
.block { margin-top: 18px; scroll-margin-top: 12px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
h2 { font: 700 30px/1.05 var(--font-display); color: var(--ink); margin: 0; }
.cap { font-size: 12.5px; color: var(--muted); }
.card { background: rgba(255,255,255,.92); border: 1.5px solid rgba(37,65,166,.28); border-radius: 14px; padding: 12px; display: grid; gap: 10px; min-width: 0; }
.card + .card { margin-top: 8px; }
.btn { min-height: 36px; padding: 0 14px; border-radius: 10px; border: 0; background: #2541a6; color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; box-shadow: inset 0 -3px 0 rgba(0,0,0,.22); font-variant-numeric: tabular-nums; }
.btn.go { background: var(--go); }
.btn.gold { background: linear-gradient(135deg, #b9821a, #e7b84a 55%, #b9821a); color: #2e2208; }
.btn.ghost-btn { background: #fff; color: #2541a6; border: 1.5px solid rgba(37,65,166,.35); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; }
.daily-row { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; }
.dcell { border: 1.5px solid rgba(37,65,166,.25); border-radius: 10px; padding: 6px 2px; text-align: center; background: #fff; font-variant-numeric: tabular-nums; min-width: 0; }
.dcell b { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.dcell span { font-size: 12.5px; font-weight: 700; color: #2541a6; }
.dcell.done { background: #e3f2e8; border-color: rgba(44,138,77,.4); }
.dcell.done span { color: var(--go); }
.dcell.today { border: 2px solid var(--go); box-shadow: 0 0 0 3px rgba(44,138,77,.15); }
.dcell.last span { color: #b8650c; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row .grow { display: grid; gap: 2px; min-width: 0; flex: 1 1 180px; }
.refill { margin: 8px 2px 0; }
.refill:empty { display: none; }
.paynote { margin: 0 2px 8px; }
.plus { border: 2px solid #8a93a6; background: linear-gradient(160deg, #ffffff, #eef1f7); }
.plus h3 { margin: 0; font: 700 26px/1 var(--font-display); color: #4a5263; }
.plus ul { margin: 0; padding-left: 18px; display: grid; gap: 2px; font-size: 13.5px; }
.tabs { display: flex; gap: 6px; margin: 12px 0 8px; flex-wrap: wrap; }
.tab { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; border: 1.5px solid var(--ink); color: var(--ink); background: transparent; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.items { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.item { background: rgba(255,255,255,.94); border: 1.5px solid rgba(37,65,166,.25); border-radius: 12px; padding: 8px; display: grid; gap: 6px; justify-items: center; text-align: center; min-width: 0; }
.item.equipped { border: 2px solid var(--go); }
.pv { width: 100%; height: 58px; display: block; }
.swatch { width: 100%; height: 58px; border-radius: 8px; display: grid; place-items: center; font: 700 22px var(--font-display); }
.sw-theme_grid { background-color: #fbfaf3; background-image: linear-gradient(#d9e5f1 1px, transparent 1px), linear-gradient(90deg, #d9e5f1 1px, transparent 1px); background-size: 12px 12px; color: #2541a6; }
.sw-theme_lined { background-color: #fbfaf3; background-image: linear-gradient(#d9e5f1 1px, transparent 1px); background-size: 100% 14px; color: #2541a6; }
.sw-theme_mm { background-color: #fffaf1; background-image: linear-gradient(rgba(222,132,70,.4) 1px, transparent 1px), linear-gradient(90deg, rgba(222,132,70,.4) 1px, transparent 1px), linear-gradient(rgba(222,132,70,.15) 1px, transparent 1px), linear-gradient(90deg, rgba(222,132,70,.15) 1px, transparent 1px); background-size: 12px 12px, 12px 12px, 3px 3px, 3px 3px; color: #2541a6; }
.sw-theme_board { background: #25412f; color: #f3f0e2; }
.iname { font-size: 13px; font-weight: 600; line-height: 1.2; }
.ibtn { width: 100%; min-height: 30px; border-radius: 8px; border: 0; cursor: pointer; font-size: 12.5px; font-weight: 700; background: #2541a6; color: #fff; font-variant-numeric: tabular-nums; }
.ibtn.own { background: #fff; color: #2541a6; border: 1.5px solid rgba(37,65,166,.35); }
.ibtn.on { background: #e3f2e8; color: var(--go); cursor: default; }
.ibtn.plusonly { background: #eef1f7; color: #4a5263; border: 1.5px solid #8a93a6; }
.ibtn:disabled:not(.on) { opacity: .55; cursor: default; }
.bundle { margin-top: 8px; }

/* players */
#pot { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
#plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
#plist li { display: grid; grid-template-columns: minmax(0,1fr) 64px 56px 72px; gap: 6px; align-items: center; padding: 4px 8px; border-radius: 8px;
  font-size: 13.5px; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.82); }
#plist li span:nth-child(n+2) { text-align: right; }
#plist .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#plist li.won { background: #e7f4eb; }
#plist li.won .x, #plist li.won .w { color: var(--go); font-weight: 700; }
#plist li.lost { color: #a3a6ae; }
#plist li.you { box-shadow: inset 0 0 0 1.5px #2541a6; }
#plist li.you .name { color: #2541a6; font-weight: 700; }
#plist li.head { background: rgba(255,255,255,.55); font-size: 11.5px; color: var(--muted); padding-top: 2px; padding-bottom: 2px; }
#plist li.empty { display: block; color: var(--muted); font-size: 13px; }
#plist .badge-plus { font-size: 9.5px; padding: 1px 5px; margin-left: 4px; vertical-align: 1px; }

/* info */
.info details { background: rgba(255,255,255,.92); border: 1.5px solid rgba(37,65,166,.28); border-radius: 12px; padding: 8px 12px; margin-top: 8px; }
.info summary { font-weight: 700; cursor: pointer; color: #2541a6; }
.info details p { margin: 8px 0 4px; font-size: 14px; }
.verify { display: grid; gap: 6px; margin-top: 8px; }
.verify .ok { color: var(--go); font-weight: 700; }
.verify .bad { color: var(--crash); font-weight: 700; }
.legal { margin: 12px 2px 0; }

/* modal and toast */
.modal { position: fixed; inset: 0; background: rgba(15,17,22,.55); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal[hidden] { display: none; }
.modal-box { width: min(380px, 100%); background: #fbfaf3; border-radius: 16px; padding: 18px; display: grid; gap: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.4); border: 2px solid #2541a6; }
.modal-box h3 { margin: 0; font: 700 30px/1.05 var(--font-display); color: #2541a6; }
.modal-box p { margin: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.adbox { height: 120px; border-radius: 12px; background: repeating-linear-gradient(45deg, #e9edf7, #e9edf7 10px, #f4f6fb 10px, #f4f6fb 20px); display: grid; place-items: center; font: 700 44px var(--font-display); color: #2541a6; }
.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: #23262e; color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 14px; max-width: min(420px, calc(100vw - 32px)); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.toast[hidden] { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 430px) {
  .bets { gap: 8px; }
  .panel { padding: 8px; gap: 7px; border-radius: 12px; }
  .amount { grid-template-columns: 30px minmax(0,1fr) 30px; gap: 4px; }
  .amount input { font-size: 16px; height: 34px; }
  .step { height: 34px; font-size: 19px; }
  .quick { display: none; }
  .main { min-height: 56px; font-size: 16px; }
  .main small { font-size: 11px; }
  .autos { font-size: 12px; }
  .autos input[type="text"] { width: 50px; }
  #plist li { grid-template-columns: minmax(0,1fr) 58px 50px 64px; font-size: 13px; padding: 4px 6px; }
  .items { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dcell span { font-size: 11px; }
  .dcell b { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { .chip.fresh { animation: none; } .main { transition: none; } }
