body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 20px;
    background: radial-gradient(ellipse at bottom, #0d1b2a 0%, #1b263b 50%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    position: relative;
}

/* Background stars animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.3), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.3), transparent),
        radial-gradient(2px 2px at 160px 30px, rgba(255,255,255,0.4), transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: twinkle 3s infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

/* ヘッダースタイル */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.header-link:hover {
    color: #60a5fa;
}

.header-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.game-container {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(59, 130, 246, 0.2);
    position: relative;
    z-index: 1;
    margin-top: 60px; /* ヘッダーの高さ分の余白 */
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
    font-weight: bold;
    color: #f1f5f9;
    letter-spacing: -0.5px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3), 0 4px 6px rgba(0, 0, 0, 0.5);
    background: linear-gradient(45deg, #fbbf24, #f59e0b, #fbbf24);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: starGlow 2s ease-in-out infinite alternate;
}

@keyframes starGlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.subtitle {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1em;
    opacity: 0.9;
    color: rgba(241, 245, 249, 0.8);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: bold;
    color: rgba(241, 245, 249, 0.9);
}

.board-container {
    background: radial-gradient(ellipse at center, #0f172a 0%, #020617 100%);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 10px 15px -3px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.board {
    position: relative;
    width: 540px;
    height: 540px;
    background: transparent;
    cursor: crosshair;
    margin: 0 auto;
    border-radius: 12px;
}

.board-line {
    position: absolute;
    background: rgba(148, 163, 184, 0.4);
}

.board-line.horizontal {
    width: 100%;
    height: 1px;
}

.board-line.vertical {
    width: 1px;
    height: 100%;
}

.intersection {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: transparent;
    transform: translate(-10px, -10px);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.intersection::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.3);
    box-shadow: 0 0 4px rgba(148, 163, 184, 0.2);
    transition: all 0.2s ease;
}

.intersection:hover::before {
    background: rgba(251, 191, 36, 0.6);
    transform: scale(1.5);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
}

.stone {
    position: absolute;
    width: 20px;
    height: 20px;
    transform: translate(-10px, -10px);
    background: transparent;
    animation: placeStone 0.3s ease-out;
}

.stone::before {
    content: '★';
    font-size: 20px;
    color: #fbbf24;
    text-shadow: 
        0 0 10px rgba(251, 191, 36, 0.8),
        0 0 20px rgba(251, 191, 36, 0.6),
        0 0 30px rgba(251, 191, 36, 0.4);
    display: block;
    line-height: 1;
}

@keyframes placeStone {
    0% { 
        transform: translate(-10px, -10px) scale(0) rotate(0deg);
        opacity: 0;
    }
    50% { 
        transform: translate(-10px, -10px) scale(1.3) rotate(180deg);
        opacity: 1;
    }
    100% { 
        transform: translate(-10px, -10px) scale(1) rotate(360deg);
        opacity: 1;
    }
}

.circle-highlight {
    position: absolute;
    border: 3px solid #ff4444;
    border-radius: 50%;
    background: rgba(255, 68, 68, 0.1);
    pointer-events: none;
    animation: pulse 2s infinite;
}

.line-highlight {
    position: absolute;
    background: #ff4444;
    pointer-events: none;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.8);
    z-index: 10;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.3; }
}

.controls {
    text-align: center;
    margin-top: 20px;
}

.btn {
    background: linear-gradient(45deg, #3b82f6, #1e40af);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 25px;
    cursor: pointer;
    margin: 0 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    background: linear-gradient(45deg, #2563eb, #1d4ed8);
}

.game-over {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    color: #f1f5f9;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    margin-top: 20px;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid rgba(239, 68, 68, 0.4);
    animation: gameOverAppear 0.5s ease-out;
}

.game-over h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: bold;
    line-height: 1.3;
}

.game-over h2 span {
    font-size: 1.5em;
    text-shadow: 0 0 15px currentColor;
    display: block;
    margin-top: 5px;
}

.game-over p {
    margin-bottom: 20px;
    font-size: 1.1em;
    opacity: 0.9;
}

@keyframes gameOverAppear {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none;
}

.rules {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9em;
    line-height: 1.6;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(241, 245, 249, 0.9);
}

.rules h3 {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    color: #fbbf24;
    text-align: center;
}

.rule-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rule-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rule-item strong {
    color: #60a5fa;
    font-size: 0.95em;
}

.rule-item ul {
    margin: 5px 0 0 15px;
    padding: 0;
}

.rule-item li {
    margin: 3px 0;
    color: rgba(241, 245, 249, 0.85);
}

/* 危険な場所のハイライト */
.danger-highlight {
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.8) !important;
}