/* Simple Calculator — 큰 글씨 시니어 친화 버전 (고대비, 큰 버튼)
   테마가 button 스타일을 덮어쓰지 못하도록 #sc-app 으로 우선순위를 높였습니다. */

#sc-app.sc-wrap {
    --sc-bg: #1c1c1e;
    --sc-display: #000;
    --sc-btn-num: #3a3a3d;
    --sc-btn-fn: #c7c7cc;
    --sc-btn-op: #ff9f0a;
    --sc-text: #fff;

    width: 100%;
    max-width: 680px;
    container-type: inline-size;
    margin: 0 auto;
    background: var(--sc-bg);
    border-radius: 24px;
    padding: 14px;
    box-sizing: border-box;
    font-family: "Malgun Gothic", "맑은 고딕", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--sc-text);
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

#sc-app *, #sc-app *::before, #sc-app *::after { box-sizing: border-box; }

/* ===== 결과 화면 ===== */
#sc-app .sc-display {
    background: var(--sc-display);
    border-radius: 16px;
    padding: 16px 20px 10px;
    text-align: right;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-bottom: 14px;
    overflow: hidden;
}

#sc-app .sc-history-line {
    color: #b0b0b5;
    font-size: 30px;
    line-height: 1.3;
    min-height: 40px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sc-app .sc-expression {
    color: #ffd60a;
    font-size: 56px;
    font-weight: 600;
    line-height: 1.25;
    min-height: 70px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sc-app .sc-result {
    color: #fff;
    font-size: 150px;          /* JS가 길이에 맞춰 자동 조절 */
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
}

#sc-app .sc-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

#sc-app .sc-btn.sc-icon {
    width: 64px;
    height: 64px;
    aspect-ratio: auto;
    font-size: 34px !important;
    font-weight: 400 !important;
    background: #2c2c2e;
    color: #fff;
    border-radius: 16px;
}

#sc-app .sc-btn.sc-icon:hover,
#sc-app .sc-btn.sc-icon:active {
    background: #48484a;
}

/* ===== 기록 / 즐겨찾기 패널 ===== */
#sc-app .sc-panel {
    background: #2c2c2e;
    border-radius: 14px;
    margin-bottom: 14px;
    max-height: 280px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#sc-app .sc-panel[hidden] { display: none; }

#sc-app .sc-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid #48484a;
    position: sticky;
    top: 0;
    background: #2c2c2e;
}

#sc-app .sc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#sc-app .sc-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #48484a;
    font-size: 22px;
    cursor: pointer;
}

#sc-app .sc-list li:last-child { border-bottom: none; }
#sc-app .sc-list li:active { background: #48484a; }

#sc-app .sc-list .sc-item-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

#sc-app .sc-list .sc-item-expr {
    color: #c7c7cc;
    font-size: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#sc-app .sc-list .sc-item-val {
    font-weight: 800;
    font-size: 32px;
    color: #fff;
}

#sc-app .sc-list .sc-item-btns {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

#sc-app .sc-list .sc-item-star,
#sc-app .sc-list .sc-item-del {
    background: #3a3a3c;
    border: none;
    color: #fff;
    font-size: 28px;
    min-width: 52px;
    min-height: 52px;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 12px;
}

#sc-app .sc-list .sc-item-star:active { color: #ffd60a; }
#sc-app .sc-list .sc-item-del:active { color: #ff453a; }

#sc-app .sc-list .sc-empty {
    padding: 22px 16px;
    color: #c7c7cc;
    font-size: 22px;
    text-align: center;
    cursor: default;
}

/* ===== 말로 계산하기 (마이크) ===== */
#sc-app .sc-voice { margin-bottom: 14px; }

#sc-app .sc-mic {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    min-height: 108px;
    margin: 0;
    padding: 10px 16px;
    border: none;
    border-radius: 22px;
    background: #0a84ff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    font-family: inherit;
    font-size: 46px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: filter 0.08s ease, transform 0.05s ease;
}

#sc-app .sc-mic .sc-mic-ico { font-size: 1.15em; line-height: 1; }
#sc-app .sc-mic:hover { filter: brightness(1.1); }
#sc-app .sc-mic:active { filter: brightness(0.8); transform: scale(0.98); }
#sc-app .sc-mic:focus-visible { outline: 4px solid #ffd60a; outline-offset: 3px; }

#sc-app .sc-mic.sc-listening {
    background: #ff3b30;
    animation: sc-pulse 1.2s ease-in-out infinite;
}

@keyframes sc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.65); }
    50%      { box-shadow: 0 0 0 16px rgba(255, 59, 48, 0); }
}

@media (prefers-reduced-motion: reduce) {
    #sc-app .sc-mic.sc-listening { animation: none; }
}

#sc-app .sc-voice-status {
    margin-top: 10px;
    padding: 14px 18px;
    min-height: 72px;
    border-radius: 14px;
    background: #2c2c2e;
    color: #fff;
    font-size: 30px;
    font-weight: 600;
    line-height: 1.45;
    word-break: keep-all;
}

#sc-app .sc-voice-status.sc-ok  { color: #8dffa8; }
#sc-app .sc-voice-status.sc-err { color: #ffb3ae; }

/* ===== 키패드 ===== */
#sc-app .sc-pad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

#sc-app .sc-btn {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    border-radius: 22px;
    aspect-ratio: 1 / 0.85;
    width: 100%;
    min-height: 90px;
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: 72px !important;
    font-size: 20cqw !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    background: var(--sc-btn-num);
    color: var(--sc-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: none;
    letter-spacing: 0;
    transition: filter 0.08s ease, transform 0.05s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#sc-app .sc-btn:hover { filter: brightness(1.15); }
#sc-app .sc-btn:active { filter: brightness(0.7); transform: scale(0.96); }
#sc-app .sc-btn:focus-visible { outline: 4px solid #0a84ff; outline-offset: 2px; }

#sc-app .sc-btn.sc-fn {
    background: var(--sc-btn-fn);
    color: #000;
    font-size: 64px !important;
    font-size: 18cqw !important;
}

#sc-app .sc-btn.sc-op {
    background: var(--sc-btn-op);
    color: #fff;
    font-size: 84px !important;
    font-size: 24cqw !important;
}

#sc-app .sc-btn.sc-eq {
    background: #34c759;
    color: #fff;
    font-size: 84px !important;
    font-size: 24cqw !important;
}

#sc-app .sc-btn.sc-mini {
    background: #3a3a3c;
    border-radius: 12px;
    aspect-ratio: auto;
    width: auto;
    min-height: 48px;
    color: #64d2ff;
    font-size: 22px !important;
    font-weight: 700 !important;
    padding: 6px 14px;
}

/* ===== 작은 화면(휴대폰) : 화면 폭에 비례해 줄임 ===== */
@media (max-width: 480px) {
    #sc-app.sc-wrap { padding: 8px; border-radius: 18px; }
    #sc-app .sc-pad { gap: 8px; }
    #sc-app .sc-display { min-height: 200px; padding: 12px 14px 8px; }
    #sc-app .sc-btn { min-height: 76px; }
    #sc-app .sc-btn.sc-icon { width: 56px; height: 56px; min-height: 0; font-size: 28px !important; }
    #sc-app .sc-btn.sc-mini { font-size: 20px !important; min-height: 44px; }
    #sc-app .sc-expression { font-size: 40px; }
    #sc-app .sc-mic { min-height: 92px; font-size: 34px !important; gap: 12px; }
    #sc-app .sc-voice-status { font-size: 24px; min-height: 60px; padding: 10px 14px; }
}
