html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: #1e2430;
}

#app {
    height: 100%;
}

.game-shell {
    position: relative;
    width: 100%;
    height: 100%;
}

.game-shell canvas.scene {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

/* 공통 */
:root {
    --bg: #1e2430;
    --panel: rgba(24, 29, 39, 0.92);
    --panel-solid: #f7f8fa;
    --line: #3a4252;
    --text: #e8ebf0;
    --muted: #9aa3b2;
    --accent: #4f9cf0;
    --ok: #3fb37f;
    --warn: #e0a83a;
    --bad: #e05a4f;
    font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
    color: var(--text);
}

.btn {
    font: inherit;
    border: 1px solid var(--line);
    background: transparent;
    color: inherit;
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
}

.btn:hover { border-color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--lg { font-size: 1.15rem; padding: 0.7rem 2.4rem; }
.btn--chip { padding: 0.2rem 0.55rem; font-size: 0.85rem; }
.btn--chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--ghost { color: #44506a; border-color: #c9cfda; }

/* 첫 화면 */
.start {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
    padding: 0 1rem;
}

.start h1 { margin: 0; font-size: 2.2rem; }
.start p { margin: 0 0 1rem; color: var(--muted); }

/* HUD */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.2rem;
    padding: 0.5rem 1rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
}

.hud__group { display: flex; align-items: center; gap: 0.4rem; }
.hud__group--end { margin-left: auto; }
.hud__label { color: var(--muted); font-size: 0.8rem; }
.hud__date { font-variant-numeric: tabular-nums; }
.hud__paused { color: var(--warn); font-weight: 600; }
.hud__day, .hud__gauge {
    display: inline-block;
    width: 80px;
    height: 8px;
    background: var(--line);
    border-radius: 4px;
    overflow: hidden;
}
.hud__day { width: 48px; height: 4px; }
.hud__day > span, .hud__gauge > span { display: block; height: 100%; background: var(--accent); }
.hud__gauge > span { background: var(--ok); }
.hud__face--happy { color: var(--ok); }
.hud__face--angry { color: var(--bad); }
.is-soon { color: var(--warn); }
.is-late { color: var(--bad); font-weight: 600; }

/* 폼 패널 */
.form-panel {
    position: absolute;
    top: 3rem;
    right: 0;
    bottom: 0;
    z-index: 20;
    width: min(560px, 100%);
    overflow-y: auto;
    background: var(--panel-solid);
    color: #1f2633;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.35);
}

.erp-form { padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.erp-form__title { display: flex; justify-content: space-between; align-items: center; }
.erp-form__title h2 { margin: 0; font-size: 1.2rem; }
.erp-form fieldset { border: 1px solid #d5dae3; border-radius: 6px; padding: 0.6rem 0.8rem; margin: 0; }
.erp-form legend { padding: 0 0.3rem; font-weight: 600; font-size: 0.9rem; }
.erp-form__header { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
.erp-field { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; }
.erp-field__req { color: var(--bad); font-style: normal; }
.erp-form input {
    font: inherit;
    padding: 0.3rem 0.4rem;
    border: 1px solid #c9cfda;
    border-radius: 4px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
.erp-form table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 0.5rem; }
.erp-form th { text-align: left; font-weight: 600; padding: 0.3rem; border-bottom: 1px solid #d5dae3; }
.erp-form td { padding: 0.2rem; }
.erp-form td:first-child { color: #6b7587; white-space: nowrap; }
.erp-form__message { margin: 0; padding: 0.5rem 0.7rem; border-radius: 4px; font-size: 0.9rem; }
.erp-form__message.is-error { background: #fdecea; color: #a83228; }
.erp-form__message.is-ok { background: #e7f6ee; color: #1f7a4f; }
.erp-form__actions { display: flex; justify-content: flex-end; }

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #3a4252;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #4f9cf0;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

/* ── 판매 시나리오 (TASK-QG-017) ───────────────────────────── */
.objectives {
    position: absolute;
    top: 64px;
    left: 14px;
    width: 280px;
    max-height: calc(100% - 84px);
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(6px);
    font-size: 0.88rem;
}
.objectives__title { margin: 0 0 10px; font-size: 1rem; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.steps__item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; color: var(--muted); }
.steps__no {
    width: 22px; height: 22px; flex: none; border-radius: 50%;
    display: grid; place-items: center; font-size: 0.75rem; font-weight: 700;
    background: #2c3443; color: var(--muted);
}
.steps__item.is-done { color: #b9c7d6; }
.steps__item.is-done .steps__no { background: var(--ok); color: #fff; }
.steps__item.is-current { background: rgba(255, 176, 32, 0.16); color: #fff; font-weight: 700; }
.steps__item.is-current .steps__no { background: #ffb020; color: #1f2a3a; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 176, 32, 0.25); } }
.objectives__hint {
    margin: 12px 0; padding: 10px 12px; border-radius: 8px;
    background: rgba(79, 156, 240, 0.16); border-left: 3px solid var(--accent); line-height: 1.45;
}
.objectives__score { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 2px 10px; border-bottom: 1px solid var(--line); }
.objectives__score strong { font-size: 1.4rem; color: #ffd36b; font-variant-numeric: tabular-nums; }
.objectives__sub { margin: 10px 0 6px; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; line-height: 1.35; }
.log li { padding-left: 8px; border-left: 2px solid var(--ok); animation: slidein 0.35s ease-out; }
.log li.is-error { border-left-color: var(--bad); color: #ffb3ab; }
.log time { display: block; color: var(--muted); font-size: 0.7rem; }
.log__empty { color: var(--muted); border-left-color: var(--line) !important; }
@keyframes slidein { from { opacity: 0; transform: translateX(-8px); } }

.toast {
    position: absolute; top: 66px; left: 50%; transform: translateX(-50%);
    background: rgba(24, 29, 39, 0.94); color: #fff; padding: 10px 20px; border-radius: 999px;
    border: 1px solid var(--ok); font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: toastin 0.3s ease-out; white-space: nowrap; pointer-events: none; z-index: 20;
}
.toast.is-error { border-color: var(--bad); color: #ffd1cc; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -10px); } }

.erp-form__module {
    display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em;
    padding: 1px 7px; border-radius: 4px; background: #e3edfb; color: #2f6fc0; margin-bottom: 2px;
}
.erp-form__intro { margin: 0; font-size: 0.86rem; color: #4b5568; line-height: 1.5; }
.erp-form select { width: 100%; padding: 0.35rem 0.4rem; border: 1px solid #c9cfda; border-radius: 4px; font: inherit; font-size: 0.85rem; background: #fff; }
.erp-form input[readonly] { background: #f0f2f5; color: #3d4657; }
.erp-form legend .btn { margin-left: 6px; color: #2f6fc0; border-color: #a9c4ea; background: #fff; }
.erp-form td.num { text-align: right; font-variant-numeric: tabular-nums; }
.erp-form td.empty { color: #8a93a3; text-align: center; padding: 0.6rem; }
.erp-form__checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.badge.is-ok { background: #e3f5ec; color: #1f7a4f; }
.badge.is-bad { background: #fdecea; color: #a83228; }
.form-panel { animation: panelin 0.25s ease-out; }
@keyframes panelin { from { opacity: 0; transform: translateX(24px); } }

.result-backdrop {
    position: absolute; inset: 0; display: grid; place-items: center;
    background: rgba(10, 14, 22, 0.45); z-index: 30; animation: fadein 0.3s ease-out;
}
@keyframes fadein { from { opacity: 0; } }
.result {
    width: min(440px, calc(100% - 32px)); background: var(--panel-solid); color: #1f2a3a;
    border-radius: 16px; padding: 26px 28px 20px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: popin 0.35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes popin { from { transform: scale(0.85); opacity: 0; } }
.result__badge { font-size: 3rem; line-height: 1; }
.result h2 { margin: 8px 0 4px; font-size: 1.6rem; }
.result__summary { margin: 0 0 16px; color: #4b5568; font-size: 0.92rem; }
.result__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.result__stats div { background: #fff; border: 1px solid #e1e5ec; border-radius: 10px; padding: 10px 6px; display: flex; flex-direction: column; gap: 4px; }
.result__stats span { font-size: 0.75rem; color: #6b7587; }
.result__stats strong { font-size: 1.05rem; }
.result__stats small { color: var(--ok); font-weight: 700; }
.result .is-ok { color: #1f7a4f; }
.result .is-bad { color: #a83228; }
.result h3 { margin: 0 0 6px; font-size: 0.85rem; color: #6b7587; text-align: left; }
.result__docs { list-style: none; margin: 0 0 16px; padding: 0; text-align: left; }
.result__docs li { display: flex; justify-content: space-between; padding: 6px 4px; border-bottom: 1px dashed #d5dae3; font-size: 0.9rem; }
.result__docs code { font-weight: 700; color: #2f6fc0; }
.result footer { display: flex; justify-content: center; gap: 10px; }
