/* 计算器登录界面样式 - iOS风格 */

:root {
    --bg-color: #000;
    --text-color: #fff;
    --btn-dark-grey: #333333;
    --btn-light-grey: #a5a5a5;
    --btn-orange: #ff9f0a;
    --display-font-size: 80px;
    --btn-font-size: 32px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 强制覆盖父级容器样式，实现全屏 */
.calculator {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: var(--bg-color);
    color: var(--text-color);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* 桌面端适配：限制宽度并居中 */
body.platform-desktop .calculator {
    width: 375px;
    height: 812px;
    max-height: 90vh;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 40px;
    box-shadow: 0 0 0 10px #333, 0 0 50px rgba(0,0,0,0.5);
    overflow: hidden;
}

body.platform-desktop {
    background-color: #2c2c2c;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

/* 显示屏 */
.display {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 20px 20px 20px;
    overflow: hidden;
}

.display-text {
    font-size: var(--display-font-size);
    font-weight: 300;
    white-space: nowrap;
    line-height: 1;
    transition: font-size 0.2s;
}

/* 键盘区域 */
.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 12px;
    width: 100%;
    padding: 12px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}

/* 按钮 */
.btn {
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--btn-font-size);
    border-radius: 50%;
    aspect-ratio: 1 / 1;
    width: 100%;
    margin: 0;
    color: #fff;
    transition: opacity 0.2s, background-color 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* 颜色 */
.btn-dark-grey {
    background-color: var(--btn-dark-grey);
}

.btn-light-grey {
    background-color: var(--btn-light-grey);
    color: #000;
}

.btn-orange {
    background-color: var(--btn-orange);
}

/* 0键特殊处理 */
.btn-zero {
    grid-column: span 2;
    border-radius: 40px;
    aspect-ratio: auto;
    justify-content: flex-start;
    padding-left: 30px;
}

/* 点击反馈 */
.btn:active, .btn.active-touch {
    opacity: 0.7;
}

.btn-light-grey:active, .btn-light-grey.active-touch {
    background-color: #d9d9d9;
    color: #000;
    opacity: 1;
}

/* 适配小屏幕 */
@media (max-width: 350px) {
    :root {
        --display-font-size: 60px;
        --btn-font-size: 24px;
    }
    .keypad {
        gap: 8px;
        padding: 8px;
    }
}
