/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Шапка */
header {
    background: linear-gradient(to right, #4b6cb7, #182848);
    color: white;
    padding: 30px;
    text-align: center;
    border-bottom: 5px solid #FFD700;
}

header h1 {
    font-family: 'Roboto Slab', serif;
    font-size: 2.8rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Навигация */
nav {
    background-color: #2c3e50;
    padding: 0;
}

nav ul {
    display: flex;
    list-style: none;
    justify-content: center;
    flex-wrap: wrap;
}

nav li {
    flex: 1;
    min-width: 200px;
    text-align: center;
}

nav a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 20px 15px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border-bottom: 4px solid transparent;
}

nav a:hover {
    background-color: #34495e;
    border-bottom: 4px solid #FFD700;
}

nav a.active {
    background-color: #1a252f;
    border-bottom: 4px solid #FFD700;
}

nav i {
    margin-right: 10px;
}

/* Основной контент */
main {
    padding: 40px;
}

/* Главная страница */
.welcome-section {
    margin-bottom: 50px;
}

.welcome-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 2.2rem;
    text-align: center;
}

.welcome-section p {
    font-size: 1.2rem;
    line-height: 1.6;
    text-align: center;
    max-width: 800px;
    margin: 0 auto 40px;
    color: #555;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.tool-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-top: 5px solid #4b6cb7;
}

.tool-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.tool-icon {
    font-size: 3.5rem;
    color: #4b6cb7;
    margin-bottom: 20px;
}

.tool-card h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #2c3e50;
}

.tool-card p {
    color: #666;
    line-height: 1.5;
    margin-bottom: 25px;
}

.btn {
    display: inline-block;
    background: linear-gradient(to right, #4b6cb7, #182848);
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    background: linear-gradient(to right, #3a5ca9, #0d1c3a);
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Секция информации на главной */
.info-section {
    background-color: #f8f9fa;
    padding: 40px;
    border-radius: 15px;
    margin-top: 50px;
}

.info-section h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.features {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 30px;
    gap: 20px;
}

.feature {
    flex: 1;
    min-width: 200px;
    text-align: center;
    padding: 20px;
}

.feature i {
    font-size: 2.5rem;
    color: #4b6cb7;
    margin-bottom: 15px;
}

.feature h4 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

/* Контейнеры для страниц с инструментами */
.dice-container, .coin-container, .wheel-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 50px;
}

@media (max-width: 900px) {
    .dice-container, .coin-container, .wheel-container {
        grid-template-columns: 1fr;
    }
}

/* Общие стили для элементов управления */
.dice-controls, .coin-controls, .wheel-controls {
    background-color: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.dice-controls h2, .coin-controls h2, .wheel-controls h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.8rem;
    border-bottom: 2px solid #4b6cb7;
    padding-bottom: 10px;
}

/* Кнопки действия */
.action-btn {
    display: block;
    width: 100%;
    background: linear-gradient(to right, #4b6cb7, #182848);
    color: white;
    padding: 18px;
    border-radius: 10px;
    border: none;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.action-btn:hover {
    background: linear-gradient(to right, #3a5ca9, #0d1c3a);
    transform: translateY(-3px);
    box-shadow: 0 7px 15px rgba(0, 0, 0, 0.2);
}

.action-btn.secondary {
    background: linear-gradient(to right, #FF416C, #FF4B2B);
}

.action-btn.secondary:hover {
    background: linear-gradient(to right, #e03a5f, #e63c1f);
}

.action-btn.big {
    font-size: 1.5rem;
    padding: 22px;
    margin-top: 30px;
}

/* Стили для кубика */
.sides-selector, .throw-count, .coin-type {
    margin-bottom: 30px;
}

.sides-selector label, .throw-count label, .coin-type label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 1.1rem;
}

.sides-options, .count-buttons, .coin-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.side-option, .count-btn, .coin-option {
    padding: 12px 20px;
    background-color: #e9ecef;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.side-option:hover, .count-btn:hover, .coin-option:hover {
    background-color: #d0d7e0;
}

.side-option.active, .count-btn.active, .coin-option.active {
    background-color: #4b6cb7;
    color: white;
    border-color: #4b6cb7;
}

.custom-sides {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.custom-sides input {
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    width: 100px;
    font-size: 1rem;
}

#set-custom-sides {
    padding: 10px 20px;
    background-color: #4b6cb7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

/* Отображение кубика */
.dice-result, .coin-result, .wheel-result {
    background-color: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Стили для кубика - упрощенная 2D версия */
.dice-container-2d {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
    min-height: 120px;
}

.dice-2d {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    border: 3px solid #2c3e50;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Точки на кубике */
.dice-dot {
    width: 18px;
    height: 18px;
    background-color: #2c3e50;
    border-radius: 50%;
    position: absolute;
}

/* Позиции точек для разных значений */
/* 1 точка */
.dice-2d[data-value="1"] .dice-dot:nth-child(1) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 2 точки */
.dice-2d[data-value="2"] .dice-dot:nth-child(1) {
    top: 25%;
    left: 25%;
}
.dice-2d[data-value="2"] .dice-dot:nth-child(2) {
    bottom: 25%;
    right: 25%;
}

/* 3 точки */
.dice-2d[data-value="3"] .dice-dot:nth-child(1) {
    top: 25%;
    left: 25%;
}
.dice-2d[data-value="3"] .dice-dot:nth-child(2) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.dice-2d[data-value="3"] .dice-dot:nth-child(3) {
    bottom: 25%;
    right: 25%;
}

/* 4 точки */
.dice-2d[data-value="4"] .dice-dot:nth-child(1) {
    top: 25%;
    left: 25%;
}
.dice-2d[data-value="4"] .dice-dot:nth-child(2) {
    top: 25%;
    right: 25%;
}
.dice-2d[data-value="4"] .dice-dot:nth-child(3) {
    bottom: 25%;
    left: 25%;
}
.dice-2d[data-value="4"] .dice-dot:nth-child(4) {
    bottom: 25%;
    right: 25%;
}

/* 5 точек */
.dice-2d[data-value="5"] .dice-dot:nth-child(1) {
    top: 25%;
    left: 25%;
}
.dice-2d[data-value="5"] .dice-dot:nth-child(2) {
    top: 25%;
    right: 25%;
}
.dice-2d[data-value="5"] .dice-dot:nth-child(3) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.dice-2d[data-value="5"] .dice-dot:nth-child(4) {
    bottom: 25%;
    left: 25%;
}
.dice-2d[data-value="5"] .dice-dot:nth-child(5) {
    bottom: 25%;
    right: 25%;
}

/* 6 точек */
.dice-2d[data-value="6"] .dice-dot:nth-child(1) {
    top: 25%;
    left: 25%;
}
.dice-2d[data-value="6"] .dice-dot:nth-child(2) {
    top: 25%;
    right: 25%;
}
.dice-2d[data-value="6"] .dice-dot:nth-child(3) {
    top: 50%;
    left: 25%;
    transform: translateY(-50%);
}
.dice-2d[data-value="6"] .dice-dot:nth-child(4) {
    top: 50%;
    right: 25%;
    transform: translateY(-50%);
}
.dice-2d[data-value="6"] .dice-dot:nth-child(5) {
    bottom: 25%;
    left: 25%;
}
.dice-2d[data-value="6"] .dice-dot:nth-child(6) {
    bottom: 25%;
    right: 25%;
}

/* Для кубиков с более чем 6 гранями - показываем число */
.dice-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
}

/* Анимация броска кубика */
@keyframes diceRoll {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1); }
    75% { transform: rotate(270deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.rolling {
    animation: diceRoll 0.8s ease-in-out;
}
/* Контейнер для отображения нескольких кубиков */
.dice-display {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
    min-height: 120px;
}
/* Стили для монетки */
.coin-display {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

/* Улучшенная анимация для монетки */
.coin {
    width: 150px;
    height: 150px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform: rotateY(0deg);
}

.coin-front, .coin-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    backface-visibility: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    font-size: 1.5rem;
    overflow: hidden;
}

.coin-front {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #8B7500;
    border: 8px solid #daa520;
    z-index: 2;
}

.coin-back {
    background: linear-gradient(45deg, #C0C0C0, #A9A9A9);
    color: #505050;
    border: 8px solid #808080;
    transform: rotateY(180deg);
    z-index: 1;
}

/* Улучшенный текст на монетке */
.coin-text {
    font-size: 1.8rem;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    word-break: break-word;
}

/* Адаптивность для текста на монетке */
@media (max-width: 768px) {
    .coin {
        width: 120px;
        height: 120px;
    }
    
    .coin-text {
        font-size: 1.4rem;
    }
}

/* Стили для барабана */
.wheel-display {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 30px auto;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    border: 10px solid #4b6cb7;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    transition: transform 3s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.wheel-pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background-color: #FF416C;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    z-index: 10;
}

/* Управление вариантами барабана */
.options-manager {
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    margin-bottom: 20px;
    gap: 10px;
}

#new-option {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
}

.add-btn {
    padding: 12px 25px;
    background-color: #4b6cb7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.add-btn:hover {
    background-color: #3a5ca9;
}

.options-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 10px;
}

.option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 4px solid #4b6cb7;
}

.option-item:last-child {
    margin-bottom: 0;
}

.remove-option {
    background: none;
    border: none;
    color: #FF416C;
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.remove-option:hover {
    color: #e03a5f;
}

.options-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.clear-btn, .secondary-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.clear-btn {
    background-color: #FF416C;
    color: white;
}

.clear-btn:hover {
    background-color: #e03a5f;
}

.secondary-btn {
    background-color: #6c757d;
    color: white;
}

.secondary-btn:hover {
    background-color: #545b62;
}

/* Результаты и история */
.result-text {
    margin: 25px 0;
    text-align: center;
}

.result-value {
    font-weight: bold;
    font-size: 1.5rem;
    color: #4b6cb7;
}

.coin-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.stat {
    background-color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05);
    min-width: 120px;
}

.stat-label {
    display: block;
    font-weight: 600;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #4b6cb7;
}

.history {
    margin-top: 30px;
}

.history h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.history-list {
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid #dee2e6;
    margin-bottom: 15px;
}

.history-list p {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.history-list p:last-child {
    border-bottom: none;
}

.empty-history {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px !important;
}

/* Информационные блоки */
.info-box {
    background-color: #e3f2fd;
    padding: 25px;
    border-radius: 15px;
    border-left: 5px solid #4b6cb7;
}

.info-box h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-box ul {
    padding-left: 20px;
}

.info-box li {
    margin-bottom: 10px;
    line-height: 1.5;
}

/* Подвал */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 25px;
    margin-top: 40px;
}

footer p {
    margin-bottom: 10px;
    opacity: 0.8;
}

footer p:last-child {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Анимации */
@keyframes flip {
    0% { transform: rotateY(0); }
    50% { transform: rotateY(1800deg); }
    100% { transform: rotateY(1980deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.flipping {
    animation: flip 1.5s ease-in-out;
}

.shaking {
    animation: shake 0.5s ease-in-out;
}

/* Адаптивность */
@media (max-width: 768px) {
    header h1 {
        font-size: 2.2rem;
    }
    
    nav ul {
        flex-direction: column;
    }
    
    nav li {
        min-width: 100%;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .features {
        flex-direction: column;
    }
    
    .dice, .coin {
        width: 120px;
        height: 120px;
    }
    
    .coin {
        width: 130px;
        height: 130px;
    }
    
    .wheel-display {
        width: 250px;
        height: 250px;
    }
}