:root {
    --primary-color: #eab308; /* Yellow/Gold for Gacha */
    --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);
}

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

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

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

/* スライダー・トグル部 */
.slider-section {
    margin-bottom: 24px;
    background: rgba(0,0,0,0.3);
    padding: 20px;
    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);
    margin-bottom: 24px;
}

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;
}

/* 各ステージのトグル行 */
.stage-selections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stage-row > label {
    flex: 0 0 100px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #cbd5e1;
}

.toggle-container {
    flex: 1;
    display: flex;
    gap: 4px;
}

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

.toggle-btn {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    padding: 8px 4px;
    border-radius: 8px;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.2;
}

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

.toggle-container input[type="radio"]:checked + .toggle-btn {
    background: rgba(234, 179, 8, 0.15);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.2);
}

/* ガチャボタン */
.action-btn {
    width: 100%;
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #ca8a04, #eab308);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(234, 179, 8, 0.4);
    transition: all 0.2s;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(234, 179, 8, 0.6);
}
.action-btn:active {
    transform: translateY(0);
}

/* 演出ステージ */
.visual-section {
    position: relative;
    margin-bottom: 24px;
    background: rgba(0,0,0,0.5);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    height: 280px;
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    overflow: hidden;
}

.meter-wrapper {
    width: 160px;
    height: 100%;
    border-left: 2px dashed rgba(255,255,255,0.2);
    border-right: 2px dashed rgba(255,255,255,0.2);
    border-bottom: 4px solid #64748b;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

/* flex-direction: column-reverse を使うと下からスタックされる */
.meter-stage {
    width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column-reverse; /* 新しいDOMをappendした時に上に積まれるように */
    align-items: center;
}

.meter-block {
    width: 90%;
    border-radius: 4px;
    margin-top: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    /* JS側でheightとbackgroundを変更してアニメーションさせる */
    transition: height 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    opacity: 0;
    overflow: hidden;
}

/* 結果パネル */
.result-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
    background: rgba(15, 23, 42, 0.95);
    border: 3px solid var(--primary-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 30px rgba(234,179,8,0.2);
    z-index: 20;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-panel.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.result-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fef08a;
    margin-bottom: 8px;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 15px var(--primary-color);
    line-height: 1;
    margin-bottom: 16px;
}

.monthly-breakdown {
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.monthly-hl {
    color: #fca5a5;
    font-size: 1.4rem;
    font-weight: 900;
    text-shadow: 0 0 5px rgba(248, 113, 113, 0.5);
}

/* 内訳 */
.breakdown-section {
    margin-top: 10px;
}

.breakdown-card {
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.05);
}

.breakdown-card h3 {
    font-size: 0.9rem;
    color: #cbd5e1;
    margin-bottom: 12px;
    text-align: center;
}

.cost-hint-list {
    list-style: none;
    margin-bottom: 12px;
}

.cost-hint-list li {
    font-size: 0.8rem;
    color: #e2e8f0;
    margin-bottom: 4px;
    background: rgba(255,255,255,0.05);
    padding: 6px 10px;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.cost-hint {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.4;
}
