/* サイバーパンクテーマ */
:root {
    --primary-color: #00ffff;
    --secondary-color: #ff00ff;
    --tertiary-color: #ffff00;
    --bg-dark: #0a0a0a;
    --bg-medium: #1a1a1a;
    --bg-light: #2a2a2a;
    --text-color: #ffffff;
    --error-color: #ff0040;
    --success-color: #00ff88;
    --grid-border: #404040;
}

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

body {
    font-family: 'Orbitron', monospace;
    background-color: var(--bg-dark);
    color: var(--text-color);
    overflow-x: hidden;
    position: relative;
}

/* 背景アニメーション */
.cyberpunk-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: grid-move 10s linear infinite;
}

@keyframes grid-move {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.glitch-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 0, 255, 0.03) 2px,
        rgba(255, 0, 255, 0.03) 4px
    );
    animation: glitch-lines 2s linear infinite;
}

@keyframes glitch-lines {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

/* コンテナ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* ヘッダー */
.cyber-header {
    text-align: center;
    margin-bottom: 30px;
}

.glitch {
    font-size: 3.5rem;
    font-weight: 900;
    text-transform: uppercase;
    position: relative;
    color: var(--primary-color);
    letter-spacing: 5px;
    text-shadow: 
        0 0 10px var(--primary-color),
        0 0 20px var(--primary-color),
        0 0 30px var(--primary-color);
    animation: glitch 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: var(--secondary-color);
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: var(--tertiary-color);
    z-index: -2;
}

@keyframes glitch {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.7; }
    94% { opacity: 1; }
}

@keyframes glitch-1 {
    0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    20% { clip-path: inset(20% 0 30% 0); transform: translate(-2px, 2px); }
    40% { clip-path: inset(50% 0 20% 0); transform: translate(2px, -2px); }
    60% { clip-path: inset(10% 0 60% 0); transform: translate(-2px, 0); }
    80% { clip-path: inset(80% 0 5% 0); transform: translate(2px, 0); }
}

@keyframes glitch-2 {
    0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    20% { clip-path: inset(60% 0 10% 0); transform: translate(2px, 2px); }
    40% { clip-path: inset(10% 0 70% 0); transform: translate(-2px, -2px); }
    60% { clip-path: inset(40% 0 40% 0); transform: translate(2px, 0); }
    80% { clip-path: inset(5% 0 85% 0); transform: translate(-2px, 0); }
}

.neon-subtitle {
    font-size: 1.2rem;
    color: var(--secondary-color);
    text-shadow: 
        0 0 5px var(--secondary-color),
        0 0 10px var(--secondary-color);
    margin-top: 10px;
    animation: neon-pulse 2s ease-in-out infinite;
}

@keyframes neon-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ゲームコンテナ */
.game-container {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 30px;
    align-items: start;
}

/* コントロールパネル */
.control-panel {
    background: linear-gradient(145deg, var(--bg-medium), var(--bg-light));
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.5),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.level-selector {
    margin-bottom: 20px;
}

.cyber-label {
    display: block;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.cyber-select {
    width: 100%;
    background: var(--bg-dark);
    border: 2px solid var(--primary-color);
    color: var(--text-color);
    padding: 10px;
    border-radius: 5px;
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.cyber-select:hover {
    box-shadow: 0 0 10px var(--primary-color);
}

.cyber-select:focus {
    outline: none;
    box-shadow: 0 0 15px var(--primary-color);
}

/* ボタン */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.cyber-button {
    position: relative;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--text-color);
    padding: 12px 20px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s;
    border-radius: 5px;
}

.cyber-button.primary {
    border-color: var(--primary-color);
}

.cyber-button.secondary {
    border-color: var(--secondary-color);
}

.cyber-button.success {
    border-color: var(--success-color);
}

.cyber-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.4);
}

.button-text {
    position: relative;
    z-index: 2;
}

.button-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.cyber-button:hover .button-glow {
    left: 100%;
}

/* タイマー */
.timer-display {
    background: var(--bg-dark);
    border: 2px solid var(--tertiary-color);
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    box-shadow: 
        0 0 10px rgba(255, 255, 0, 0.3),
        inset 0 0 10px rgba(255, 255, 0, 0.1);
}

.timer-label {
    font-size: 0.8rem;
    color: var(--tertiary-color);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.timer-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--tertiary-color);
    text-shadow: 0 0 10px var(--tertiary-color);
}

/* 数独ボード */
.sudoku-board {
    background: var(--bg-medium);
    border: 3px solid var(--primary-color);
    border-radius: 10px;
    padding: 20px;
    display: inline-block;
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.5),
        inset 0 0 30px rgba(0, 255, 255, 0.1);
    position: relative;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 50px);
    grid-template-rows: repeat(9, 50px);
    gap: 0;
    position: relative;
}

.sudoku-cell {
    width: 50px;
    height: 50px;
    border: 1px solid var(--grid-border);
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.sudoku-cell:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.3);
}

.sudoku-cell.selected {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 
        0 0 15px rgba(0, 255, 255, 0.5),
        inset 0 0 15px rgba(0, 255, 255, 0.3);
}

.sudoku-cell.fixed {
    color: var(--primary-color);
    cursor: default;
    font-weight: 900;
    text-shadow: 0 0 5px var(--primary-color);
}

.sudoku-cell.error {
    background: rgba(255, 0, 64, 0.2);
    color: var(--error-color);
    animation: error-pulse 0.5s;
}

@keyframes error-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.sudoku-cell input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-color);
    outline: none;
}

/* 3x3ブロックの境界線 */
.sudoku-cell:nth-child(3n):not(:nth-child(9n)) {
    border-right: 3px solid var(--primary-color);
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid var(--primary-color);
}

/* サイドパネル */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ranking-container {
    background: linear-gradient(145deg, var(--bg-medium), var(--bg-light));
    border: 2px solid var(--secondary-color);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 
        0 0 20px rgba(255, 0, 255, 0.5),
        inset 0 0 20px rgba(255, 0, 255, 0.1);
}

.cyber-title {
    color: var(--secondary-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--secondary-color);
}

.ranking-list {
    max-height: 300px;
    overflow-y: auto;
}

.ranking-item {
    background: var(--bg-dark);
    border: 1px solid var(--secondary-color);
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.ranking-item:hover {
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
    transform: translateX(5px);
}

.ranking-position {
    color: var(--tertiary-color);
    font-weight: 900;
    font-size: 1.2rem;
}

.ranking-time {
    color: var(--primary-color);
}

.ranking-level {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
}

/* メッセージ */
.message-container {
    background: var(--bg-dark);
    border: 2px solid var(--success-color);
    border-radius: 5px;
    padding: 15px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cyber-message {
    color: var(--success-color);
    font-weight: 700;
    text-align: center;
    text-shadow: 0 0 5px var(--success-color);
    animation: message-fade 0.5s;
}

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

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-medium);
    border: 3px solid var(--primary-color);
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    box-shadow: 
        0 0 50px rgba(0, 255, 255, 0.5),
        inset 0 0 30px rgba(0, 255, 255, 0.1);
    animation: modal-appear 0.5s;
}

@keyframes modal-appear {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-shadow: 0 0 20px var(--primary-color);
}

.modal-text {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 10px;
}

.modal-time {
    font-size: 1.5rem;
    color: var(--tertiary-color);
    font-weight: 900;
    margin-bottom: 30px;
    text-shadow: 0 0 10px var(--tertiary-color);
}

/* スクロールバー */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border: 1px solid var(--primary-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* レスポンシブ */
@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .control-panel,
    .side-panel {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .button-group {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .cyber-button {
        flex: 1;
        min-width: 150px;
    }
} 