/* --- Dice Theme --- */
:root {
    --dice-bg: #FFE4E6;       /* Rose Light */
    --dice-card-bg: #FFF1F2;  /* Very Light Rose */
    --dice-accent: #E11D48;   /* Rose 600 */
    --dice-accent-light: #FFE4E6;
    --dice-face: #FFFFFF;     /* White Face */
    --dice-dot: #1E293B;      /* Dark Dots */
    --dice-shadow: rgba(225, 29, 72, 0.2);
}

.calc-header { margin-bottom: 32px; }
.subtitle { color: var(--text-secondary); margin-top: 8px; }

/* Сетка: одна большая колонка для кубика, одна поменьше для истории */
.calc-grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
@media (min-width: 900px) { .calc-grid { grid-template-columns: 2fr 1fr; } }

/* --- ARENA --- */
.card--dice {
    background: var(--dice-card-bg);
    border: 2px solid #FECDD3;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 20px;
    min-height: 400px;
    overflow: hidden; 
    position: relative;
}

/* --- 3D CUBE SCENE --- */
.scene {
    width: 120px; height: 120px;
    perspective: 600px;
    margin-bottom: 40px;
}

.cube {
    width: 100%; height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: translateZ(-60px);
    transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cube__face {
    position: absolute; width: 120px; height: 120px;
    background: var(--dice-face);
    border: 2px solid #E2E8F0;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; font-weight: bold; color: var(--dice-dot);
    box-shadow: inset 0 0 15px rgba(0,0,0,0.05);
    backface-visibility: hidden;
}

/* Позиционирование граней */
.cube__face--1 { transform: rotateY(0deg) translateZ(60px); }
.cube__face--2 { transform: rotateY(180deg) translateZ(60px); }
.cube__face--3 { transform: rotateY(-90deg) translateZ(60px); }
.cube__face--4 { transform: rotateY(90deg) translateZ(60px); }
.cube__face--5 { transform: rotateX(90deg) translateZ(60px); }
.cube__face--6 { transform: rotateX(-90deg) translateZ(60px); }

/* Точки (Dots) */
.dot {
    display: block; width: 20px; height: 20px;
    background: var(--dice-dot);
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}

/* Раскладка точек */
.cube__face--2, .cube__face--3 { gap: 20px; }
.cube__face--2 .dot:nth-child(1) { align-self: flex-start; margin: 15px; }
.cube__face--2 .dot:nth-child(2) { align-self: flex-end; margin: 15px; }
.cube__face--3 .dot:nth-child(1) { align-self: flex-start; margin-top: 15px; margin-left: 15px; }
.cube__face--3 .dot:nth-child(3) { align-self: flex-end; margin-bottom: 15px; margin-right: 15px; }

.col { display: flex; flex-direction: column; justify-content: space-between; height: 100%; padding: 15px; }
.col-mid { display: flex; align-items: center; justify-content: center; height: 100%; }

/* --- CONTROLS --- */
.roll-btn {
    padding: 16px 40px;
    font-size: 18px; font-weight: 700;
    color: #fff; background: var(--dice-accent);
    border: none; border-radius: 99px;
    cursor: pointer; box-shadow: 0 10px 25px var(--dice-shadow);
    transition: all 0.2s;
    display: flex; align-items: center; gap: 10px;
}
.roll-btn:hover { transform: translateY(-3px); box-shadow: 0 15px 35px var(--dice-shadow); background: #BE123C; }
.roll-btn:active { transform: translateY(0); }
.roll-btn i { font-size: 22px; transition: transform 0.5s; }
.roll-btn:hover i { transform: rotate(180deg); }

.dice-status {
    margin-top: 24px; font-size: 14px; color: #9CA3AF; font-weight: 500; height: 20px;
}

/* --- HISTORY & RESET --- */
.history-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 12px;
    gap: 16px;
}

.section-label { 
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px; 
    color: #9CA3AF; font-weight: 700; margin: 0;
}

/* Новая кнопка сброса (стиль под тему) */
.reset-action {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; 
    color: #BE123C; /* Dark Rose */
    background: #FFF1F2; /* Light Rose */
    border: 1px solid #FECDD3;
    padding: 6px 12px; border-radius: 99px;
    cursor: pointer; text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
}
.reset-action:hover { 
    background: #FECDD3; 
    color: #9F1239; 
    transform: translateY(-1px); 
}
.reset-action i { font-size: 14px; }

.history-list {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 300px; overflow-y: auto;
}
.history-item {
    display: flex; justify-content: space-between; align-items: center;
    background: #F8FAFC; padding: 10px 14px; border-radius: 8px;
    border: 1px solid #E2E8F0; font-size: 14px;
    animation: slideIn 0.3s ease-out;
}
.history-val { font-weight: 800; color: var(--dice-accent); font-size: 16px; }
.history-time { font-size: 11px; color: #94A3B8; }

.empty-history { text-align: center; color: #CBD5E1; font-size: 13px; padding: 20px 0; }

.divider { height: 1px; background: #E5E7EB; margin: 24px 0; width: 100%; }

.stats-mini { display: flex; justify-content: space-between; font-size: 13px; }
.stat-item { display: flex; flex-direction: column; gap: 4px; }
.stat-item strong { font-size: 16px; color: #334155; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- НОВЫЕ ИНФОРМАЦИОННЫЕ БЛОКИ (Dice Style) --- */

.info-wrapper {
    padding: 60px 0 60px 0;
    margin-top: 60px;
    border-top: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.info-wrapper .container {
    max-width: 800px;
    margin: 0 auto;
}

/* Заголовки */
.icon-heading {
    display: flex; align-items: flex-start; gap: 16px;
    margin-bottom: 24px; font-size: 24px; font-weight: 800;
    color: var(--text-primary); line-height: 1.3;
}

.header-icon {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 12px;
    background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    flex-shrink: 0; margin-top: -4px;
}

.header-icon svg { width: 24px; height: 24px; stroke-width: 2px; }

/* Цвета иконок */
.blue-icon svg { color: #2563EB; }
.green-icon svg { color: #10B981; }
.purple-icon svg { color: #9333EA; }
.orange-icon svg { color: #F59E0B; }
.red-icon svg { color: var(--dice-accent); }

.small-heading {
    margin-top: 40px; margin-bottom: 16px; font-size: 20px;
}
.small-heading .header-icon { width: 40px; height: 40px; }
.small-heading .header-icon svg { width: 20px; height: 20px; }

.intro-text {
    font-size: 16px; color: var(--text-secondary); margin-bottom: 32px; line-height: 1.6;
}

/* --- Секция Формул --- */
.formulas-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 48px;
}

.formula-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border-radius: 16px; 
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; flex-direction: column;
}
.formula-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(225, 29, 72, 0.15); border-color: #FECDD3; }

.formula-header {
    display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 16px;
}

.formula-card h3 {
    margin: 0; font-size: 18px; font-weight: 700; color: var(--text-primary); line-height: 1.3;
}

/* Бейджи */
.badge-blue {
    background: #DBEAFE; color: #2563EB;
    padding: 6px 12px; border-radius: 99px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-green {
    background: #D1FAE5; color: #059669;
    padding: 6px 12px; border-radius: 99px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}

.formula-card p {
    font-size: 14px; color: var(--text-secondary); margin: 0; line-height: 1.5; font-weight: 500;
}

.math-expression {
    background: #FFF1F2; /* Rose Lightest */
    border: 1px solid #FECDD3;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 700;
    color: var(--dice-accent);
    text-align: center;
    margin-bottom: 16px;
    font-size: 15px;
}

/* Разделитель */
.soft-divider {
    border: none; height: 1px;
    background: linear-gradient(90deg, transparent, #E5E7EB, transparent);
    margin: 48px 0;
}

/* Описание */
.calc-description p {
    font-size: 16px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 24px;
}
.calc-description strong { color: var(--text-primary); }

/* --- FAQ Секция (Dice Style) --- */
.faq-section .faq-item {
    background: #fff; border: 1px solid #E5E7EB;
    border-radius: 12px; margin-bottom: 12px;
    overflow: hidden; transition: all 0.2s ease;
}

.faq-section .faq-item[open] {
    border-color: var(--dice-accent); 
    box-shadow: 0 4px 20px rgba(225, 29, 72, 0.15);
}

summary.faq-question {
    padding: 16px 20px; cursor: pointer;
    font-weight: 600; color: var(--text-primary);
    list-style: none; position: relative;
    display: flex; justify-content: space-between;
    align-items: center; transition: background 0.2s;
}

summary.faq-question:hover { background-color: #FFF1F2; }

.faq-section .faq-item[open] summary.faq-question {
    color: var(--dice-accent);
    background: #FFF1F2;
}

.faq-question::after {
    content: '+'; font-size: 20px;
    color: var(--text-secondary); font-weight: 400; line-height: 1;
}
.faq-question .icon-plus { display: none; }

.faq-section .faq-item[open] summary.faq-question::after {
    content: '−'; color: var(--dice-accent);
}

.faq-answer, .faq-item div[itemprop="text"] {
    padding: 20px; color: var(--text-secondary);
    line-height: 1.6; font-size: 15px;
}

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ --- */
@media (max-width: 900px) {
    .formulas-grid { grid-template-columns: 1fr; gap: 16px; margin-bottom: 32px; }
    .icon-heading { font-size: 20px; gap: 12px; margin-bottom: 20px; }
    .header-icon { width: 40px; height: 40px; border-radius: 12px; }
    .header-icon svg { width: 20px; height: 20px; }
    
    .formula-card { padding: 24px; text-align: center; align-items: center; }
    .formula-header { align-items: center; width: 100%; }
    .math-expression { width: 100%; max-width: 300px; margin-left: auto; margin-right: auto; }
    
    .info-wrapper { margin-top: 40px; padding-top: 40px; }
}