body {
    margin: 0;
    padding: 0;
    background-color: #050505;
    color: white;
    font-family: 'Courier New', sans-serif;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    position: relative;
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.1);
}

canvas {
    display: block;
    background-color: #000;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
}

/* HUD */
.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px #fff;
}

.hud-top-ranking {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-align: right;
    line-height: 1.6;
}

/* 中央メッセージ共通 */
.center-msg {
    background: rgba(0, 0, 0, 0.85);
    padding: 30px;
    border: 1px solid #444;
    border-radius: 8px;
    pointer-events: auto;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
}

h1 {
    margin: 0 0 15px 0;
    font-size: 32px;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: #0ff;
    text-shadow: 0 0 15px #0ff;
}

p {
    color: #ccc;
    font-size: 14px;
    line-height: 1.6;
}

/* ボタン共通 */
button {
    background: transparent;
    color: #0ff;
    border: 2px solid #0ff;
    padding: 15px 40px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.2s;
    font-family: inherit;
    font-weight: bold;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

button:active {
    background: #0ff;
    color: #000;
}

.btn-secondary {
    border-color: #666;
    color: #999;
    font-size: 14px;
    padding: 10px 30px;
}

.btn-secondary:active {
    background: #666;
    color: #fff;
}

.hidden {
    display: none !important;
}

#loading {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
}

.credits {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #333;
    font-size: 11px;
    color: #666;
    line-height: 1.5;
}

/* 難易度選択 */
.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.btn-difficulty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 2px solid #0ff;
}

.btn-difficulty .diff-name {
    font-size: 20px;
    letter-spacing: 3px;
}

.btn-difficulty .diff-desc {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    font-weight: normal;
}

.btn-nightmare {
    border-color: #f04;
    color: #f04;
}

.btn-nightmare:active {
    background: #f04;
    color: #000;
}

.btn-hell {
    border-color: #f0f;
    color: #f0f;
}

.btn-hell:active {
    background: #f0f;
    color: #000;
}

/* タイトルランキング */
.title-ranking {
    margin-top: 15px;
    font-size: 12px;
    color: #888;
    line-height: 1.8;
}

.title-ranking .rank-entry {
    color: #aaa;
}

.title-ranking .rank-label {
    color: #0ff;
    font-size: 11px;
    margin-bottom: 3px;
    letter-spacing: 1px;
}

/* ランキングモーダル */
.ranking-tabs {
    display: flex;
    gap: 5px;
    margin: 10px 0;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    font-size: 13px;
    border: 1px solid #444;
    color: #888;
    margin-top: 0;
}

.tab-active {
    border-color: #0ff;
    color: #0ff;
}

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

.ranking-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ranking-list th {
    color: #888;
    font-weight: normal;
    padding: 6px 8px;
    border-bottom: 1px solid #333;
    text-align: left;
}

.ranking-list td {
    padding: 6px 8px;
    border-bottom: 1px solid #222;
    color: #ccc;
}

.ranking-list tr:nth-child(1) td { color: #ffd700; }
.ranking-list tr:nth-child(2) td { color: #c0c0c0; }
.ranking-list tr:nth-child(3) td { color: #cd7f32; }

.ranking-list .no-data {
    color: #666;
    padding: 20px;
    text-align: center;
}

/* スコア登録 */
#scoreRegister {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#playerName {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #666;
    color: #fff;
    padding: 12px;
    font-size: 16px;
    font-family: inherit;
    text-align: center;
    border-radius: 4px;
    outline: none;
}

#playerName:focus {
    border-color: #0ff;
}

#registerBtn {
    margin-top: 0;
}

#afterRegister {
    display: flex;
    flex-direction: column;
    gap: 5px;
}