:root {
    --primary-color: #f59e0b; /* Amber */
    --stamp-red: #dc2626; /* Stamp Red */
    --card-bg: rgba(20, 25, 30, 0.9);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #000000;
}

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

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    background-color: #0f172a;
    position: relative;
    overflow-x: hidden;
}

.back-link {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255,255,255,0.1);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 100;
    transition: background 0.3s;
}

.back-link:hover {
    background: rgba(255,255,255,0.2);
}

.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    z-index: -1;
}

.app-container {
    width: 100%;
    max-width: 600px;
    z-index: 10;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    transition: transform 0.1s;
}

/* 画面揺れ用アニメーションクラス */
.glass-card.shake {
    animation: smash-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes smash-shake {
    0%, 100% { transform: translateY(0) rotate(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateY(-3px) rotate(-1deg); }
    20%, 40%, 60%, 80% { transform: translateY(3px) rotate(1deg); }
}

header {
    text-align: center;
    margin-bottom: 32px;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.2);
}

header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* スライダー */
.slider-section {
    margin-bottom: 24px;
    background: rgba(0,0,0,0.3);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
}

.input-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 1rem;
}

.highlight-value {
    color: #fff;
    font-size: 2rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

input[type="range"] {
    width: 100%;
    height: 14px;
    background: #334155;
    border-radius: 8px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border: 4px solid var(--primary-color);
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* トグルボタン */
.toggle-container {
    display: flex;
    gap: 12px;
}

.toggle-container input[type="radio"] {
    display: none;
}

.toggle-btn {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    padding: 12px 8px;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn small {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
}

.toggle-container input[type="radio"]:checked + .toggle-btn {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

/* ステージ演出 */
.visual-section {
    margin-bottom: 24px;
}

.room-stage {
    position: relative;
    width: 100%;
    height: 180px;
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px dashed rgba(255,255,255,0.1);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.room-bg {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 20px;
    background: rgba(255,255,255,0.05); /* Floor */
    border-top: 1px solid rgba(255,255,255,0.1);
}

.boxes-container {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    flex-wrap: wrap-reverse;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    z-index: 2;
}

.box-item {
    font-size: 2.5rem;
    line-height: 1;
    opacity: 0; /* JSで落下アニメーション付与時に1にする */
}

/* ダンボール落下アニメ */
.box-item.drop {
    animation: box-drop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes box-drop {
    0% { transform: translateY(-200px) rotate(-15deg); opacity: 0; }
    60% { transform: translateY(10px) rotate(5deg); opacity: 1; }
    80% { transform: translateY(-5px) rotate(-2deg); opacity: 1; }
    100% { transform: translateY(0) rotate(0deg); opacity: 1; }
}

/* 巨大スタンプ */
.stamp-overlay {
    position: absolute;
    z-index: 10;
    color: var(--stamp-red);
    border: 6px solid var(--stamp-red);
    border-radius: 16px;
    padding: 16px 24px;
    text-align: center;
    transform: rotate(-8deg) scale(0); /* Hide initially */
    background: rgba(20,25,30,0.8);
    backdrop-filter: blur(4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 15px rgba(220, 38, 38, 0.2);
    opacity: 0;
}

.stamp-overlay.hit {
    animation: stamp-smash 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes stamp-smash {
    0% { transform: rotate(-8deg) scale(3); opacity: 0; }
    50% { transform: rotate(-8deg) scale(0.9); opacity: 1; }
    70% { transform: rotate(-8deg) scale(1.05); opacity: 1; }
    100% { transform: rotate(-10deg) scale(1); opacity: 1; }
}

.stamp-text {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.stamp-price {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.2;
    margin: 4px 0;
    color: #fff;
    text-shadow: 0 0 10px var(--stamp-red);
}

.stamp-sub {
    font-size: 1rem;
    font-weight: 900;
}


/* 内訳リスト */
.breakdown-card {
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.05);
}

.breakdown-card h3 {
    font-size: 1rem;
    font-weight: 800;
    color: #cbd5e1;
    margin-bottom: 16px;
    text-align: center;
}

.cost-list {
    list-style: none;
    font-size: 0.9rem;
    color: #94a3b8;
}

.cost-list li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    align-items: center;
}

.cost-list li strong {
    color: #f8fafc;
    font-variant-numeric: tabular-nums;
}

.cost-list li.separator {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 12px 0;
}

.cost-list li.total-row {
    font-size: 1.1rem;
    font-weight: 900;
    color: #f59e0b;
}

.cost-list li.total-row .total-val {
    font-size: 1.4rem;
    color: #fef3c7;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.cost-hint {
    margin-top: 16px;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
}
