/* ═══════════════════════════════════════════
   ① 全域重置：讓 html/body 佔滿真實視窗
      overflow:hidden 避免出現捲軸
   ═══════════════════════════════════════════ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* 禁止捲軸 */
    background: #0d0d1a;
    /* 畫布外的背景色 */
    font-family: 'Noto Sans TC', sans-serif;
}

/* ═══════════════════════════════════════════
   ② 舞台容器（Stage）
      - 固定邏輯尺寸 500 × 850px
      - transform-origin: top left → scale 從左上角展開
      - position: absolute → 由 JS 置中
      ★ 所有子元件的 px 值都相對於這個邏輯尺寸
   ═══════════════════════════════════════════ */
#stage {
    position: absolute;
    width: 500px;
    height: 850px;
    transform-origin: top left;
    /* JS 會動態設定 transform: scale() / left / top */

    display: flex;
    flex-direction: column;

    background: linear-gradient(160deg, #1a1a3e 0%, #0f2027 60%, #0d1b2a 100%);
    overflow: hidden;
}

/* ─── 掃光裝飾 ─── */
#stage::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 40% at 50% 0%,
            rgba(120, 80, 255, 0.18) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ═══════════════════════════════════════════
   ③ 標題欄（Header）
      ★ 字體用 px（在 scale 容器內不受系統字體影響）
   ═══════════════════════════════════════════ */
#header {
    position: relative;
    z-index: 1;
    flex: 0 0 70px;
    /* 固定高度 70px（邏輯px） */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(160, 120, 255, 0.25);
    backdrop-filter: blur(8px);
}

#header .logo {
    font-size: 22px;
    /* ★ px，不用 rem/em */
    font-weight: 700;
    letter-spacing: 2px;
    color: #c8aaff;
    text-shadow: 0 0 20px rgba(180, 130, 255, 0.6);
}

#header .subtitle {
    font-size: 12px;
    color: rgba(200, 180, 255, 0.5);
    letter-spacing: 1px;
}

#scale-info {
    font-size: 11px;
    color: rgba(160, 140, 255, 0.4);
    text-align: right;
}

/* ═══════════════════════════════════════════
   ④ 主內容區（Content）
   ═══════════════════════════════════════════ */
#content {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 28px 30px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* 隱藏捲軸但保留功能 */
#content::-webkit-scrollbar {
    display: none;
}

#content {
    scrollbar-width: none;
}

/* ─── 表單群組 ─── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ─── Label ─── */
label {
    font-size: 13px;
    /* ★ px */
    font-weight: 600;
    color: rgba(200, 180, 255, 0.75);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

/* ─── 共用 input 樣式 ─── */
.field {
    width: 100%;
    font-family: inherit;
    font-size: 15px;
    /* ★ px */
    color: #e8e0ff;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(160, 120, 255, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    /* ★ appearance: none 防止 iOS/Safari 加上預設樣式 */
    -webkit-appearance: none;
    appearance: none;
}

.field:focus {
    border-color: rgba(160, 120, 255, 0.8);
    background: rgba(160, 120, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(160, 120, 255, 0.15);
}

/* ─── 下拉式選單 ─── */
select.field {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a080ff' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

select.field option {
    background: #1e1040;
    color: #e8e0ff;
}

/* ─── 多行輸入 ─── */
textarea.field {
    resize: none;
    height: 110px;
    line-height: 1.6;
}

/* ─── 說明 label（非標題用） ─── */
.info-label {
    background: rgba(100, 70, 200, 0.15);
    border: 1px solid rgba(160, 120, 255, 0.2);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 13px;
    color: rgba(220, 210, 255, 0.7);
    line-height: 1.7;
}

.info-label strong {
    color: #c8aaff;
    font-weight: 600;
}

/* ─── 按鈕 ─── */
.btn {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    /* ★ px */
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s, opacity 0.15s;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #7c3aed, #a855f7, #6d28d9);
    color: #fff;
    box-shadow: 0 4px 24px rgba(140, 60, 255, 0.4);
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.12));
    pointer-events: none;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(140, 60, 255, 0.5);
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 12px rgba(140, 60, 255, 0.3);
}

.btn-secondary {
    background: transparent;
    color: rgba(200, 180, 255, 0.8);
    border: 1px solid rgba(160, 120, 255, 0.35);
}

.btn-secondary:hover {
    background: rgba(160, 120, 255, 0.1);
}

.btn-secondary:active {
    background: rgba(160, 120, 255, 0.05);
}

/* ─── 按鈕列 ─── */
.btn-row {
    display: flex;
    gap: 12px;
}

.btn-row .btn {
    flex: 1;
}

/* ═══════════════════════════════════════════
   ⑤ 狀態欄（Status Bar）
   ═══════════════════════════════════════════ */
#statusbar {
    position: relative;
    z-index: 1;
    flex: 0 0 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(0, 0, 0, 0.35);
    border-top: 1px solid rgba(160, 120, 255, 0.2);
    font-size: 12px;
    /* ★ px */
    color: rgba(180, 160, 255, 0.55);
    letter-spacing: 0.8px;
}

#status-text {
    transition: color 0.3s;
}

#status-text.ok {
    color: #7dd3a8;
}

#status-text.err {
    color: #f87171;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}