/* kai-casino.fun — «тетрадь студента»: клетка, ручка, маркеры, скотч, наклейки */
:root {
  --paper: #fbfaf3;
  --paper-w: #fffefa;
  --cell: #d9e5f2;          /* клетка */
  --margin: #eea7a7;        /* поле тетради */
  --ink: #1f3b8f;           /* синяя ручка */
  --ink-2: #4a63a8;
  --pencil: #6d7079;
  --pencil-2: #9a9da5;
  --red: #d42a3c;           /* красная ручка преподавателя */
  --green: #1b8a4b;
  --mk-y: #ffe45c;          /* маркеры */
  --mk-p: #ffb3d1;
  --mk-g: #b5ecb0;
  --mk-b: #b6e0ff;
  --mk-o: #ffc58f;
  --tape: rgba(246, 228, 160, .78);
  --shadow: 0 1px 1px rgba(30, 40, 80, .08), 0 6px 16px rgba(30, 40, 80, .09);
  --hand: "Caveat", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --print: "PT Sans", "Segoe UI", Roboto, system-ui, sans-serif;
  --wob: 14px 4px 12px 5px / 5px 12px 4px 14px;   /* «рукописная» рамка */
  --chat-w: 300px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 400 16px/1.5 var(--print);
  background-color: var(--paper);
  background-image: linear-gradient(var(--cell) 1px, transparent 1px), linear-gradient(90deg, var(--cell) 1px, transparent 1px);
  background-size: 22px 22px; background-attachment: fixed;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .4; }
:focus-visible { outline: 2px dashed var(--red); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--mk-y); padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
.hw { font-family: var(--hand); }
svg .hw { font-family: var(--hand); font-weight: 600; }
h1, h2, h3 { font-family: var(--hand); font-weight: 700; line-height: 1; margin: 0; }
.muted { color: var(--pencil); }
.win { color: var(--green); }
.lose { color: var(--red); }
.coin { width: 1em; height: 1em; vertical-align: -.12em; flex: none; color: var(--ink); }
.mark { background: linear-gradient(transparent 12%, var(--mk-y) 12% 86%, transparent 86%); padding: 0 .15em; }

/* ---------- шапка: верх страницы тетради ---------- */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 22px;
  padding: 8px max(18px, env(safe-area-inset-right)) 8px max(18px, env(safe-area-inset-left));
  background-color: var(--paper);
  background-image: linear-gradient(var(--cell) 1px, transparent 1px), linear-gradient(90deg, var(--cell) 1px, transparent 1px);
  background-size: 22px 22px; background-attachment: fixed;
  border-bottom: 2px solid var(--ink); box-shadow: 0 3px 0 -1px var(--paper), 0 4px 0 0 var(--ink);
}
.brand { display: flex; align-items: center; gap: 6px; text-decoration: none; font: 700 34px/1 var(--hand); }
.logo-mark { width: 30px; height: 30px; transform: rotate(40deg); color: var(--ink); }
.nav { display: flex; gap: 2px; }
.nav a { text-decoration: none; padding: 4px 10px; font: 600 24px/1 var(--hand); color: var(--ink-2); position: relative; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); }
.nav a.on::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -2px; height: 9px; background: var(--mk-y); z-index: -1; transform: rotate(-1.5deg); border-radius: 3px; }
.hud { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.balance { display: grid; justify-items: end; padding: 4px 12px 6px; background: var(--mk-y); box-shadow: var(--shadow); transform: rotate(-2deg); min-width: 104px; }
.balance small { font: 500 15px/1 var(--hand); color: var(--pencil); }
.balance > span { display: flex; align-items: center; gap: 5px; font: 700 27px/1 var(--hand); }
.balance output.bump { animation: bump .6s; }
@keyframes bump { 30% { color: var(--green); transform: scale(1.08); } }
.stip { font: 600 21px/1 var(--hand); color: var(--red); border: 2px solid var(--red); border-radius: 50% 46% 52% 48% / 52% 48% 50% 46%; padding: 8px 12px; transform: rotate(-4deg); white-space: nowrap; }
.stip.ready:hover { background: rgba(212, 42, 60, .08); }
.stip:disabled { opacity: 1; color: var(--pencil-2); border-color: var(--pencil-2); }
.who { font: 600 22px/1 var(--hand); border-bottom: 2px solid currentColor; padding: 4px 2px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- раскладка: страница + чат на полях ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); }
main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 26px 22px 40px 64px; outline: none; position: relative; min-height: 70vh; }
main::before { content: ""; position: absolute; top: 0; bottom: 0; left: 40px; width: 2px; background: var(--margin); }
@media (min-width: 1360px) {
  .layout { grid-template-columns: minmax(0, 1fr) var(--chat-w); }
  .chat-fab { display: none; }
}

/* ---------- кнопки, поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px 11px; font: 700 24px/1 var(--hand); color: var(--ink); text-decoration: none; border: 2px solid currentColor; border-radius: var(--wob); transition: transform .08s; background: var(--paper-w); }
.btn:hover:not(:disabled) { transform: rotate(-1deg) translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-mk { background: linear-gradient(100deg, transparent 2%, var(--mk-y) 4% 96%, transparent 98%); }
.btn-go { background: linear-gradient(100deg, transparent 2%, var(--mk-g) 4% 96%, transparent 98%); color: var(--green); }
.btn-red { color: var(--red); }
.btn-wide { width: 100%; font-size: 28px; padding: 12px; }
.btn-sm { font-size: 20px; padding: 5px 12px 7px; }
.link { font: 600 21px/1 var(--hand); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; color: var(--ink-2); }
.field { display: grid; gap: 2px; }
.field > span, .lbl { font: 500 20px/1.1 var(--hand); color: var(--pencil); }
.line { display: flex; align-items: flex-end; gap: 6px; border-bottom: 2px solid var(--ink); }
.line:focus-within { border-bottom-color: var(--red); }
.line input, .line select, .line textarea { flex: 1; min-width: 0; width: 100%; background: none; border: 0; outline: 0; padding: 4px 2px; font: 700 28px/1.1 var(--hand); color: var(--ink); }
.line select { font-size: 24px; }
.line select option { font: 16px var(--print); }
.line .q { font: 600 20px/1 var(--hand); color: var(--ink-2); padding: 4px 6px 6px; border-radius: 50%; }
.line .q:hover { color: var(--red); }
.line .pre { padding-bottom: 8px; }
input[type=number]::-webkit-inner-spin-button { display: none; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
textarea { resize: vertical; }

/* ---------- бумажные элементы ---------- */
.paper { position: relative; background: var(--paper-w); box-shadow: var(--shadow); padding: 18px 20px; }
.tape::before { content: ""; position: absolute; top: -12px; left: 50%; width: 96px; height: 26px; margin-left: -48px; background: var(--tape); transform: rotate(-3deg); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); z-index: 2; }
.tape.tl::before { left: 8px; margin: 0; transform: rotate(-24deg); top: -6px; width: 70px; }
.sticky { position: relative; padding: 16px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06), 6px 10px 14px -8px rgba(40, 40, 60, .3); }
.st-y { background: #fff59d; } .st-p { background: #ffd1e3; } .st-g { background: #d3f5cc; } .st-b { background: #d4ecff; } .st-o { background: #ffe0c2; }
.torn { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), 96% 100%, 91% calc(100% - 5px), 85% 100%, 79% calc(100% - 4px), 72% 100%, 66% calc(100% - 6px), 59% 100%, 52% calc(100% - 4px), 45% 100%, 38% calc(100% - 6px), 31% 100%, 24% calc(100% - 5px), 17% 100%, 10% calc(100% - 4px), 4% 100%, 0 calc(100% - 6px)); }

/* ---------- главная ---------- */
.cover { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 26px; align-items: start; margin-bottom: 26px; }
.label { position: relative; background: var(--paper-w); border: 2px solid var(--ink); border-radius: 18px; padding: 22px 26px 20px; box-shadow: 0 0 0 6px var(--paper-w), 0 0 0 7.5px var(--ink), var(--shadow); max-width: 560px; margin: 8px; }
.label .t1 { font: 700 15px/1 var(--print); letter-spacing: .3em; text-align: center; }
.label .t2 { font: 700 72px/1 var(--hand); text-align: center; margin: 4px 0 10px; color: var(--ink); }
.label .row { display: flex; align-items: baseline; gap: 10px; font: 400 15px/1 var(--print); margin: 12px 0 0; }
.label .row b { flex: 1; font: 700 28px/1 var(--hand); border-bottom: 1.5px solid var(--ink); padding: 0 6px 2px; color: var(--ink); min-height: 30px; }
.label .lead { font: 500 22px/1.25 var(--hand); color: var(--ink-2); margin: 16px 0 0; }
.cover-side { display: grid; gap: 12px; justify-items: start; padding-top: 8px; }
.doodle { color: var(--ink); display: block; }
.doodle svg { display: block; width: 100%; height: auto; }
.cover-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.h-sec { display: flex; align-items: baseline; gap: 14px; margin: 34px 0 14px; flex-wrap: wrap; }
.h-sec h2 { font-size: 42px; }
.h-sec h2::after { content: ""; display: block; height: 8px; margin-top: -6px; background: var(--mk-y); opacity: .8; border-radius: 3px; transform: rotate(-1deg); }
.h-sec .muted { font: 500 21px/1 var(--hand); }

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px 18px; }
.game { display: grid; grid-template-rows: auto 1fr; gap: 2px; text-decoration: none; transform: rotate(var(--r, 0deg)); transition: transform .12s; min-height: 210px; }
.game:hover { transform: rotate(0deg) scale(1.03); z-index: 2; }
.game .pic { color: var(--ink); height: 112px; display: grid; place-items: center; }
.game .pic svg { height: 100%; width: auto; max-width: 100%; }
.game b { font: 700 28px/1 var(--hand); display: block; }
.game small { font: 500 19px/1.1 var(--hand); color: var(--pencil); display: block; margin-top: 3px; }
.game .tag { position: absolute; top: -10px; right: -6px; font: 700 18px/1 var(--hand); color: var(--red); border: 2px solid var(--red); padding: 3px 7px; transform: rotate(8deg); background: var(--paper-w); border-radius: 4px 9px 4px 8px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; margin-top: 36px; align-items: start; }
.panel h2, .panel h3 { font-size: 34px; margin-bottom: 10px; }
.zachetka { width: 100%; border-collapse: collapse; font: 400 15px/1.2 var(--print); }
.zachetka th { text-align: left; font-weight: 400; font-size: 12px; color: var(--pencil); border-bottom: 1.5px solid var(--ink); padding: 4px 6px; }
.zachetka td { border-bottom: 1px solid var(--cell); padding: 6px; }
.zachetka td.v { font: 700 25px/1 var(--hand); }
.zachetka td.sig { width: 74px; }
.sig svg { width: 64px; height: 22px; color: var(--ink-2); }
.rankline { margin-top: 14px; font: 500 21px/1.2 var(--hand); }
.prog { height: 14px; border: 2px solid var(--ink); border-radius: 8px 3px 7px 4px; margin-top: 6px; overflow: hidden; }
.prog i { display: block; height: 100%; background: repeating-linear-gradient(-45deg, var(--ink-2) 0 2px, transparent 2px 6px); }

/* «Подслушано» — посты-записки */
.feed { display: grid; gap: 14px; }
.post { padding: 12px 16px 18px; background: var(--paper-w); box-shadow: var(--shadow); transform: rotate(var(--r, 0deg)); }
.post .ph { display: flex; justify-content: space-between; font: 500 17px/1 var(--hand); color: var(--pencil); margin-bottom: 4px; }
.post p { margin: 0; font: 600 23px/1.2 var(--hand); color: var(--ink); overflow-wrap: anywhere; }
.post.win p { color: var(--green); } .post.loss p { color: var(--ink); }
.reacts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.reacts button { font: 15px/1 var(--print); padding: 4px 8px; border: 1.5px solid var(--cell); border-radius: 12px; background: var(--paper); }
.reacts button.on { border-color: var(--ink); background: var(--mk-b); }
.reacts button:hover { border-color: var(--ink-2); }

table.list { width: 100%; border-collapse: collapse; }
.list td { padding: 7px 6px; border-bottom: 1px solid var(--cell); vertical-align: middle; }
.list td.n { width: 40px; font: 700 22px/1 var(--hand); color: var(--pencil); }
.list td.nm a { font: 700 24px/1 var(--hand); text-decoration: none; }
.list td.nm a:hover { text-decoration: underline; }
.list .sub { display: block; font: 500 17px/1.1 var(--hand); color: var(--pencil); }
.list td.r { text-align: right; font: 700 24px/1 var(--hand); white-space: nowrap; }
.list tr.me td { background: linear-gradient(transparent 20%, rgba(255, 228, 92, .55) 20% 85%, transparent 85%); }
.medal { width: 28px; height: 28px; color: var(--ink); }
.empty { padding: 14px 0; font: 500 21px/1.3 var(--hand); color: var(--pencil); }
.tabs-h { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs-h button { font: 700 24px/1 var(--hand); color: var(--pencil); padding: 4px 10px; position: relative; }
.tabs-h button.on { color: var(--ink); }
.tabs-h button.on::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 0; height: 9px; background: var(--mk-y); z-index: -1; transform: rotate(-1deg); }
.roast { font: 600 21px/1.2 var(--hand); color: var(--red); margin-top: 2px; }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.banner b { font: 700 28px/1.1 var(--hand); color: var(--red); }

/* ---------- страница игры ---------- */
.ghead { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.ghead h1 { font-size: clamp(40px, 7vw, 58px); }
.ghead p { margin: 0; font: 500 22px/1.1 var(--hand); color: var(--pencil); width: 100%; }
.ghead .odds { margin-left: auto; }
.back { font: 700 26px/1 var(--hand); text-decoration: none; color: var(--ink-2); padding-bottom: 6px; }
.back:hover { color: var(--red); }
.glayout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 310px); gap: 26px; align-items: start; }
.stage { position: relative; background: var(--paper-w); box-shadow: var(--shadow); padding: 22px; min-height: 320px; }
.controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 20px 18px 22px; background: #fff59d; box-shadow: 0 1px 1px rgba(0, 0, 0, .06), 8px 12px 16px -10px rgba(40, 40, 60, .35); transform: rotate(.6deg); position: sticky; top: 100px; }
.controls .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.controls .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.controls .row2 .btn, .controls .row3 .btn { padding-left: 6px; padding-right: 6px; font-size: 22px; }
.controls p { margin: 0; font: 500 19px/1.2 var(--hand); color: var(--pencil); }
.sum { display: flex; justify-content: space-between; align-items: baseline; font: 500 21px/1.1 var(--hand); color: var(--pencil); }
.sum b { color: var(--ink); font-size: 25px; }
.hist-panel { margin-top: 26px; }
.hist { display: grid; }
.hist > div { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 5px 0; border-bottom: 1px solid var(--cell); font: 600 21px/1.2 var(--hand); }
.hist .t { color: var(--pencil); font-weight: 500; }
details.info summary { cursor: pointer; font: 600 21px/1.2 var(--hand); color: var(--ink-2); }
.result { text-align: center; font: 700 36px/1.1 var(--hand); min-height: 42px; margin-top: 12px; }

/* слоты */
.machine { max-width: 470px; margin: 4px auto 0; padding: 18px; border: 2.5px solid var(--ink); border-radius: 20px 8px 18px 10px / 10px 18px 8px 20px; position: relative; background: var(--paper-w); }
.machine::after { content: ""; position: absolute; right: -26px; top: 40px; width: 16px; height: 120px; border: 2.5px solid var(--ink); border-left: 0; border-radius: 0 10px 10px 0; }
.window { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.reel { --cell: 112px; height: calc(var(--cell) * 3); overflow: hidden; position: relative; border: 2px solid var(--ink); border-radius: 6px 3px 7px 2px; background: var(--paper-w); }
.reel::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(var(--paper-w), transparent 18%, transparent 82%, var(--paper-w)); opacity: .85; }
.strip { will-change: transform; }
.sym { height: var(--cell); display: grid; place-items: center; padding: 12px; }
.sym svg { width: 100%; height: 100%; }
.sym.hit { background: radial-gradient(circle, rgba(255, 228, 92, .8) 0 55%, transparent 70%); }
.paylines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.paylines polyline { fill: none; stroke: var(--red); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; opacity: .85; }
.paytab { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 10px; margin-top: 8px; }
.paytab div { display: flex; align-items: center; gap: 6px; font: 700 23px/1 var(--hand); }
.mini { width: 34px; height: 34px; display: inline-block; vertical-align: middle; }
.mini svg { width: 100%; height: 100%; }

/* рулетка */
.rtape { position: relative; overflow: hidden; border: 2px solid var(--ink); border-radius: 6px; padding: 10px 0; background: var(--paper-w); -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
.tape-strip { display: flex; gap: 4px; will-change: transform; padding-left: 4px; }
.tc { flex: 0 0 56px; height: 64px; display: grid; place-items: center; font: 700 34px/1 var(--hand); border: 2px solid currentColor; border-radius: 6px 3px 7px 4px; }
.tc.red, .rt .red { color: var(--red); } .tc.black, .rt .black { color: var(--ink); } .tc.green, .rt .green { color: var(--green); }
.needle { position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--red); z-index: 2; pointer-events: none; }
.recent { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; min-height: 26px; font: 700 23px/1 var(--hand); }
.recent .red { color: var(--red); } .recent .green { color: var(--green); }
.rt { display: grid; grid-template-columns: 1.15fr repeat(12, 1fr) 1.15fr; grid-template-rows: repeat(3, 46px) 40px 40px; margin-top: 18px; user-select: none; border: 2px solid var(--ink); }
.rt button { position: relative; display: grid; place-items: center; font: 700 24px/1 var(--hand); border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.rt button.out { color: var(--ink); font-size: 20px; }
.rt button:hover { background: rgba(255, 228, 92, .4); }
.rt button.won { background: rgba(181, 236, 176, .8); }
.rt .zero { grid-row: 1 / 4; grid-column: 1; }
.chipmark { position: absolute; right: -6px; top: -8px; z-index: 3; min-width: 26px; height: 26px; padding: 0 5px; display: grid; place-items: center; border-radius: 50%; background: var(--mk-y); color: var(--ink); font: 700 16px/1 var(--hand); border: 2px solid var(--ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { width: 46px; height: 46px; border-radius: 50%; font: 700 21px/1 var(--hand); border: 2.5px dashed var(--ink); background: var(--c); }
.chip.on { border-style: solid; box-shadow: 0 0 0 3px var(--paper-w), 0 0 0 5px var(--red); }

/* карты */
.felt { min-height: 430px; }
.arc { display: block; width: 100%; max-width: 520px; height: auto; margin: 0 auto -16px; pointer-events: none; color: var(--pencil); }
.arc text { font-family: var(--hand); font-size: 22px; fill: var(--pencil); }
.hand-l { display: flex; align-items: baseline; gap: 10px; font: 600 25px/1 var(--hand); }
.hand-l b { font: 700 25px/1 var(--hand); border: 2px solid var(--ink); border-radius: 50%; min-width: 40px; height: 34px; display: inline-grid; place-items: center; padding: 0 6px; }
.hand { display: flex; min-height: 124px; margin: 10px 0 8px; padding-left: 4px; }
.hand .pcard + .pcard { margin-left: -30px; }
.pcard { position: relative; width: 84px; height: 118px; border-radius: 7px; background: #fff; color: #1b1b1b; box-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 5px 12px rgba(30, 40, 80, .15); font: 700 26px/1 var(--hand); flex: none; border: 1px solid #ddd; }
.pcard.red { color: var(--red); }
.pcard .suit { width: 14px; height: 14px; display: block; }
.pc-r { position: absolute; left: 7px; top: 6px; display: grid; justify-items: center; gap: 1px; }
.pc-flip { left: auto; top: auto; right: 7px; bottom: 6px; transform: rotate(180deg); }
.pc-mid { position: absolute; inset: 0; display: grid; place-items: center; }
.pc-mid .suit { width: 36px; height: 36px; }
.pcard.back { background: var(--ink) repeating-linear-gradient(45deg, rgba(255, 255, 255, .12) 0 2px, transparent 2px 8px); border: 4px solid #fff; }
.back-mark { position: absolute; inset: 0; display: grid; place-items: center; }
.back-mark svg { width: 34px; height: 34px; transform: rotate(45deg); }
@media (prefers-reduced-motion: no-preference) { .pcard.new { animation: deal .32s cubic-bezier(.2, .8, .3, 1) both; } }
@keyframes deal { from { transform: translate(160px, -110px) rotate(14deg); opacity: 0; } }

/* взлёт и общий рейс */
.sky { padding: 0; min-height: 0; overflow: hidden; }
.sky canvas { display: block; width: 100%; height: 360px; }
.mult { position: absolute; left: 22px; top: 12px; pointer-events: none; }
.mult b { display: block; font: 700 clamp(56px, 9vw, 84px)/1 var(--hand); }
.mult span { font: 600 23px/1.1 var(--hand); color: var(--pencil); }
.mult.boom b { color: var(--red); } .mult.cash b { color: var(--green); }
.crashes { display: flex; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-top: 1.5px dashed var(--cell); min-height: 46px; font: 700 22px/1.2 var(--hand); }
.crashes .hi { color: var(--green); } .crashes .lo { color: var(--pencil); }
.crew { display: grid; gap: 0; max-height: 300px; overflow: auto; }
.crew > div { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--cell); font: 600 20px/1.2 var(--hand); }
.crew .c { color: var(--green); }

/* сопромат */
.mgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; max-width: 470px; margin: 0 auto; }
.ticket { position: relative; aspect-ratio: 1 / 1.1; background: var(--paper-w); border: 2px solid var(--ink); border-radius: 3px 6px 2px 5px; font-family: var(--hand); transition: transform .15s, background .15s; box-shadow: 2px 3px 0 rgba(31, 59, 143, .15); }
.ticket:disabled { opacity: 1; cursor: default; }
.ticket:not(:disabled):hover { transform: rotate(-3deg) translateY(-2px); background: #fff9d6; }
.ticket .tn { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; }
.ticket .tn small { font: 500 15px/1 var(--hand); color: var(--pencil); }
.ticket .tn b { font: 700 28px/1 var(--hand); }
.ticket.open .tn { display: none; }
.stampmark { position: absolute; inset: 10%; display: grid; place-items: center; border-radius: 50%; border: 3px solid currentColor; font: 700 clamp(28px, 6vw, 42px)/1 var(--hand); transform: rotate(-12deg); }
.stampmark small { position: absolute; bottom: 8%; font: 600 13px/1 var(--hand); }
.ticket.five { color: var(--green); } .ticket.two { color: var(--red); } .ticket.boom { background: #ffe1e1; }
.ticket.dim .stampmark { opacity: .35; }
@media (prefers-reduced-motion: no-preference) { .ticket.open .stampmark { animation: stamp .25s cubic-bezier(.3, 1.6, .5, 1) both; } }
@keyframes stamp { from { transform: rotate(-12deg) scale(1.8); opacity: 0; } }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; padding: 6px 4px 8px; border: 2px solid var(--ink); border-radius: var(--wob); font: 700 21px/1 var(--hand); background: var(--paper-w); min-width: 40px; }
.seg button.on { background: var(--mk-p); }

/* седьмой этаж */
.building { display: grid; gap: 6px; max-width: 520px; margin: 0 auto; }
.floor { display: grid; grid-template-columns: 56px 1fr 70px; align-items: center; gap: 10px; }
.floor .fn { font: 700 24px/1 var(--hand); color: var(--pencil); white-space: nowrap; }
.floor .fm { font: 700 22px/1 var(--hand); text-align: right; color: var(--pencil); }
.floor.cur .fn, .floor.cur .fm { color: var(--red); }
.doors { display: flex; gap: 8px; justify-content: center; }
.door { width: 52px; height: 74px; color: var(--ink); transition: transform .1s; }
.door svg { stroke-width: 1; }
.door svg { width: 100%; height: 100%; }
.door:not(:disabled):hover { transform: translateY(-3px) rotate(-2deg); }
.floor.past .door:not(.picked) { opacity: .6; }
.floor:not(.cur):not(.past) .door { opacity: .75; }

/* больше-меньше */
.hl-main { display: flex; align-items: center; justify-content: center; gap: 30px; flex-wrap: wrap; margin-top: 10px; }
.hl-main .pcard { width: 120px; height: 168px; font-size: 36px; }
.hl-main .pcard .pc-mid .suit { width: 52px; height: 52px; }
.trail { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 18px; }
.trail .pcard { width: 44px; height: 62px; font-size: 16px; box-shadow: none; }
.trail .pcard .suit { width: 9px; height: 9px; }
.trail .pcard .pc-mid .suit { width: 18px; height: 18px; }
.trail .pcard .pc-flip { display: none; }
.trail .tg { position: relative; }
.trail .tg i { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font: 700 16px/1 var(--hand); font-style: normal; }

/* билеты (кено) */
.kgrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; max-width: 560px; margin: 0 auto; }
.kt { aspect-ratio: 1; display: grid; place-items: center; font: 700 26px/1 var(--hand); border: 1.5px solid var(--cell); border-radius: 4px; position: relative; background: var(--paper-w); }
.kt:hover { background: #fff9d6; }
.kt.pick { background: var(--mk-y); border-color: var(--ink); }
.kt.drawn::after { content: ""; position: absolute; inset: 3px; border: 2.5px solid var(--red); border-radius: 50%; transform: rotate(-8deg); }
.kt.hit { background: var(--mk-g); }
.paytbl { width: 100%; border-collapse: collapse; font: 600 21px/1.1 var(--hand); }
.paytbl td { padding: 2px 4px; border-bottom: 1px dashed rgba(31, 59, 143, .25); }
.paytbl td:last-child { text-align: right; }
.paytbl tr.hit td { background: var(--mk-g); }

/* гонка */
.track { display: grid; gap: 12px; }
.lane { position: relative; height: 66px; border-bottom: 2px dashed var(--cell); }
.lane .finish { position: absolute; right: 12px; top: 0; bottom: 0; border-right: 3px dotted var(--red); }
.lane .ride { position: absolute; left: 0; bottom: 4px; width: 90px; height: 50px; color: var(--ink); transition: left linear; }
.lane .ride svg { width: 100%; height: 100%; }
.lane .nm { position: absolute; left: 100px; top: 4px; font: 600 20px/1 var(--hand); color: var(--pencil); }
.picks { display: grid; gap: 6px; }
.picks button { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border: 2px solid var(--ink); border-radius: var(--wob); font: 700 22px/1 var(--hand); background: var(--paper-w); }
.picks button.on { background: var(--mk-b); }
.picks button small { font: 600 18px/1 var(--hand); color: var(--pencil); }

/* лотерея */
.ticket-l { position: relative; max-width: 420px; margin: 0 auto; padding: 18px; border: 2.5px dashed var(--ink); background: #fffbe6; }
.ticket-l h3 { text-align: center; font-size: 30px; margin-bottom: 10px; }
.sgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; }
.scell { aspect-ratio: 1; display: grid; place-items: center; padding: 10px; border: 1.5px solid var(--cell); background: #fff; }
.scell svg { width: 100%; height: 100%; }
.scell.win { background: var(--mk-g); }
.scratch-cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

/* дуэли */
.duel-list { display: grid; gap: 10px; }
.duel { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 10px 14px; background: var(--paper-w); box-shadow: var(--shadow); }
.duel b { font: 700 25px/1 var(--hand); }
.duel .sub { font: 500 18px/1.2 var(--hand); color: var(--pencil); }
.dice { display: inline-flex; vertical-align: middle; gap: 6px; align-items: center; font: 700 22px/1 var(--hand); }
.die { width: 30px; height: 30px; border: 2px solid var(--ink); border-radius: 6px; display: grid; place-items: center; font: 700 20px/1 var(--hand); background: var(--paper-w); }

/* столовая */
.canteen { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 30px 18px; }
.pie-btn { width: min(250px, 66vw); aspect-ratio: 1; display: grid; place-items: center; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform .07s; }
.pie-btn:active { transform: scale(.92) rotate(-3deg); }
.pie-btn svg { width: 100%; height: 100%; }
.pop { position: absolute; font: 700 30px/1 var(--hand); color: var(--green); pointer-events: none; animation: pop .8s forwards; }
@keyframes pop { to { transform: translateY(-70px) rotate(-8deg); opacity: 0; } }
.count { font: 700 46px/1 var(--hand); }

/* профиль */
.profile { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 26px; align-items: start; }
.idcard { padding: 22px 20px; }
.idcard h1 { font-size: 48px; overflow-wrap: anywhere; }
.idcard .inst { font: 600 23px/1.2 var(--hand); color: var(--ink-2); margin-top: 6px; }
.idcard .tg { display: inline-block; margin-top: 10px; font: 700 23px/1 var(--hand); color: var(--ink); background: var(--mk-b); padding: 4px 10px; text-decoration: none; transform: rotate(-1.5deg); }
.idcard .bio { font: 600 23px/1.25 var(--hand); margin: 14px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.wall-form { display: grid; gap: 10px; margin-bottom: 18px; }
.wall-form .line textarea { font: 600 25px/1.2 var(--hand); min-height: 70px; }
.wpost { padding: 12px 16px 14px; background: var(--paper-w); box-shadow: var(--shadow); margin-bottom: 14px; }
.wpost .wh { display: flex; justify-content: space-between; gap: 10px; font: 500 18px/1 var(--hand); color: var(--pencil); margin-bottom: 4px; }
.wpost .wh a { font-weight: 700; color: var(--ink); }
.wpost p { margin: 0; font: 600 24px/1.25 var(--hand); white-space: pre-wrap; overflow-wrap: anywhere; }
.wpost .del { font: 500 17px/1 var(--hand); color: var(--red); }

/* шансы */
.prose { max-width: 70ch; font-size: 16px; color: #2a3550; }
.prose p { margin: 0 0 10px; }
.odds-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
table.ot { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 6px; }
.ot th { text-align: left; font-weight: 400; color: var(--pencil); padding: 5px 8px; border-bottom: 1.5px solid var(--ink); }
.ot td { padding: 6px 8px; border-bottom: 1px solid var(--cell); }
.ot .num { text-align: right; white-space: nowrap; }
.tablewrap { overflow-x: auto; }

/* ---------- чат на полях ---------- */
.chat { display: none; }
.chat.open, .layout .chat { }
@media (min-width: 1360px) {
  .chat { display: flex; position: sticky; top: 74px; height: calc(100vh - 74px); }
}
.chat { flex-direction: column; background: var(--paper-w); border-left: 2px solid var(--margin);
  background-image: linear-gradient(transparent 27px, var(--mk-b) 27px, var(--mk-b) 28px, transparent 28px); background-size: 100% 28px; }
.chat-h { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 6px; border-bottom: 2px solid var(--ink); background: var(--paper-w); }
.chat-h h3 { font-size: 30px; }
.chat-h small { font: 500 17px/1 var(--hand); color: var(--pencil); }
.chat-x { font: 700 26px/1 var(--hand); padding: 2px 8px; }
.msgs { flex: 1; overflow-y: auto; padding: 8px 14px; display: flex; flex-direction: column; gap: 6px; }
.msg { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.msg a { font: 700 20px/1 var(--hand); text-decoration: none; color: var(--ink); }
.msg a:hover { text-decoration: underline; }
.msg .mi { font: 500 15px/1 var(--hand); color: var(--pencil); margin-left: 4px; }
.msg .mt { color: #2a3550; }
.msg.me a { background: var(--mk-y); }
.chat-f { display: flex; gap: 6px; padding: 10px 12px 12px; border-top: 2px solid var(--ink); background: var(--paper-w); }
.chat-f input { flex: 1; min-width: 0; border: 0; border-bottom: 2px solid var(--ink); background: none; outline: 0; font: 600 22px/1.2 var(--hand); padding: 4px 2px; }
.chat-f .btn { font-size: 20px; padding: 4px 12px 6px; }
.chat-note { padding: 10px 14px 14px; font: 500 19px/1.2 var(--hand); color: var(--pencil); border-top: 2px solid var(--ink); background: var(--paper-w); }
.chat-fab { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40; font: 700 26px/1 var(--hand); padding: 10px 18px 12px; background: #fff59d; box-shadow: 0 6px 14px rgba(30, 40, 80, .25); transform: rotate(-3deg); border-radius: 3px; }
.chat-fab .unread { position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px; border-radius: 12px; background: var(--red); color: #fff; font: 700 14px/24px var(--print); padding: 0 6px; }
@media (max-width: 1359px) {
  .chat.open { display: flex; position: fixed; right: 0; top: 0; bottom: 0; width: min(380px, 100vw); z-index: 50; box-shadow: -10px 0 30px rgba(30, 40, 80, .25); }
}

/* ---------- окна, меню, тосты, подвал ---------- */
dialog.auth { border: 0; background: var(--paper-w); color: var(--ink); padding: 0; width: min(440px, calc(100% - 24px)); box-shadow: 0 20px 50px rgba(20, 30, 60, .35); }
dialog.auth::backdrop { background: rgba(30, 40, 70, .45); }
.auth form { display: grid; gap: 14px; padding: 8px 24px 24px; }
.auth .tabs-h { padding: 18px 24px 0; margin: 0; }
.auth .err { color: var(--red); min-height: 22px; font: 600 20px/1.2 var(--hand); margin: 0; }
.auth .note { margin: 0; font: 500 19px/1.25 var(--hand); color: var(--pencil); }
.auth .x { position: absolute; right: 12px; top: 10px; font: 700 30px/1 var(--hand); color: var(--pencil); padding: 4px 8px; }
.menu { position: fixed; right: 16px; top: 70px; z-index: 45; background: #fff59d; min-width: 210px; padding: 12px; box-shadow: 0 10px 24px rgba(30, 40, 80, .3); transform: rotate(1deg); }
.menu p { margin: 0 6px 8px; font: 500 19px/1.2 var(--hand); color: var(--pencil); }
.menu button, .menu a { display: block; width: 100%; text-align: left; padding: 6px; font: 700 23px/1 var(--hand); text-decoration: none; }
.menu button:hover, .menu a:hover { color: var(--red); }
.toasts { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(92vw, 460px); }
.toasts div { background: #fff59d; padding: 10px 16px 12px; font: 700 23px/1.2 var(--hand); box-shadow: 0 8px 20px rgba(30, 40, 80, .25); animation: tin .2s; transform: rotate(-1deg); }
.toasts div.good { background: #d3f5cc; } .toasts div.bad { background: #ffd1d6; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.foot { max-width: 1080px; margin: 0 auto; padding: 10px 22px 40px 64px; font-size: 14px; color: var(--pencil); }
.foot p { margin: 0 0 6px; }
.foot b { font: 700 22px/1 var(--hand); color: var(--ink); }
.foot a { color: var(--ink-2); }
.foot-note { font-size: 13px; }

/* ---------- адаптив ---------- */
@media (max-width: 920px) {
  .glayout, .split, .profile, .cover { grid-template-columns: minmax(0, 1fr); }
  .controls { position: static; transform: none; }
  .cover-side { display: none; }
}
@media (max-width: 640px) {
  .top { gap: 8px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 4px; }
  .brand-t { display: none; }
  .nav { order: 3; width: 100%; justify-content: space-between; }
  .nav a { font-size: 22px; padding: 4px 6px; }
  .hud { gap: 8px; }
  .stip { font-size: 18px; padding: 6px 9px; }
  .stip .w { display: none; }
  .balance { min-width: 0; padding: 3px 9px 5px; }
  .balance > span { font-size: 23px; }
  .who { font-size: 20px; max-width: 90px; }
  main { padding: 18px 12px 30px 30px; }
  main::before { left: 18px; }
  .foot { padding: 10px 12px 90px 30px; }
  .label { padding: 16px 16px 16px; margin: 8px 6px; }
  .label .t2 { font-size: 54px; }
  .stage { padding: 12px; min-height: 0; }
  .reel { --cell: 84px; }
  .sym { padding: 8px; }
  .machine { padding: 10px; }
  .machine::after { display: none; }
  .rt { grid-template-rows: repeat(3, 38px) 34px 34px; }
  .rt button { font-size: 19px; }
  .rt button.out { font-size: 15px; }
  .pcard { width: 70px; height: 100px; }
  .hand .pcard + .pcard { margin-left: -28px; }
  .sky canvas { height: 280px; }
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .game { min-height: 180px; }
  .game .pic { height: 84px; }
  .game b { font-size: 24px; }
  .kgrid { grid-template-columns: repeat(8, 1fr); gap: 3px; }
  .kt { font-size: 19px; }
  .floor { grid-template-columns: 34px 1fr 54px; gap: 4px; }
  .door { width: 44px; height: 62px; }
  .ghead .odds { display: none; }
  .h-sec h2 { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
#diff { display: grid; grid-template-columns: 1fr 1fr; }

/* скрытое поле-ловушка для ботов */
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
/* подслушано */
.post .rep { margin-left: auto; font: 500 16px/1 var(--hand); color: var(--pencil-2); border: 0; background: none; }
.post .rep:hover { color: var(--red); }
.post .nick { font-weight: 700; color: var(--ink); }
.psl-form textarea { min-height: 120px; }
.chk { display: flex; gap: 8px; align-items: center; font: 600 21px/1.1 var(--hand); }
.chk input { width: 18px; height: 18px; accent-color: var(--ink); }

/* живые столы */
.live-status { font: 600 26px/1.2 var(--hand); margin-bottom: 10px; min-height: 32px; }
.chipmark.draft { background: var(--paper-w); border-style: dashed; }
.others { position: absolute; left: 2px; bottom: 1px; font: 600 14px/1 var(--hand); color: var(--pencil); }
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.tbl { display: grid; gap: 6px; align-content: start; }
.tbl h3 { font-size: 32px; }
.tbl .tn { font-size: 19px; min-height: 22px; overflow-wrap: anywhere; }
.tbl .btn { justify-self: start; }
.bjt { min-height: 0; }
.seats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.seat { border: 2px solid var(--cell); border-radius: var(--wob); padding: 8px 6px; min-height: 160px; display: grid; align-content: start; gap: 4px; background: var(--paper-w); }
.seat.me { border-color: var(--ink); background: #fffbe0; }
.seat.turn { border-color: var(--red); box-shadow: 0 0 0 3px rgba(212, 42, 60, .15); }
.seat .sn { font: 700 20px/1.1 var(--hand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .sn a { text-decoration: none; }
.seat .ss, .seat .sr { font: 600 18px/1.15 var(--hand); }
.seat .sr { min-height: 20px; }
.hand.mini { min-height: 64px; margin: 2px 0; padding: 0; }
.hand.mini .pcard { width: 40px; height: 58px; font-size: 15px; border-radius: 4px; }
.hand.mini .pcard + .pcard { margin-left: -22px; }
.hand.mini .pcard .suit { width: 9px; height: 9px; }
.hand.mini .pcard .pc-mid .suit { width: 18px; height: 18px; }
.hand.mini .pc-flip { display: none; }
.empty-seat { place-content: center; text-align: center; color: var(--pencil-2); font-size: 20px; border-style: dashed; }
@media (max-width: 640px) {
  .seats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seat { min-height: 130px; }
  .tables { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* рулетка: ставки между числами */
.rt { position: relative; }
.rt-ov { grid-column: 2 / 14; grid-row: 1 / 4; position: relative; pointer-events: none; z-index: 3; }
.rt .hs { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border: 0; border-radius: 50%; pointer-events: auto; background: transparent; }
.rt .hs:hover, .rt .hs:focus-visible { background: rgba(212, 42, 60, .22); box-shadow: inset 0 0 0 2px var(--red); outline: none; }
.rt .hs.won { background: var(--green); box-shadow: 0 0 0 3px rgba(27, 138, 75, .3); }
.rt .hs .chipmark { left: 50%; top: 50%; right: auto; transform: translate(-50%, -50%); min-width: 22px; height: 22px; font-size: 14px; z-index: 5; }
.rt .hs .others { display: none; }
.rt button.rl-cover { background: rgba(255, 228, 92, .6); }
@media (max-width: 640px) { .rt .hs { width: 14px; height: 14px; margin: -7px 0 0 -7px; } .rt .hs .chipmark { min-width: 18px; height: 18px; font-size: 12px; } }
