/* NEXTIME WebApp — тёмная тема, золото, мистика */

:root {
    --bg:        #0a0a0f;
    --bg-2:      #14141c;
    --bg-3:      #1e1e28;
    --gold:      #c9a227;
    --gold-soft: #e0b940;
    --text:      #e8e8ec;
    --text-dim:  #8a8a96;
    --danger:    #d94b4b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    overflow: hidden;
    overscroll-behavior: none;
}

.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    height: 100vh;
}

.screen.active {
    display: flex;
}

/* ─── Header ─────────────────────────────── */
.header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(201, 162, 39, 0.15);
    flex-shrink: 0;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--gold);
    text-transform: uppercase;
}

.hash {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 10px;
    color: var(--text-dim);
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hint {
    font-size: 12px;
    color: var(--text-dim);
}

/* ─── Инструкция ────────────────────────── */
.instruction {
    padding: 14px 20px;
    font-size: 15px;
    color: var(--gold-soft);
    text-align: center;
    font-weight: 500;
    flex-shrink: 0;
}

/* ─── Сетка колоды ──────────────────────── */
.deck {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    padding: 8px 16px;
    overflow-y: auto;
    align-content: start;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 500px) {
    .deck { grid-template-columns: repeat(8, 1fr); }
}

@media (min-width: 700px) {
    .deck { grid-template-columns: repeat(10, 1fr); }
}

.deck-card {
    aspect-ratio: 2 / 3;
    background: url('/assets/back.svg') center/cover no-repeat;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    position: relative;
    border: 1px solid rgba(201, 162, 39, 0.2);
}

.deck-card:active {
    transform: scale(0.92);
}

.deck-card.selected {
    box-shadow: 0 0 0 2px var(--gold),
                0 0 12px rgba(201, 162, 39, 0.5);
    transform: translateY(-3px);
}

.deck-card.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ─── Footer ─────────────────────────────── */
.footer {
    padding: 14px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    background: linear-gradient(180deg, transparent, var(--bg) 30%);
}

.counter, .progress {
    text-align: center;
    font-size: 14px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.counter span, .progress span {
    color: var(--gold);
    font-weight: 700;
}

.btn-primary {
    padding: 16px;
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    color: #0a0a0f;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    letter-spacing: 0.5px;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ─── Экран переворота ──────────────────── */
.flip-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    perspective: 1200px;
}

.flip-card {
    width: 90px;
    height: 135px;
    cursor: pointer;
    position: relative;
}

@media (min-width: 500px) {
    .flip-card { width: 120px; height: 180px; }
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-back, .card-front {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(201, 162, 39, 0.3);
}

.card-back {
    background-image: url('/assets/back.svg');
}

.card-front {
    transform: rotateY(180deg);
    background-color: var(--bg-2);
}

.flip-card.done {
    cursor: default;
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.3);
}

/* ─── Экран done ────────────────────────── */
.done-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    text-align: center;
}

.done-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.done-content h1 {
    font-size: 22px;
    color: var(--gold);
    font-weight: 700;
}

.done-content p {
    color: var(--text-dim);
    font-size: 15px;
    margin-bottom: 16px;
}