* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    overscroll-behavior: none;
}

body {
    background: var(--bg-gradient);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Cinzel', serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    user-select: none;
    transition: background-color 0.5s, color 0.5s;
        position: relative;
}

/* ========== Фоновые частицы ========== */
.bg-particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(180, 140, 60, 0.3);
    border-radius: 50%;
    animation: floatUp var(--dur, 10s) linear infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes floatUp {
    0% { transform: translateY(0) translateX(0); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { transform: translateY(-110vh) translateX(var(--drift, 30px)); opacity: 0; }
}

/* ========== Ссылка автора сверху ========== */
.author-link-top {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-decoration: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: all 0.3s ease;
    cursor: pointer;
}

.author-link-top:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-hover);
    transform: translateX(-50%) translateY(-1px);
}

.author-link-top .author-icon {
    color: currentColor;
}

/* ========== Контейнер ========== */
.roll-container {
    position: relative;
    z-index: 5;
    max-width: 600px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Делители ========== */
.divider {
    width: 100%;
    height: 1px;
    background: var(--divider-bg);
    margin: 16px auto;
    transition: background 0.5s;
}

.divider.thick {
    background: var(--divider-thick);
}

/* ========== Вспышка крита ========== */
.crit-flash {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
}

.crit-flash.nat20 {
    background: radial-gradient(circle at center,
        rgba(255, 215, 0, 0.4) 0%,
        rgba(255, 215, 0, 0.1) 40%,
        transparent 80%);
    animation: critFlashAnim 0.8s ease-out;
}

.crit-flash.success {
    background: radial-gradient(circle at center,
        rgba(80, 220, 80, 0.25) 0%,
        rgba(80, 220, 80, 0.05) 40%,
        transparent 80%);
    animation: critFlashAnim 0.5s ease-out;
}

.crit-flash.failure {
    background: radial-gradient(circle at center,
        rgba(220, 60, 60, 0.3) 0%,
        rgba(220, 60, 60, 0.08) 40%,
        transparent 80%);
    animation: critFlashAnim 0.6s ease-out;
}

@keyframes critFlashAnim {
    0% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

/* ========== Shake ========== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-8px) rotate(-1deg); }
    20% { transform: translateX(8px) rotate(1deg); }
    30% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    50% { transform: translateX(-3px); }
    60% { transform: translateX(3px); }
    70% { transform: translateX(-1px); }
}

/* ========== Подсказка клавиш ========== */
.key-hint {
    position: fixed;
    bottom: 20px;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--key-hint-dim);
    z-index: 20;
}

.key-hint kbd {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid var(--key-hint-bg);
    border-radius: 3px;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    color: var(--key-hint-text);
    margin: 0 2px;
}