/* ============================================
   DiceOracle — Premium Glassmorphism UI
   Color Dice Predictor
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-deep: #0a0a1a;
    --bg-surface: rgba(15, 15, 35, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-bg-hover: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-active: rgba(255, 255, 255, 0.18);
    --glass-blur: 24px;

    --text-primary: #f0f0f8;
    --text-secondary: rgba(240, 240, 248, 0.6);
    --text-tertiary: rgba(240, 240, 248, 0.35);

    --accent-primary: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

    --color-red: #ef4444;
    --color-green: #22c55e;
    --color-blue: #3b82f6;
    --color-orange: #f97316;
    --color-purple: #a855f7;
    --color-gold: #eab308;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.3);
    --shadow-lg: 0 16px 64px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 40px var(--accent-glow);

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Background Animation --- */
.bg-animation {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    animation: orbFloat 20s ease-in-out infinite alternate;
}

.bg-orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.5), transparent 70%);
    top: -150px; left: -100px;
    animation-duration: 18s;
}

.bg-orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.4), transparent 70%);
    top: 30%; right: -80px;
    animation-duration: 22s;
    animation-delay: -5s;
}

.bg-orb-3 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.35), transparent 70%);
    bottom: 10%; left: 20%;
    animation-duration: 25s;
    animation-delay: -10s;
}

.bg-orb-4 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.25), transparent 70%);
    top: 60%; right: 30%;
    animation-duration: 20s;
    animation-delay: -3s;
}

.bg-orb-5 {
    width: 250px; height: 250px;
    background: radial-gradient(circle, rgba(234, 179, 8, 0.2), transparent 70%);
    top: 15%; left: 50%;
    animation-duration: 24s;
    animation-delay: -7s;
}

@keyframes orbFloat {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
    100% { transform: translate(10px, -10px) scale(1.05); }
}

/* --- Particle Canvas --- */
#particles-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* --- Header --- */
#app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    background: rgba(10, 10, 26, 0.75);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 24px;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.logo-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    border-radius: inherit;
}

.logo-dice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 8px;
}

.logo-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: white;
}

.logo-text h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff, rgba(255,255,255,0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.logo-tagline {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* --- Center Traced Hub Branding & Discord --- */
.header-center-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex: 1;
}

.traced-pill {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px 6px 8px;
    background: rgba(14, 11, 24, 0.75);
    border: 1.5px solid rgba(255, 149, 0, 0.65);
    border-radius: 9999px;
    text-decoration: none;
    box-shadow: 0 0 18px rgba(255, 130, 0, 0.28), inset 0 0 12px rgba(255, 130, 0, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

.traced-pill:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(255, 180, 50, 0.95);
    box-shadow: 0 0 28px rgba(255, 140, 0, 0.55), 0 0 60px rgba(255, 100, 0, 0.2), inset 0 0 16px rgba(255, 140, 0, 0.2);
}

.traced-avatar-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #ff9500;
    box-shadow: 0 0 12px rgba(255, 145, 0, 0.85);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.traced-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.05);
}

.traced-brand-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.16em;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
}

.traced-hub-tag {
    background: linear-gradient(135deg, #ff6a00, #ff3c00);
    color: #ffffff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 800;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    padding: 4px 11px;
    border-radius: 7px;
    text-transform: uppercase;
    box-shadow: 0 0 14px rgba(255, 80, 0, 0.65);
    display: inline-block;
}

/* --- Join Discord Button --- */
.traced-discord-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: rgba(88, 101, 242, 0.18);
    border: 1.5px solid rgba(88, 101, 242, 0.55);
    border-radius: 9999px;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 0 16px rgba(88, 101, 242, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.traced-discord-btn:hover {
    background: rgba(88, 101, 242, 0.85);
    border-color: #5865f2;
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(88, 101, 242, 0.75);
}

.discord-svg {
    flex-shrink: 0;
    color: #fff;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
}

.discord-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #23a55a;
    box-shadow: 0 0 8px #23a55a;
    animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
    0% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 4px #23a55a; }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #23a55a, 0 0 18px rgba(35, 165, 90, 0.6); }
    100% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 4px #23a55a; }
}

.header-stats {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    font-size: 0.78rem;
    transition: var(--transition-base);
}

.stat-chip:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-active);
}

.stat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.stat-dot-green { background: var(--color-green); box-shadow: 0 0 8px rgba(34,197,94,0.5); }
.stat-dot-blue { background: var(--color-blue); box-shadow: 0 0 8px rgba(59,130,246,0.5); }
.stat-dot-gold { background: var(--color-gold); box-shadow: 0 0 8px rgba(234,179,8,0.5); }

.stat-label {
    color: var(--text-tertiary);
    font-weight: 500;
}

.stat-value {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-primary);
}

/* --- Main --- */
#app-main {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 60px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Glass Panel --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.glass-panel:hover {
    border-color: var(--glass-border-active);
    background: var(--glass-bg-hover);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.panel-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    flex: 1;
}

.panel-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.pulse-icon {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(168, 85, 247, 0.3)); }
    50% { filter: drop-shadow(0 0 16px rgba(168, 85, 247, 0.7)); transform: scale(1.1); }
}

/* --- Game ID Section --- */
.game-id-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

.input-group label, .dice-count-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.game-id-input-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.game-id-input-wrap input {
    flex: 1;
    min-width: 160px;
    padding: 11px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-base);
}

.game-id-input-wrap input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.game-id-input-wrap input::placeholder {
    color: var(--text-tertiary);
}

.game-id-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.74rem;
    color: var(--text-tertiary);
}

.game-id-status .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: var(--transition-base);
    flex-shrink: 0;
}

.game-id-status.verified .status-dot {
    background: var(--color-green);
    box-shadow: 0 0 8px var(--color-green);
}

.game-id-status.verified .status-text {
    color: var(--color-green);
}

/* --- Modal Styles --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(5, 5, 18, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    max-width: 540px;
    width: 100%;
    background: rgba(18, 18, 38, 0.95);
    border: 1px solid var(--glass-border-active);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    position: relative;
    padding: 28px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.modal-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.sync-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.sync-tab {
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-tertiary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.sync-tab:hover {
    color: var(--text-primary);
}

.sync-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.sync-tab-content {
    animation: fadeIn 0.2s ease-out;
}

.tab-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.auto-seed-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-row label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.select-field {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 0.82rem;
}

.select-field option {
    background: #121226;
    color: var(--text-primary);
}

textarea#paste-rolls-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 12px;
    outline: none;
    margin-bottom: 14px;
    resize: vertical;
}

textarea#paste-rolls-input:focus {
    border-color: var(--accent-primary);
}

.code-copy-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.code-copy-box code {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--color-green);
    overflow-x: auto;
    white-space: nowrap;
    flex: 1;
}

.dice-count-selector {
    display: flex;
    gap: 6px;
}

.dice-count-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.dice-count-btn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-active);
    color: var(--text-primary);
}

.dice-count-btn.active {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 0 16px var(--accent-glow);
}

/* --- Prediction Section --- */
.prediction-section {
    border-color: rgba(99, 102, 241, 0.15);
    background: rgba(99, 102, 241, 0.03);
}

.confidence-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 100px;
    font-size: 0.78rem;
}

.confidence-badge #confidence-value {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--color-green);
}

/* --- Final Single Color Hero --- */
.final-color-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 20px;
    margin: 8px 0 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-base);
}

.final-color-glow {
    position: absolute;
    inset: 0;
    opacity: 0.25;
    filter: blur(40px);
    pointer-events: none;
    transition: background 0.5s ease;
    z-index: 0;
}

.final-call-pill {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    margin-bottom: 16px;
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.35);
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #facc15;
    text-transform: uppercase;
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.2);
}

.final-call-pill .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #facc15;
    box-shadow: 0 0 8px #facc15;
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.5; }
}

.final-color-card {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    background: rgba(10, 10, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    max-width: 520px;
    width: 100%;
    transition: var(--transition-base);
}

.final-die-avatar {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    position: relative;
    flex-shrink: 0;
    transition: var(--transition-slow);
}

.final-die-avatar::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 19px;
    background: inherit;
    filter: blur(14px);
    opacity: 0.6;
    z-index: -1;
}

.final-die-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

.final-color-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    flex: 1;
}

.final-sub {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.final-color-title {
    font-size: 2.1rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1.1;
    margin: 2px 0 6px;
    transition: color 0.3s ease;
}

.final-prob-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.final-prob-tag {
    font-size: 0.74rem;
    font-family: var(--font-mono);
    color: var(--color-green);
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
    padding: 3px 10px;
    border-radius: 100px;
}

.final-hedge-tag {
    font-size: 0.74rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 3px 10px;
    border-radius: 100px;
}

.final-reason {
    position: relative;
    z-index: 1;
    font-size: 0.76rem;
    color: var(--text-tertiary);
    margin-top: 14px;
    max-width: 550px;
    line-height: 1.4;
}

/* Breakdown Divider */
.prediction-breakdown-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0 8px;
    color: var(--text-tertiary);
}

.breakdown-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
}

.breakdown-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.prediction-dice-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 16px 0 24px;
    flex-wrap: wrap;
}

.prediction-die {
    width: 90px;
    height: 90px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    position: relative;
    transition: var(--transition-slow);
    cursor: default;
    border: 2px solid rgba(255,255,255,0.1);
}

.prediction-die::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: calc(var(--radius-md) + 4px);
    background: inherit;
    filter: blur(20px);
    opacity: 0.35;
    z-index: -1;
}

.prediction-die .die-face {
    display: grid;
    gap: 6px;
    padding: 12px;
}

.prediction-die .die-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 0 6px rgba(255,255,255,0.4);
}

.prediction-die .die-color-name {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.prediction-die.empty {
    background: var(--glass-bg);
    border-style: dashed;
    border-color: var(--glass-border);
}

.prediction-die.empty::after {
    display: none;
}

.prediction-die.empty::before {
    content: '?';
    font-size: 2rem;
    color: var(--text-tertiary);
}

.prediction-meta {
    text-align: center;
    padding-top: 12px;
}

.prediction-method {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* --- Input Section --- */
.dice-input-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.dice-slots {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.dice-slot {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    border: 2px dashed var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
    cursor: pointer;
    position: relative;
    background: var(--glass-bg);
}

.dice-slot.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 16px var(--accent-glow);
    border-style: solid;
}

.dice-slot.filled {
    border-style: solid;
}

.dice-slot .slot-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    position: absolute;
    top: 4px;
    left: 8px;
}

.dice-slot .slot-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: var(--transition-base);
}

.color-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.color-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.color-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: var(--transition-fast);
}

.color-btn:hover {
    transform: translateY(-3px);
    border-color: var(--glass-border-active);
}

.color-btn:hover::before {
    opacity: 0.08;
}

.color-btn:active {
    transform: translateY(0);
}

.color-btn[data-color="red"]:hover { border-color: var(--color-red); box-shadow: 0 4px 20px rgba(239,68,68,0.25); }
.color-btn[data-color="red"]::before { background: var(--color-red); }
.color-btn[data-color="green"]:hover { border-color: var(--color-green); box-shadow: 0 4px 20px rgba(34,197,94,0.25); }
.color-btn[data-color="green"]::before { background: var(--color-green); }
.color-btn[data-color="blue"]:hover { border-color: var(--color-blue); box-shadow: 0 4px 20px rgba(59,130,246,0.25); }
.color-btn[data-color="blue"]::before { background: var(--color-blue); }
.color-btn[data-color="orange"]:hover { border-color: var(--color-orange); box-shadow: 0 4px 20px rgba(249,115,22,0.25); }
.color-btn[data-color="orange"]::before { background: var(--color-orange); }
.color-btn[data-color="purple"]:hover { border-color: var(--color-purple); box-shadow: 0 4px 20px rgba(168,85,247,0.25); }
.color-btn[data-color="purple"]::before { background: var(--color-purple); }
.color-btn[data-color="gold"]:hover { border-color: var(--color-gold); box-shadow: 0 4px 20px rgba(234,179,8,0.25); }
.color-btn[data-color="gold"]::before { background: var(--color-gold); }

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: var(--transition-fast);
}

.color-btn:hover .color-swatch {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.color-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}

.input-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
    flex-wrap: wrap;
}

.help-text {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    font-weight: 500;
    padding: 4px 12px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 100px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 24px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-secondary);
    border-color: var(--glass-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--glass-bg-hover);
    color: var(--text-primary);
    border-color: var(--glass-border-active);
}

.btn-ghost {
    background: transparent;
    color: var(--text-tertiary);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text-secondary);
    background: var(--glass-bg);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.72rem;
}

.btn-danger:hover:not(:disabled) {
    color: var(--color-red);
    background: rgba(239,68,68,0.08);
}

/* --- Analytics Grid --- */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* --- Frequency Bars --- */
.frequency-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.freq-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.freq-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.freq-label {
    width: 55px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.freq-bar-track {
    flex: 1;
    height: 24px;
    background: rgba(255,255,255,0.03);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.freq-bar-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    min-width: 2px;
}

.freq-bar-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15));
    border-radius: 0 100px 100px 0;
}

.freq-count {
    width: 45px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.freq-pct {
    width: 45px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* --- Pattern Analysis --- */
.pattern-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pattern-empty {
    text-align: center;
    padding: 30px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.pattern-item {
    padding: 14px 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition-fast);
}

.pattern-item:hover {
    background: rgba(255,255,255,0.04);
    border-color: var(--glass-border-active);
}

.pattern-indicator {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.pattern-text {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.pattern-text strong {
    color: var(--text-primary);
    font-weight: 700;
}

.pattern-confidence {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 100px;
    flex-shrink: 0;
}

.pattern-confidence.high {
    color: var(--color-green);
    background: rgba(34,197,94,0.1);
}

.pattern-confidence.medium {
    color: var(--color-gold);
    background: rgba(234,179,8,0.1);
}

.pattern-confidence.low {
    color: var(--color-red);
    background: rgba(239,68,68,0.1);
}

/* --- History --- */
.history-controls {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 100px;
}

.history-empty {
    text-align: center;
    padding: 30px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.history-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.history-row:hover {
    background: rgba(255,255,255,0.04);
    border-color: var(--glass-border-active);
}

.history-roll-num {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-tertiary);
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.history-dice {
    display: flex;
    gap: 6px;
    flex: 1;
}

.history-die {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.history-die .mini-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
}

.history-prediction-result {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
}

.history-hit {
    color: var(--color-green);
}

.history-miss {
    color: var(--color-red);
    opacity: 0.7;
}

.history-time {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* --- Hot/Cold Section --- */
.hotcold-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.hotcold-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.hot-title {
    color: var(--color-orange);
}

.cold-title {
    color: var(--color-blue);
}

.hotcold-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hotcold-empty {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.hotcold-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}

.hotcold-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hotcold-color-name {
    font-size: 0.82rem;
    font-weight: 600;
    flex: 1;
}

.hotcold-stat {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

/* --- Footer --- */
#app-footer {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--glass-border);
    margin-top: 20px;
}

#app-footer p {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

#app-footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

#app-footer a:hover {
    text-decoration: underline;
}

/* --- Toast --- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    background: rgba(20, 20, 40, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: toastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.toast-out {
    animation: toastOut 0.3s ease-in forwards;
}

.toast-success { border-left: 3px solid var(--color-green); }
.toast-error { border-left: 3px solid var(--color-red); }
.toast-info { border-left: 3px solid var(--color-blue); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(30px); }
}

/* --- Responsive --- */
@media (max-width: 960px) {
    .header-inner {
        flex-direction: column;
        height: auto;
        padding: 14px 0;
        gap: 12px;
    }

    .header-center-brand {
        order: 2;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .header-stats {
        order: 3;
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .header-stats {
        flex-wrap: wrap;
        justify-content: center;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .hotcold-grid {
        grid-template-columns: 1fr;
    }

    .game-id-row {
        flex-direction: column;
    }

    .prediction-die {
        width: 70px;
        height: 70px;
    }

    .glass-panel {
        padding: 20px;
    }

    #app-main {
        padding: 16px 12px 40px;
    }
}

@media (max-width: 480px) {
    .traced-brand-text {
        font-size: 0.95rem;
        letter-spacing: 0.1em;
    }

    .traced-pill {
        padding: 5px 10px 5px 6px;
        gap: 8px;
    }

    .traced-avatar-wrap {
        width: 30px;
        height: 30px;
    }

    .traced-hub-tag {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .traced-discord-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .stat-chip {
        padding: 6px 10px;
        font-size: 0.72rem;
    }

    .color-btn {
        padding: 8px 10px;
    }

    .color-swatch {
        width: 26px;
        height: 26px;
    }

    .dice-slot {
        width: 56px;
        height: 56px;
    }

    .prediction-die {
        width: 56px;
        height: 56px;
    }
}

/* --- Animations --- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes diceRoll {
    0% { transform: rotateX(0) rotateZ(0) scale(1); }
    25% { transform: rotateX(90deg) rotateZ(90deg) scale(0.9); }
    50% { transform: rotateX(180deg) rotateZ(180deg) scale(1.05); }
    75% { transform: rotateX(270deg) rotateZ(270deg) scale(0.95); }
    100% { transform: rotateX(360deg) rotateZ(360deg) scale(1); }
}

.dice-rolling {
    animation: diceRoll 0.6s ease-out;
}

/* Color backgrounds */
.bg-red { background: var(--color-red) !important; }
.bg-green { background: var(--color-green) !important; }
.bg-blue { background: var(--color-blue) !important; }
.bg-orange { background: var(--color-orange) !important; }
.bg-purple { background: var(--color-purple) !important; }
.bg-gold { background: var(--color-gold) !important; }

.border-red { border-color: var(--color-red) !important; }
.border-green { border-color: var(--color-green) !important; }
.border-blue { border-color: var(--color-blue) !important; }
.border-orange { border-color: var(--color-orange) !important; }
.border-purple { border-color: var(--color-purple) !important; }
.border-gold { border-color: var(--color-gold) !important; }

.text-red { color: var(--color-red) !important; }
.text-green { color: var(--color-green) !important; }
.text-blue { color: var(--color-blue) !important; }
.text-orange { color: var(--color-orange) !important; }
.text-purple { color: var(--color-purple) !important; }
.text-gold { color: var(--color-gold) !important; }
