Загрузка данных


/* ---------- ПЕРЕМЕННЫЕ ---------- */
:root {
    --bg: #110e0c;
    --surface: rgba(255, 240, 220, 0.04);
    --surface-2: rgba(255, 240, 220, 0.08);
    --line: rgba(255, 236, 210, 0.09);
    --line-strong: rgba(255, 236, 210, 0.18);
    --text: #f4ede3;
    --muted: #a69c90;
    --gold: #e8b04b;
    --gold-2: #f3cf7e;
    --clay: #d9826b;
    --sage: #8fbf8a;
    --danger: #e5664e;
    --ivory: #f7f0e4;
    --radius: 22px;
    --ease: cubic-bezier(.22, 1, .36, 1);
    --font: 'Manrope', system-ui, sans-serif;
    --display: 'Unbounded', 'Manrope', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }

/* ---------- ФОН ---------- */
.bg {
    position: fixed; inset: 0; z-index: -1; overflow: hidden;
    background: radial-gradient(1200px 700px at 50% -10%, #2a1f17 0%, var(--bg) 60%);
}
.blob {
    position: absolute; border-radius: 50%;
    filter: blur(90px); opacity: .32;
    animation: float 22s var(--ease) infinite alternate;
}
.b1 { width: 520px; height: 520px; background: #b8742a; top: -160px; left: -120px; }
.b2 { width: 460px; height: 460px; background: #8a3f2c; bottom: -180px; right: -100px; animation-delay: -6s; }
.b3 { width: 360px; height: 360px; background: #4d5a3a; top: 40%; left: 55%; opacity: .2; animation-delay: -12s; }
@keyframes float { to { transform: translate(60px, 40px) scale(1.12); } }

.grain {
    position: absolute; inset: -50%; opacity: .07;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 8s steps(6) infinite;
}
@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-3%, 2%); }
    40% { transform: translate(2%, -3%); }
    60% { transform: translate(-2%, -1%); }
    80% { transform: translate(3%, 3%); }
}

/* ---------- КАРКАС ---------- */
.app {
    width: 100%; max-width: 1040px; margin: 0 auto;
    padding: 28px 20px 40px;
    display: flex; flex-direction: column; gap: 22px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 245, 230, .05);
}
.reveal { animation: rise .8s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.top {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    animation: rise .8s var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
    width: 52px; height: 52px; border-radius: 16px;
    display: grid; place-items: center; font-size: 1.5rem; color: #1f160a;
    background: linear-gradient(145deg, var(--gold-2), var(--gold));
    box-shadow: 0 10px 30px -8px rgba(232, 176, 75, .55);
    animation: wobble 6s ease-in-out infinite;
}
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
h1 {
    font-family: var(--display); font-weight: 900;
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    letter-spacing: -.02em; line-height: 1.1;
}
.subtitle { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.top-actions { display: flex; gap: 8px; }

.icon-btn {
    width: 44px; height: 44px; border-radius: 14px;
    border: 1px solid var(--line); background: var(--surface);
    cursor: pointer; display: grid; place-items: center;
    transition: .25s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); transform: translateY(-2px); }

/* ---------- АВТОРИЗАЦИЯ ---------- */
.auth { max-width: 420px; width: 100%; margin: 4vh auto 0; padding: 34px; }
.auth h2 { font-family: var(--display); font-size: 1.4rem; margin-bottom: 6px; }
.auth > .muted { margin-bottom: 24px; font-size: .92rem; }
.field { display: block; margin-bottom: 16px; }
.field > span {
    display: block; font-size: .72rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 8px;
}
.field-box { position: relative; display: flex; align-items: center; }
.field-box > i { position: absolute; left: 16px; color: var(--muted); transition: color .25s; }
.field-box input {
    width: 100%; padding: 15px 46px;
    border-radius: 14px; border: 1px solid var(--line);
    background: rgba(0, 0, 0, .25); outline: none;
    transition: .25s var(--ease);
}
.field-box input::placeholder { color: #6f665c; }
.field-box input:focus {
    border-color: var(--gold);
    background: rgba(0, 0, 0, .35);
    box-shadow: 0 0 0 4px rgba(232, 176, 75, .12);
}
.field-box:focus-within > i { color: var(--gold); }
.eye { position: absolute; right: 8px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 8px; }
.eye:hover { color: var(--text); }
.hint { margin-top: 18px; font-size: .8rem; color: var(--muted); line-height: 1.5; display: flex; gap: 8px; }
.hint i { color: var(--sage); margin-top: 3px; }

/* ---------- КНОПКИ ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 15px 26px; border-radius: 16px; border: 1px solid transparent;
    font-weight: 700; font-size: .95rem; cursor: pointer;
    position: relative; overflow: hidden; user-select: none;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s, border-color .25s, opacity .25s, color .25s;
}
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn:not(:disabled):active { transform: translateY(0) scale(.97); }
.btn.wide { width: 100%; margin-top: 6px; }

.btn-gold {
    background: linear-gradient(180deg, var(--gold-2), var(--gold));
    color: #1f160a;
    box-shadow: 0 12px 28px -10px rgba(232, 176, 75, .6);
}
.btn-gold::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
    transform: translateX(-120%); transition: transform .8s var(--ease);
}
.btn-gold:not(:disabled):hover::after { transform: translateX(120%); }
.btn-outline { background: var(--surface); border-color: var(--line-strong); }
.btn-outline:not(:disabled):hover { background: var(--surface-2); border-color: var(--gold); }
.btn-sage {
    background: linear-gradient(180deg, #a9d3a3, var(--sage));
    color: #13200f;
    box-shadow: 0 12px 28px -10px rgba(143, 191, 138, .5);
    animation: pop .5s var(--ease) both;
}
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); padding: 11px 16px; }
.btn-ghost:hover { color: var(--danger); border-color: rgba(229, 102, 78, .4); }
.btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }

kbd {
    font-family: var(--font); font-size: .66rem;
    padding: 3px 7px; border-radius: 6px;
    background: rgba(0, 0, 0, .15); border: 1px solid rgba(0, 0, 0, .12);
    opacity: .8;
}
.btn-outline kbd { background: rgba(255, 255, 255, .06); border-color: var(--line); }

/* ---------- ВЕРХНЯЯ ПАНЕЛЬ ---------- */
#game-screen { display: flex; flex-direction: column; gap: 20px; }
#game-screen > * { animation: rise .7s var(--ease) both; }
#game-screen > *:nth-child(2) { animation-delay: .08s; }
#game-screen > *:nth-child(3) { animation-delay: .16s; }
#game-screen > *:nth-child(4) { animation-delay: .22s; }
#game-screen > *:nth-child(5) { animation-delay: .28s; }

.bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 14px 18px; flex-wrap: wrap;
}
.user { display: flex; align-items: center; gap: 12px; }
.user strong { display: block; font-size: 1.05rem; }
.avatar {
    width: 44px; height: 44px; border-radius: 14px;
    display: grid; place-items: center;
    font-family: var(--display); font-weight: 700; color: #1f160a;
    background: var(--gold);
}
.stats { display: flex; gap: 28px; }
.stat { text-align: center; }
.stat-val { display: block; font-family: var(--display); font-weight: 700; font-size: 1.4rem; color: var(--gold); }
.stat-val.clay { color: var(--clay); }
.stat-val.sage { color: var(--sage); }
.stat-lbl { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- ИГРОВОЙ СТОЛ ---------- */
.table { display: grid; grid-template-columns: 1fr 220px 1fr; gap: 20px; align-items: stretch; }

.zone {
    padding: 24px; display: flex; flex-direction: column; gap: 14px;
    position: relative; overflow: hidden;
    transition: transform .5s var(--ease), border-color .5s, box-shadow .5s;
}
.zone::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit;
    opacity: 0; transition: opacity .5s; pointer-events: none;
}
.zone.player::before { background: radial-gradient(400px 200px at 20% 0%, rgba(232, 176, 75, .14), transparent); }
.zone.computer::before { background: radial-gradient(400px 200px at 80% 0%, rgba(217, 130, 107, .14), transparent); }
.zone.active::before { opacity: 1; }
.zone.active { transform: translateY(-4px); }
.zone.player.active { border-color: rgba(232, 176, 75, .45); }
.zone.computer.active { border-color: rgba(217, 130, 107, .45); }
.zone.winner {
    border-color: var(--sage) !important;
    box-shadow: 0 0 0 1px var(--sage), 0 20px 50px -20px rgba(143, 191, 138, .35);
}

.zone-head { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.player .zone-head i { color: var(--gold); }
.computer .zone-head i { color: var(--clay); }
.turn-pill {
    margin-left: auto; font-size: .66rem; text-transform: uppercase; letter-spacing: .08em;
    padding: 4px 10px; border-radius: 99px;
    opacity: 0; transform: scale(.8); transition: .3s var(--ease);
}
.zone.active .turn-pill { opacity: 1; transform: none; }
.player .turn-pill { background: rgba(232, 176, 75, .15); color: var(--gold); }
.computer .turn-pill { background: rgba(217, 130, 107, .15); color: var(--clay); }
.computer.active .turn-pill { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.sum {
    font-family: var(--display); font-weight: 900;
    font-size: 4rem; line-height: 1; letter-spacing: -.03em;
    transition: color .3s;
}
.sum.bump { animation: bump .5s var(--ease); }
@keyframes bump { 30% { transform: scale(1.18); } }
.sum.warn { color: var(--gold); }
.sum.bust { color: var(--danger); }

.meter { position: relative; height: 8px; border-radius: 99px; background: rgba(0, 0, 0, .3); }
.meter-fill {
    height: 100%; width: 0; border-radius: inherit;
    background: var(--sage);
    transition: width .6s var(--ease), background .4s;
}
.meter-fill.warn { background: var(--gold); }
.meter-fill.bust { background: var(--danger); }
.meter-limit {
    position: absolute; top: -4px; bottom: -4px; left: calc(100% * 11 / 12);
    width: 2px; border-radius: 2px; background: var(--danger); opacity: .7;
}

.chips { display: flex; gap: 8px; min-height: 42px; align-items: center; flex-wrap: wrap; }
.chip {
    width: 40px; height: 40px; border-radius: 11px;
    background: var(--ivory); color: #1c1814;
    display: grid; place-items: center;
    font-family: var(--display); font-weight: 700; font-size: 1.05rem;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), 0 6px 14px -6px rgba(0, 0, 0, .6);
    animation: chipIn .5s var(--ease) both;
}
@keyframes chipIn { from { opacity: 0; transform: translateY(-14px) rotate(-25deg) scale(.6); } }
.chip-empty { font-size: .85rem; color: var(--muted); }
.attempts { font-size: .85rem; color: var(--muted); }
.attempts b { color: var(--text); }

.shake { animation: shake .5s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-7px); }
    40%, 60% { transform: translateX(7px); }
}

/* ---------- 3D КУБИК ---------- */
.dice-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.dice-box { position: relative; width: 170px; height: 170px; display: grid; place-items: center; perspective: 700px; }
.dice-box::before {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    background: radial-gradient(rgba(232, 176, 75, .16), transparent 65%);
}
.dice-shadow {
    position: absolute; bottom: 18px; left: 50%;
    width: 90px; height: 16px; margin-left: -45px; border-radius: 50%;
    background: radial-gradient(rgba(0, 0, 0, .55), transparent 70%);
    filter: blur(2px);
}
.dice-hop { transform-style: preserve-3d; animation: idle 4s ease-in-out infinite; }
@keyframes idle { 50% { transform: translateY(-6px); } }
.dice-box.rolling .dice-hop { animation: hop 1s var(--ease); }
.dice-box.rolling .dice-shadow { animation: shadow 1s var(--ease); }
@keyframes hop {
    25% { transform: translateY(-50px); }
    55% { transform: translateY(0); }
    72% { transform: translateY(-12px); }
    100% { transform: translateY(0); }
}
@keyframes shadow {
    25% { transform: scale(.55); opacity: .4; }
    55% { transform: scale(1); opacity: 1; }
    72% { transform: scale(.85); }
}

.dice-wrap { width: 84px; height: 84px; transform-style: preserve-3d; transform: rotateX(-20deg) rotateY(24deg); }
.cube {
    width: 100%; height: 100%; position: relative;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(.2, .9, .25, 1.05);
}
.face {
    position: absolute; inset: 0; border-radius: 18px;
    background: radial-gradient(circle at 30% 25%, #fffaf1, var(--ivory) 55%, #e3d7c3);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), inset 0 -6px 14px rgba(120, 90, 50, .18);
    display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    padding: 14px; backface-visibility: hidden;
}
.face span { width: 14px; height: 14px; margin: auto; border-radius: 50%; }
.face span.pip {
    background: radial-gradient(circle at 35% 30%, #4a3f35, #1a1512);
    box-shadow: inset 0 2px 3px rgba(0, 0, 0, .6);
}
.f1 span.pip { width: 20px; height: 20px; background: radial-gradient(circle at 35% 30%, #e0654a, #9c2e1d); }
.f1 { transform: rotateY(0deg) translateZ(42px); }
.f6 { transform: rotateY(180deg) translateZ(42px); }
.f2 { transform: rotateY(90deg) translateZ(42px); }
.f5 { transform: rotateY(-90deg) translateZ(42px); }
.f3 { transform: rotateX(90deg) translateZ(42px); }
.f4 { transform: rotateX(-90deg) translateZ(42px); }

.round-num { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.round-num b { color: var(--text); font-family: var(--display); }

/* ---------- УПРАВЛЕНИЕ И ЖУРНАЛ ---------- */
.controls { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.controls .btn { min-width: 190px; }

.log {
    padding: 18px 22px; min-height: 68px;
    display: flex; align-items: center; justify-content: center; text-align: center;
    border-left: 3px solid var(--gold);
    transition: border-color .4s;
}
.log p { font-size: 1rem; line-height: 1.45; animation: rise .45s var(--ease) both; }
.log.win { border-left-color: var(--sage); }
.log.lose { border-left-color: var(--danger); }
.system-msg { color: var(--muted); }
.win-msg { color: var(--sage); font-weight: 700; }
.lose-msg { color: var(--danger); font-weight: 700; }
.draw-msg { color: var(--gold); font-weight: 700; }

/* ---------- ИСТОРИЯ И ЛИДЕРЫ ---------- */
.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { padding: 20px 22px; }
.panel h3 {
    font-size: .76rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 14px;
    display: flex; gap: 8px; align-items: center;
}
.panel h3 i { color: var(--gold); }
.history, .leaders { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.history li, .leaders li {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border-radius: 12px;
    background: rgba(0, 0, 0, .18); font-size: .88rem;
    animation: rise .4s var(--ease) both;
}
.history li.empty, .leaders li.empty { background: none; padding: 0; color: var(--muted); }
.tag { font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px; border-radius: 8px; }
.tag.win { background: rgba(143, 191, 138, .15); color: var(--sage); }
.tag.lose { background: rgba(229, 102, 78, .15); color: var(--danger); }
.tag.draw { background: rgba(232, 176, 75, .15); color: var(--gold); }
.score-mini { font-family: var(--display); font-size: .85rem; }
.leaders .rank {
    width: 26px; height: 26px; border-radius: 8px;
    display: grid; place-items: center;
    background: var(--surface-2); font-weight: 800; font-size: .75rem;
}
.leaders li:first-child .rank { background: var(--gold); color: #1f160a; }
.leaders .name { flex: 1; }
.leaders li.me { outline: 1px solid rgba(232, 176, 75, .35); }

footer { text-align: center; color: #6f665c; font-size: .78rem; }

/* ---------- МОДАЛКА И ТОСТЫ ---------- */
.modal {
    position: fixed; inset: 0; z-index: 50;
    display: grid; place-items: center; padding: 20px;
    background: rgba(10, 8, 6, .6);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    animation: fade .3s both;
}
.modal-card { max-width: 440px; width: 100%; padding: 30px; position: relative; background: #1b1612; animation: pop .45s var(--ease) both; }
.modal-card h2 { font-family: var(--display); margin-bottom: 16px; }
.close { position: absolute; top: 14px; right: 14px; }
.rules { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; line-height: 1.5; }
.rules li::marker { color: var(--gold); font-weight: 800; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.96); } }

.toasts {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 60; display: flex; flex-direction: column; gap: 10px; align-items: center;
    pointer-events: none;
}
.toast {
    display: flex; gap: 10px; align-items: center;
    padding: 12px 18px; border-radius: 14px;
    background: #231c17; border: 1px solid var(--line-strong);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .7);
    font-size: .9rem; font-weight: 600; white-space: nowrap;
    animation: toastIn .45s var(--ease) both;
}
.toast.out { animation: toastOut .35s ease forwards; }
.toast.error i { color: var(--danger); }
.toast.success i { color: var(--sage); }
.toast.info i { color: var(--gold); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- АДАПТИВ ---------- */
@media (max-width: 820px) {
    .table { grid-template-columns: 1fr 1fr; grid-template-areas: "dice dice" "p c"; }
    .dice-stage { grid-area: dice; }
    #player-zone { grid-area: p; }
    #computer-zone { grid-area: c; }
    .bottom-grid { grid-template-columns: 1fr; }
    .sum { font-size: 3rem; }
    .stats { order: 3; width: 100%; justify-content: space-around; }
}
@media (max-width: 520px) {
    .app { padding: 18px 14px 30px; }
    .zone { padding: 16px; }
    .sum { font-size: 2.4rem; }
    .chip { width: 32px; height: 32px; font-size: .9rem; }
    .controls .btn { min-width: 0; flex: 1; }
    kbd, .subtitle, .btn-ghost span { display: none; }
    .auth { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}