:root {
    --primary: #854d0e;
    --accent: #f59e0b;
    --danger: #991b1b;
    --iron: #334155;
    --bg-dark: #1a0f0a;
    --paper: #fef3c7;
    --glass: rgba(0, 0, 0, 0.6);
    --timer-color: #60a5fa;
    --modal-bg: rgba(15, 23, 42, 0.95);
}

body {
    background: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.1) 0%, transparent 80%),
        linear-gradient(45deg, #1a0f0a 25%, #26160d 25%, #26160d 50%, #1a0f0a 50%, #1a0f0a 75%, #26160d 75%, #26160d 100%);
    background-size: 100% 100%, 40px 40px;
    color: #f8fafc;
    font-family: 'Georgia', 'serif', 'Meiryo', sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    width: 90%;
    max-width: 600px;
    background: #2d1b10;
    border: 4px double #854d0e;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 0 50px rgba(0,0,0,0.8), inset 0 0 20px rgba(245, 158, 11, 0.2);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* 制作中画面の背景設定 */
#work-screen {
    position: relative;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('GAZO/BACK.png');
    background-size: cover;
    background-position: center;
    padding: 10px;
    border-radius: 4px;
    box-sizing: border-box;
}

.floating {
    display: inline-block;
    animation: heat 1.5s infinite;
    color: var(--accent);
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 1.4rem;
}

@keyframes heat {
    0% { text-shadow: 0 0 5px var(--accent); transform: translateY(0px); }
    50% { text-shadow: 0 0 20px #ef4444, 0 0 30px var(--accent); transform: translateY(-5px); }
    100% { text-shadow: 0 0 5px var(--accent); transform: translateY(0px); }
}

.header h1 { font-size: 1.2rem; margin: 0 0 10px 0; color: var(--accent); text-shadow: 2px 2px 4px #000; }

.display-img {
    max-width: 150px;
    max-height: 150px;
    margin: 10px auto;
    display: block;
    border-radius: 15px;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
}

#time-left {
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    color: #fff;
    font-weight: bold;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 15px;
    border-radius: 5px;
    display: inline-block;
}

/* 次の工程まで：視認性アップ */
#next-tick-timer {
    font-size: 1.1rem;
    color: #f8fafc;
    font-weight: bold;
    text-shadow: 1px 1px 3px #000;
    margin-bottom: 15px;
}

.progress-container {
    margin: 10px 0;
    background: #1e1b1e;
    border: 3px solid #475569;
    border-radius: 4px;
    height: 25px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.7);
}

#progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #b91c1c, #f59e0b, #fff7ed);
    box-shadow: 0 0 15px var(--accent);
    transition: width 0.5s ease-out;
}

/* 工程数表示：大幅に拡大 */
.count-display {
    font-family: 'Courier New', monospace;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    margin: 15px 0;
}

.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 8px;
    margin-top: 20px;
}

.char-card {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(2px);
    border: 1px inset #475569;
    padding: 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

.char-card.inactive { opacity: 0.3; filter: grayscale(1); }
.char-card .lv { font-weight: bold; color: var(--accent); display: block; font-size: 0.9rem; }

#selection-screen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-height: 450px;
    overflow-y: auto;
    padding: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

#selection-screen::-webkit-scrollbar { width: 6px; }
#selection-screen::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

.item-btn {
    background: #3e271a;
    background-image: linear-gradient(to bottom right, #4a3022, #2d1b10);
    border: 2px solid #5a3e2b;
    border-left: 5px solid var(--accent);
    padding: 12px;
    border-radius: 4px;
    color: var(--paper);
    cursor: pointer;
    transition: 0.2s;
    text-align: left;
    box-shadow: 4px 4px 10px rgba(0,0,0,0.4);
}

.item-btn:hover:not(.disabled) { 
    transform: scale(1.03);
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
    background: #4a3022;
}
.item-btn.disabled { opacity: 0.5; cursor: not-allowed; border-left-color: #64748b; }

#confirm-modal {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    z-index: 200;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background: #fdf6e3;
    background-image: url('https://www.transparenttextures.com/patterns/old-paper.png');
    border: 10px double #854d0e;
    padding: 20px;
    border-radius: 4px;
    width: 100%;
    color: #2d1b10;
}

.description-text {
    font-size: 0.9rem;
    color: #57534e;
    margin: 15px 0;
    line-height: 1.5;
    font-style: italic;
    border-top: 1px solid #d6d3d1;
    padding-top: 10px;
}

.modal-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.btn-start { 
    background: #b91c1c; 
    color: white; 
    border: 1px solid #7f1d1d; 
    padding: 10px 20px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-weight: bold;
    box-shadow: 0 4px 0 #7f1d1d;
}
.btn-start:active { transform: translateY(2px); box-shadow: 0 2px 0 #7f1d1d; }

.btn-cancel { 
    background: #475569; 
    color: white; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 4px; 
    cursor: pointer; 
    box-shadow: 0 4px 0 #1e293b;
}
.btn-cancel:active { transform: translateY(2px); box-shadow: 0 2px 0 #1e293b; }

.work-footer-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.cancel-btn-work {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    position: relative;
    z-index: 10;
}

.back-home-btn {
    background: #4a3022;
    border: 2px solid #854d0e;
    color: var(--accent);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    transition: 0.2s;
}
.back-home-btn:hover {
    background: #5a3e2b;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.hidden { display: none !important; }

#complete-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    z-index: 100;
}