/* denbet.ru — оформление. Сначала телефон, потом всё остальное. */

:root {
    --bg:        #0c0e12;
    --surface:   #14181f;
    --surface-2: #1c212a;
    --surface-3: #242a35;
    --line:      #2b323e;
    --text:      #e9edf4;
    --muted:     #8d96a8;
    --dim:       #98a2b3;

    --accent:    #cdf94a;
    --accent-d:  #a5c92e;
    --up:        #4ade80;
    --down:      #f87171;
    --warn:      #fbbf24;
    --info:      #60a5fa;

    --radius:    12px;
    --radius-s:  8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 12px calc(40px + env(safe-area-inset-bottom));
}

/* --------------------------------------------------------------- шапка */

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 2px 10px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 26px; line-height: 1; }
.brand-text {
    display: flex; flex-direction: column; line-height: 1.15;
    font-weight: 800; letter-spacing: .06em; font-size: 18px;
}
.brand-text small {
    font-weight: 500; font-size: 11px; letter-spacing: .02em;
    color: var(--muted); margin-top: 2px;
}

.top-right { display: flex; align-items: center; gap: 8px; }

.who {
    font-size: 13px; color: var(--muted);
    max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.chip {
    display: inline-block; padding: 4px 10px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line);
    font-size: 12px; color: var(--muted);
}
.chip:hover { text-decoration: none; border-color: var(--dim); color: var(--text); }
.chip-admin { color: var(--accent); border-color: #3d4a1f; background: #1c2211; }

/* ---------------------------------------------------------------- табы */

.tabs {
    display: flex; gap: 4px; margin: 6px 0 16px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 4px;
}
.tab {
    flex: 1; text-align: center; padding: 9px 6px; border-radius: var(--radius-s);
    font-size: 14px; font-weight: 600; color: var(--muted);
}
.tab:hover { text-decoration: none; color: var(--text); }
.tab.is-on { background: var(--surface-3); color: var(--text); }

/* -------------------------------------------------------------- плашки */

.flash {
    padding: 11px 13px; border-radius: var(--radius-s); margin: 0 0 14px;
    font-size: 14px; border: 1px solid var(--line); background: var(--surface-2);
}
.flash-ok  { border-color: #245c39; background: #10251a; color: #b9f6cf; }
.flash-err { border-color: #6b2b2b; background: #261414; color: #ffc9c9; }
.flash-info{ border-color: #2b4a6b; background: #101c26; color: #cbe4ff; }

.banner {
    padding: 11px 13px; border-radius: var(--radius-s); margin: 0 0 12px;
    font-size: 14px;
}
.banner-stop { background: #2a1a10; border: 1px solid #6b4423; color: #ffd9b0; }

/* ------------------------------------------------------------ разделы */

.cat { margin: 0 0 22px; }
.cat-h {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 4px 10px; margin: 0 0 9px; padding: 0 2px;
    /* На узком экране подпись раздела уезжает под заголовок, а не обрезается. */
    flex-wrap: wrap;
}
.cat-h h2 { font-size: 15px; margin: 0; letter-spacing: .01em; }
.cat-h small { font-size: 12px; color: var(--dim); font-weight: 400; }

/* -------------------------------------------------------------- рынок */

.mk {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px; margin-bottom: 8px;
}
.mk-closed { opacity: .62; }

.mk-h {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 8px; margin-bottom: 10px;
}
.mk-t { font-size: 14px; font-weight: 600; line-height: 1.35; }
.mk-note { font-size: 12px; color: var(--warn); margin-top: 3px; }
.mk-sub { font-size: 11px; color: var(--dim); margin-top: 3px; }

.pill {
    flex: none; font-size: 11px; padding: 3px 8px; border-radius: 999px;
    background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.pill-done   { background: #14261a; color: #86efac; }
.pill-void   { background: #23262c; color: var(--muted); }
.pill-closed { background: #2a2015; color: #fbbf24; }

/* ------------------------------------------------------------- исходы */

.ocs { display: grid; gap: 6px; grid-template-columns: 1fr 1fr; }
.ocs-1 { grid-template-columns: 1fr; }
.ocs-3 { grid-template-columns: 1fr 1fr 1fr; }
/* На узком экране три кнопки в ряд оставляют под имя ~30px, и «Группа 3»
   превращается в «Гр…». Лучше в столбик. */
@media (max-width: 430px) {
    .ocs-3 { grid-template-columns: 1fr; }
}

.oc {
    display: flex; align-items: center; justify-content: space-between;
    gap: 6px; width: 100%;
    /* Без min-width:0 колонка грида раздувается под длинное имя игрока,
       и на узком экране появляется горизонтальная прокрутка. */
    min-width: 0;
    padding: 10px 11px; border-radius: var(--radius-s);
    background: var(--surface-2); border: 1px solid var(--line);
    color: var(--text); font: inherit; font-size: 13px; text-align: left;
    cursor: pointer; -webkit-appearance: none; appearance: none;
    transition: background .12s, border-color .12s;
}
.oc:hover:not(:disabled) { background: var(--surface-3); border-color: var(--dim); text-decoration: none; }
.oc:active:not(:disabled) { transform: translateY(1px); }
.oc:disabled { cursor: default; opacity: .55; }

.oc-name {
    /* min-width:0 обязателен: флекс-элемент с overflow:hidden всё равно
       не сжимается ниже ширины своего текста, пока это не разрешить явно. */
    min-width: 0; flex: 1 1 auto;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--muted);
}
.oc-odds {
    flex: none; font-variant-numeric: tabular-nums; font-weight: 700;
    font-size: 15px; color: var(--accent);
}
.oc-win  { border-color: #3d7a52; background: #12251a; }
.oc-win .oc-odds { color: #86efac; }
.oc-lost { opacity: .5; }
.oc-mine { border-color: #4a5a1f; }

.drift {
    display: inline-block; font-size: 10px; font-weight: 700;
    margin-left: 4px; vertical-align: 1px;
}
.drift-up   { color: var(--up); }
.drift-down { color: var(--down); }

/* Вспышка при изменении цены — видно, что линия ожила. */
@keyframes pulse-up   { from { background: #16351f; } to { background: var(--surface-2); } }
@keyframes pulse-down { from { background: #351616; } to { background: var(--surface-2); } }
.oc.flash-up   { animation: pulse-up .9s ease-out; }
.oc.flash-down { animation: pulse-down .9s ease-out; }

/* ------------------------------------------------------- полоска денег */

.bar {
    display: flex; height: 3px; margin-top: 9px; border-radius: 2px;
    overflow: hidden; background: var(--surface-3);
}
.bar-seg { display: block; height: 100%; }
.bar-0 { background: #6b8f2a; }
.bar-1 { background: #3f5e8f; }
.bar-2 { background: #8f6b3f; }

.mk-money {
    display: flex; justify-content: space-between; gap: 8px;
    margin-top: 6px; font-size: 11px; color: var(--dim);
}

/* -------------------------------------------------------- стадии-табы */

.stages {
    display: flex; gap: 5px; overflow-x: auto; margin: 0 0 10px;
    padding-bottom: 3px; -webkit-overflow-scrolling: touch;
}
.stage-tab {
    /* 9px по вертикали дают ~40px высоты: попасть пальцем на ходу в боулинге. */
    flex: none; padding: 9px 14px; border-radius: 999px; font-size: 13px;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.stage-tab:hover { text-decoration: none; color: var(--text); }
.stage-tab.is-on { background: var(--accent); border-color: var(--accent); color: #14180a; font-weight: 600; }

/* --------------------------------------------------------------- форма */

.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card h2 { font-size: 16px; margin: 0 0 10px; }
.card h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); }
.card p  { margin: 0 0 10px; font-size: 14px; color: var(--muted); }

label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 5px; }

input[type=text], input[type=password], input[type=number], input[type=search],
textarea, select {
    width: 100%; padding: 11px 12px; font: inherit; font-size: 16px;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: var(--radius-s); color: var(--text);
    -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent-d);
}
textarea { min-height: 70px; resize: vertical; }
select {
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.field { margin-bottom: 12px; }
.field-hint { font-size: 12px; color: var(--dim); margin-top: 4px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

.btn {
    display: inline-block; padding: 12px 18px; border-radius: var(--radius-s);
    background: var(--accent); color: #14180a; border: 1px solid var(--accent);
    font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
    text-align: center; -webkit-appearance: none; appearance: none;
}
.btn:hover { background: var(--accent-d); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-wide { display: block; width: 100%; }
.btn-2 {
    background: var(--surface-2); border-color: var(--line); color: var(--text);
    font-weight: 600;
}
.btn-2:hover { background: var(--surface-3); }
.btn-danger { background: #3b1717; border-color: #6b2b2b; color: #ffc9c9; }
.btn-danger:hover { background: #4d1d1d; }
.btn-s { padding: 7px 11px; font-size: 13px; }

/* --------------------------------------------------------------- купон */

.slip-back {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .72);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 50; padding: 0;
}
.slip {
    width: 100%; max-width: 480px; background: var(--surface);
    border: 1px solid var(--line); border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    max-height: 92vh; overflow-y: auto;
}
@media (min-width: 560px) {
    .slip-back { align-items: center; padding: 20px; }
    .slip { border-bottom: 1px solid var(--line); border-radius: var(--radius); }
}

.slip-h { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.slip-h h3 { margin: 0; font-size: 15px; }
.slip-close {
    flex: none; background: none; border: none; color: var(--muted);
    font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.slip-mk { font-size: 12px; color: var(--dim); margin-bottom: 14px; }

.slip-odds {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-s);
    margin-bottom: 14px;
}
.slip-odds b { font-size: 26px; color: var(--accent); font-variant-numeric: tabular-nums; }
.slip-odds span { font-size: 12px; color: var(--muted); }

/* Быстрые суммы и «копировать» работают только со скриптом, поэтому
   показываются лишь когда он загрузился и поставил класс на <html>. */
.quick, .copy { display: none; }
.has-js .quick { display: flex; }
.has-js .copy { display: inline-block; }
.quick { gap: 6px; margin: 8px 0 0; flex-wrap: wrap; }
.quick button {
    flex: 1 1 0; min-width: 60px; padding: 9px 4px; font: inherit; font-size: 13px;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: var(--radius-s); color: var(--muted); cursor: pointer;
}
.quick button:hover { background: var(--surface-3); color: var(--text); }

.slip-sum {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 12px 0; margin: 12px 0; font-size: 14px;
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.slip-sum b { font-size: 19px; color: var(--up); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- таблицы */

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
    text-align: left; font-weight: 600; color: var(--dim); font-size: 11px;
    text-transform: uppercase; letter-spacing: .04em;
    padding: 0 8px 7px; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --------------------------------------------------------------- ставки */

.bet {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px; margin-bottom: 8px;
}
.bet-h { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.bet-t { font-size: 14px; font-weight: 600; line-height: 1.3; }
.bet-m { font-size: 12px; color: var(--dim); margin-top: 2px; }
.bet-row {
    display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px;
    color: var(--muted); margin-top: 8px;
}
.bet-row b { color: var(--text); font-variant-numeric: tabular-nums; }

.st { flex: none; font-size: 11px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st-wait  { background: #2a2015; color: #fbbf24; }
.st-live  { background: #10251a; color: #86efac; }
.st-win   { background: #14361f; color: #4ade80; font-weight: 700; }
.st-lose  { background: #2b1717; color: #f87171; }
.st-muted { background: var(--surface-3); color: var(--muted); }

.pay {
    margin-top: 10px; padding: 11px; border-radius: var(--radius-s);
    background: #1e1708; border: 1px solid #4d3a11; font-size: 13px;
}
.pay-code {
    display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 15px; font-weight: 700; letter-spacing: .08em; color: var(--warn);
    background: #2b2110; padding: 3px 9px; border-radius: 6px;
}
.pay-card {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 16px; letter-spacing: .05em; color: var(--text);
}
.copy {
    background: none; border: 1px solid var(--line); color: var(--muted);
    border-radius: 6px; padding: 8px 12px; font: inherit; font-size: 12px;
    line-height: 1.2; min-height: 36px; cursor: pointer;
    margin-left: 6px; vertical-align: middle;
}
.copy:hover { color: var(--text); border-color: var(--dim); }

/* --------------------------------------------------------------- табло */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
@media (min-width: 520px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px;
}
.stat-v { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-l { font-size: 11px; color: var(--dim); margin-top: 4px; }
.v-plus  { color: var(--up); }
.v-minus { color: var(--down); }

/* --------------------------------------------------------------- прочее */

.empty { text-align: center; color: var(--dim); padding: 34px 16px; font-size: 14px; }

.foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.foot p { font-size: 12px; color: var(--dim); margin: 0 0 6px; line-height: 1.55; }
.foot-dim { color: #7b8595 !important; }

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.mt { margin-top: 14px; }
.mb0 { margin-bottom: 0; }
.center { text-align: center; }

.live-dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: var(--up); margin-right: 5px; vertical-align: middle;
}
.is-stale .live-dot { background: var(--dim); }

hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

details summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 6px 0; }
details summary:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
