body {
    background-color: #1a1a1a;
    color: white;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    overflow-x: hidden;
    touch-action: manipulation;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

#header-ui {
    width: 100%;
    max-width: 360px;
    padding: 8px 10px;
}

#main-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    margin: 0 auto;
    max-width: 100vw;
}

#game-container {
    position: relative;
    width: 256px;
    height: 448px;
    background: #000;
    /* borderの代わりにoutlineを使用（レイアウトに影響しない） */
    outline: 3px solid #333;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.7);
}

#game-container.fever-active {
    outline-color: #fbbf24;
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.4);
}

#side-panel {
    width: 60px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.next-box {
    background: #222;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 4px;
    text-align: center;
}

#fever-gauge-container {
    width: 26px;
    height: 180px;
    background: #2a2a2a;
    border: 2px solid #444;
    border-radius: 12px;
    position: relative;
    margin: 0 auto;
    overflow: hidden;
}

#fever-gauge-fill {
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #d97706, #fbbf24, #fff);
    position: absolute;
    bottom: 0;
    left: 0;
    transition: height 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#fever-percent-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    color: #ffffff;
    font-weight: 900;
    pointer-events: none;
    z-index: 10;
    writing-mode: vertical-rl;
    text-orientation: upright;
    text-shadow: 1px 1px 2px #000;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 340px;
    margin: 8px auto;
    padding: 0 10px 10px 10px;
}

.btn {
    background: #333;
    padding: 14px 0;
    text-align: center;
    border-radius: 10px;
    user-select: none;
    cursor: pointer;
    border-bottom: 4px solid #111;
    font-weight: bold;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 50;
    padding: 15px;
    overflow-y: auto;
}

.skill-icon {
    padding: 2px 4px;
    background: #222;
    border-radius: 6px;
    color: #444;
    font-size: 10px;
    border: 1px solid transparent;
}

.skill-icon.active {
    color: #fbbf24;
    background: #443c20;
    border-color: #fbbf24;
}

.skill-toast {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: black;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    z-index: 70;
    animation: toast-fade 1.5s forwards;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

@keyframes toast-fade {
    0%   { opacity: 0; transform: translate(-50%, 10px); }
    15%  { opacity: 1; transform: translate(-50%, 0); }
    85%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -20px); }
}

#chain-display {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8), 0 0 10px rgba(251, 191, 36, 0.5);
    pointer-events: none;
    z-index: 60;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    width: auto;
    text-align: center;
}
