/*
 * 计算器
 *
 * 版式照 Windows 计算器（开源版）的标准模式：
 *   标题栏 → 大号显示区 → 记忆键一排 → 六排按键（等号是蓝色实心）
 *
 * 没有历史列表：用户明确说不要「历史运算结果」，
 * 算过的就算了，别在面板里越堆越长。
 */

/* ---------- 卡片 ---------- */

.app-card--calc {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.app-icon.calc-mini {
    border: 0;
    padding: 0;
    cursor: pointer;
    /* 图标本身是一整块圆角图，别再叠底色 */
    background: transparent;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .5),
        0 6px 16px rgba(15, 23, 42, .16),
        0 1px 3px rgba(15, 23, 42, .12);
    transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease;
}

.app-icon.calc-mini:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .55),
        0 14px 28px rgba(15, 23, 42, .22);
}

.app-icon.calc-mini img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* ---------- 弹窗 ---------- */

.clc-panel {
    position: relative;
    width: min(356px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 0 0 8px;
    border-radius: 12px;
    background: #f3f3f3;
    color: #1a1a1a;
    box-shadow: 0 30px 80px rgba(8, 12, 22, .34);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.clc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px 2px 14px;
}

.clc-title {
    margin: 0;
    font-size: 12.5px;
    font-weight: 400;
    letter-spacing: .2px;
    color: #1a1a1a;
}

/* 关闭按钮：Windows 那种小方块，不是圆点 */
.clc-head .cs-x {
    position: static;
    width: 34px;
    height: 30px;
    border-radius: 6px;
    background: transparent;
    color: #4b4b4b;
    font-size: 17px;
    line-height: 1;
}

.clc-head .cs-x:hover {
    background: #e8e8e8;
}

/* ---------- 显示区 ---------- */

.clc-screen {
    position: relative;
    padding: 22px 16px 8px;
    text-align: right;
}

/* 记忆里有数的时候，显示区左上角挂一个 M */
.clc-mflag {
    position: absolute;
    top: 10px;
    left: 16px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .4px;
    color: #8a8a8a;
}

.clc-mflag[hidden] {
    display: none;
}

/* 算式行：小灰字，右对齐 */
.clc-expr {
    min-height: 18px;
    font-size: 13px;
    line-height: 18px;
    color: #6b6b6b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 结果：Windows 那种又大又细的数字 */
.clc-value {
    margin-top: 2px;
    min-height: 52px;
    font-size: 44px;
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: -.5px;
    color: #1a1a1a;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: font-size .12s ease;
}

/* 边打边算时的实时结果：淡一点、小一点 */
.clc-value.is-live {
    font-size: 26px;
    color: #767676;
}

.clc-value.is-long {
    font-size: 34px;
}

.clc-value.is-longer {
    font-size: 26px;
}

.clc-value.is-error {
    font-size: 20px;
    color: #c42b1c;
}

/* ---------- 记忆键 ---------- */

.clc-mem {
    display: flex;
    gap: 2px;
    padding: 0 10px 6px;
}

.clc-memkey {
    flex: 1;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #5f5f5f;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: .2px;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}

.clc-memkey:hover:not(:disabled) {
    background: #e6e6e6;
    color: #1a1a1a;
}

.clc-memkey:disabled {
    color: #c0c0c0;
    cursor: default;
}

/* ---------- 键盘 ---------- */

.clc-keys {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 0 8px;
}

.clc-key {
    height: 52px;
    padding: 0;
    border: 1px solid #e7e7e7;
    border-radius: 4px;
    background: #fbfbfb;
    color: #1a1a1a;
    font-family: inherit;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background .12s ease, border-color .12s ease;
}

/* 按键不要焦点环：点完留一圈框很脏 */
.clc-key:focus,
.clc-key:focus-visible {
    outline: none;
}

.clc-key:hover {
    background: #f3f3f3;
    border-color: #dedede;
}

.clc-key:active,
.clc-key.is-hit {
    background: #e8e8e8;
}

/* 上标下标（1/x、x²、²√x）排得紧一点 */
.clc-key sup,
.clc-key sub {
    font-size: .62em;
    line-height: 0;
}

.clc-key sup {
    vertical-align: .45em;
}

.clc-key sub {
    vertical-align: -.2em;
}

.clc-sqrt-x {
    font-style: italic;
    margin-left: 1px;
}

/* 等号：Windows 的蓝 */
.clc-key.is-eq {
    background: #0067c0;
    border-color: #0067c0;
    color: #ffffff;
    font-size: 20px;
}

.clc-key.is-eq:hover {
    background: #0a72ce;
    border-color: #0a72ce;
}

.clc-key.is-eq:active,
.clc-key.is-eq.is-hit {
    background: #005ba8;
}

/* ---------- 底部 ---------- */

.clc-foot {
    display: flex;
    justify-content: flex-end;
    padding: 6px 8px 0;
}

.clc-copy {
    padding: 6px 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #0067c0;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.clc-copy:hover {
    background: #e6e6e6;
}

@media (max-width: 820px) {
    .clc-panel {
        width: 100%;
        max-width: 420px;
    }
}

/*
 * 手机全屏：键盘吃掉剩余高度，每排等高。
 * 不然 6 排按键全堆在上半屏，下面露出一大片 #f3f3f3，看着像没渲染完。
 */
@media (max-width: 720px) {
    .clc-panel {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .clc-screen {
        flex: none;
        /* 显示区在手机上可以更舒展，数字大了反而好读 */
        padding-bottom: 18px;
    }

    .clc-mem {
        flex: none;
    }

    .clc-keys {
        flex: 1;
        grid-auto-rows: 1fr;
        padding-bottom: 10px;
    }

    .clc-key {
        height: auto;
        min-height: 44px;
        font-size: 19px;
    }

    .clc-foot {
        flex: none;
    }
}
