* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --accent-gold: #ffd700;
    --accent-cyan: #00d4ff;
    --accent-purple: #a855f7;
    --accent-green: #22c55e;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);

    /* Othello specific */
    --board-bg: #0d7c3d;
    --board-line: #0a6830;
    --disc-black: #1a1a1a;
    --disc-white: #f0f0f0;
    --valid-move: rgba(255, 215, 0, 0.4);
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Effects */
.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.bg-orb:nth-child(1) {
    width: 300px;
    height: 300px;
    background: var(--accent-green);
    top: -100px;
    left: -100px;
}

.bg-orb:nth-child(2) {
    width: 250px;
    height: 250px;
    background: var(--accent-purple);
    bottom: -50px;
    right: -50px;
    animation-delay: -10s;
}

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

/* Container */
.container {
    position: relative;
    z-index: 10;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 8px;
}

.back-btn {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s;
    min-width: 44px;
    min-height: 44px;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

h1 {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-family: 'Jua', sans-serif;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Game Status */
.game-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 15px;
}

.difficulty-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #000;
}

.difficulty-badge.easy {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.difficulty-badge.normal {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.difficulty-badge.hard {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* Score Display */
.score-display {
    display: flex;
    gap: 20px;
    align-items: center;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Black Han Sans', sans-serif;
    font-size: 1.3rem;
}

.disc {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.black-disc {
    background: linear-gradient(135deg, #333, #1a1a1a);
    border: 2px solid #444;
}

.white-disc {
    background: linear-gradient(135deg, #fff, #e0e0e0);
    border: 2px solid #ccc;
}

.turn-indicator {
    font-size: 0.85rem;
    color: var(--accent-gold);
    font-family: 'Jua', sans-serif;
}

.turn-indicator.thinking {
    color: var(--accent-cyan);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Game Container */
.game-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

/* Othello Board */
.othello-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    background: var(--board-line);
    border: 4px solid #0a5530;
    border-radius: 8px;
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1;
    margin: 0 auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.cell {
    background: var(--board-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}

.cell:hover {
    background: #0e8c45;
}

.cell.valid-move {
    cursor: pointer;
}

.cell.valid-move::after {
    content: '';
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.6);
    animation: validPulse 1s ease-in-out infinite;
}

.cell.hint-cell::after {
    background: rgba(0, 212, 255, 0.8);
    width: 40%;
    height: 40%;
}

@keyframes validPulse {
    0%, 100% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1); opacity: 1; }
}

/* Disc on board */
.cell .disc {
    width: 80%;
    height: 80%;
    position: absolute;
}

/* Place animation */
.cell .disc.placing {
    animation: placeDisc 0.3s ease-out;
}

@keyframes placeDisc {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Flip animation */
.cell .disc.flipping {
    animation: flipDisc 0.4s ease-in-out;
}

@keyframes flipDisc {
    0% { transform: rotateY(0deg) scale(1); }
    50% { transform: rotateY(90deg) scale(0.8); }
    100% { transform: rotateY(180deg) scale(1); }
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.control-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: white;
    cursor: pointer;
    font-family: 'Jua', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s;
    min-height: 44px;
}

.control-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    border-color: var(--accent-gold);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.hint-btn:hover {
    background: rgba(0, 212, 255, 0.3);
    border-color: var(--accent-cyan);
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

.overlay-content {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 350px;
    width: 90%;
    animation: slideUp 0.3s ease-out;
}

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

.overlay-content h2 {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2rem;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.difficulty-label {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-family: 'Jua', sans-serif;
}

/* Difficulty Buttons */
.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.difficulty-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-family: 'Jua', sans-serif;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.difficulty-btn[data-difficulty="easy"] {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.difficulty-btn[data-difficulty="normal"] {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.difficulty-btn[data-difficulty="hard"] {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.difficulty-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Game Over Content */
.gameover-content h2 {
    font-size: 2.2rem;
}

.gameover-content h2.win {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gameover-content h2.lose {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gameover-content h2.draw {
    background: linear-gradient(135deg, #888, #666);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Final Score */
.final-score {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2rem;
    margin: 20px 0;
}

.final-score .disc {
    width: 40px;
    height: 40px;
}

.vs {
    color: var(--text-secondary);
    font-size: 1.5rem;
}

/* Buttons */
.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.primary-btn {
    padding: 14px 30px;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-orange));
    border: none;
    border-radius: 25px;
    color: #000;
    font-family: 'Jua', sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.primary-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.3);
}

.secondary-btn {
    padding: 12px 25px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    color: var(--text-primary);
    font-family: 'Jua', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent-cyan);
}

/* Pass Notification */
.pass-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px 40px;
    border-radius: 15px;
    font-family: 'Jua', sans-serif;
    font-size: 1.2rem;
    color: var(--accent-gold);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.pass-notification.show {
    opacity: 1;
    visibility: visible;
}

/* Game Content */
.game-content {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 25px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.game-content h2 {
    font-family: 'Jua', sans-serif;
    font-size: 1.3rem;
    color: var(--accent-gold);
    margin-bottom: 12px;
    margin-top: 20px;
}

.game-content h2:first-child {
    margin-top: 0;
}

.game-content p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.95rem;
}

.tip-box {
    background: rgba(255, 215, 0, 0.05);
    border-left: 3px solid var(--accent-gold);
    padding: 15px;
    border-radius: 0 10px 10px 0;
    margin-top: 15px;
}

.tip-box p {
    margin-bottom: 8px;
}

.tip-box p:last-child {
    margin-bottom: 0;
}

/* Resume Overlay Styles */
.resume-content {
    text-align: center;
}

.resume-hint {
    color: var(--text-secondary);
    font-family: 'Jua', sans-serif;
    font-size: 1rem;
    margin: 15px 0;
}

.resume-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.resume-buttons .primary-btn {
    background: linear-gradient(135deg, var(--accent-cyan), #00a0cc);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover {
    color: var(--accent-gold);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .container {
        padding: 15px;
        padding-bottom: 100px;
    }

    h1 {
        font-size: 2rem;
    }

    .back-btn span {
        display: none;
    }

    .game-status {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .score-display {
        gap: 15px;
    }

    .score-item {
        font-size: 1.1rem;
    }

    .disc {
        width: 20px;
        height: 20px;
    }

    .othello-board {
        max-width: none;
        width: calc(100vw - 30px);
    }

    .controls {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(10, 10, 26, 0.95);
        backdrop-filter: blur(10px);
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        margin-bottom: 0;
        z-index: 50;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .control-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .game-content {
        display: none;
    }

    footer {
        display: none;
    }
}

@media (max-width: 380px) {
    .othello-board {
        gap: 1px;
        border-width: 3px;
    }

    .cell .disc {
        width: 85%;
        height: 85%;
    }
}
