Files
youlegames/codes/minipro/calculation/miniprogram/pages/calculator/calculator.wxss
2026-02-08 15:43:32 +08:00

435 lines
8.3 KiB
Plaintext

/* pages/calculator/calculator.wxss */
/* ========== 全局 ========== */
page {
height: 100%;
background-color: #EBF4F8; /* Color 03 (Background) */
display: flex;
flex-direction: column;
}
.calculator-container {
display: flex;
flex-direction: column;
height: 100%;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
/* ========== 显示区域 ========== */
.display-area {
flex: 1;
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: flex-end;
padding: 30rpx 40rpx 20rpx;
background: transparent; /* No more dark gradient */
position: relative;
overflow: hidden;
}
/* 顶部工具栏 */
.display-top-bar {
position: absolute;
top: 20rpx;
left: 30rpx;
right: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 10;
}
.top-actions {
display: flex;
gap: 20rpx;
}
.action-btn {
width: 72rpx;
height: 72rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: #ffffff;
box-shadow: 0 4rpx 12rpx rgba(17, 97, 107, 0.15); /* Teal shadow */
}
.action-icon {
font-size: 36rpx;
color: #11616B; /* Color 01 */
}
/* 模式切换 */
.mode-indicator {
display: flex;
background: #ffffff;
padding: 6rpx;
border-radius: 16rpx; /* Reduced radius */
box-shadow: 0 4rpx 12rpx rgba(17, 97, 107, 0.1);
}
.mode-indicator text {
color: #7BBDB6; /* Color 02 */
font-size: 26rpx;
padding: 10rpx 30rpx;
border-radius: 12rpx; /* Reduced radius */
background: transparent;
border: none;
font-weight: 500;
transition: all 0.2s ease;
}
.mode-indicator text.active {
color: #ffffff;
background: #11616B; /* Color 01 */
font-weight: 600;
box-shadow: 0 2rpx 8rpx rgba(17, 97, 107, 0.2);
}
/* 表达式行 */
.history-text {
font-size: 32rpx;
color: rgba(17, 97, 107, 0.6); /* Color 01 faded */
min-height: 44rpx;
margin-bottom: 12rpx;
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
text-align: right;
width: 100%;
letter-spacing: 2rpx;
}
/* 当前值 */
.current-value {
font-size: 130rpx;
color: #11616B; /* Color 01 (Deep Teal) */
line-height: 1.1;
font-weight: 200;
word-break: break-all;
text-align: right;
width: 100%;
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
}
.current-value.shrink {
font-size: 90rpx;
}
.current-value.shrink-more {
font-size: 62rpx;
}
/* ========== 键盘区域 ========== */
.keypad-area {
background: #EBF4F8; /* Color 03 */
padding: 16rpx 24rpx 24rpx;
display: flex;
flex-direction: column;
gap: 20rpx;
}
.keypad-area.scientific-pad {
gap: 14rpx;
padding-bottom: 20rpx;
}
/* 行 */
.row {
display: flex;
justify-content: space-between;
gap: 20rpx;
}
.keypad-area.scientific-pad .row {
gap: 14rpx;
}
.small-row {
justify-content: space-around;
gap: 8rpx;
}
/* ========== 按钮通用 ========== */
.btn {
width: 152rpx;
height: 152rpx;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 56rpx;
font-weight: 400;
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
position: relative;
overflow: hidden;
box-shadow: 0 4rpx 10rpx rgba(17, 97, 107, 0.05); /* Very subtle shadow */
}
/* 数字键 */
.digit {
background-color: #ffffff;
color: #11616B; /* Color 01 */
}
/* 功能键 (AC, +/-, %) */
.func {
background-color: #7BBDB6; /* Color 02 (Medium Teal) */
color: #ffffff;
font-size: 46rpx;
font-weight: 500;
}
/* 运算符 */
.operator {
background-color: #FED9CD; /* Color 04 (Pale Pink/Peach) */
color: #DC8B70; /* Color 05 (Terracotta) for contrast */
font-size: 64rpx;
font-weight: 400;
}
/* 等号键:渐变突出 */
.equal {
background: #11616B; /* Color 01 (Deep Teal) */
color: #ffffff;
box-shadow: 0 6rpx 20rpx rgba(17, 97, 107, 0.3);
}
/* 0键 */
.zero {
width: 324rpx;
border-radius: 76rpx;
justify-content: flex-start;
padding-left: 62rpx;
box-sizing: border-box;
}
/* 点击反馈 */
.btn-hover {
transform: scale(0.92);
opacity: 0.9;
}
/* 科学模式缩放 */
.keypad-area.scientific-pad .btn {
width: 130rpx;
height: 130rpx;
font-size: 48rpx;
}
.keypad-area.scientific-pad .zero {
width: 274rpx;
border-radius: 65rpx;
}
.keypad-area.scientific-pad .func {
font-size: 40rpx;
}
.keypad-area.scientific-pad .operator {
font-size: 54rpx;
}
/* 科学功能键 */
.sci-btn {
width: 120rpx !important;
height: 120rpx !important;
font-size: 32rpx !important;
background: rgba(17, 97, 107, 0.05) !important; /* Very light teal bg */
color: #11616B !important; /* Color 01 */
border-radius: 50% !important;
font-weight: 500 !important;
letter-spacing: 1rpx;
}
/* ========== 历史记录面板 ========== */
.history-panel {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 100;
pointer-events: none;
opacity: 0;
}
.history-panel.show {
pointer-events: auto;
opacity: 1;
}
.history-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(17, 97, 107, 0.4); /* Color 01 dim */
}
.history-content {
position: relative;
z-index: 101;
background: #EBF4F8; /* Color 03 */
border-radius: 0 0 16rpx 16rpx; /* Reduced radius */
max-height: 70vh;
display: flex;
flex-direction: column;
box-shadow: 0 16rpx 48rpx rgba(17, 97, 107, 0.2);
}
.history-panel.show .history-content {
animation: histSlideDown 0.3s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}
@keyframes histSlideDown {
from { transform: translateY(-100%); }
to { transform: translateY(0); }
}
.history-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 36rpx 40rpx;
border-bottom: 2rpx solid rgba(17, 97, 107, 0.1);
}
.history-title {
color: #11616B; /* Color 01 */
font-size: 34rpx;
font-weight: 600;
letter-spacing: 1rpx;
}
.history-clear {
color: #DC8B70; /* Color 05 */
font-size: 28rpx;
padding: 8rpx 24rpx;
border-radius: 20rpx;
background: rgba(220, 139, 112, 0.15); /* Color 05 faint */
}
.history-list {
max-height: 58vh;
padding: 10rpx 0;
}
.history-item {
padding: 28rpx 40rpx;
border-bottom: 1rpx solid rgba(17, 97, 107, 0.08); /* Darker border for light bg */
display: flex;
flex-direction: column;
align-items: flex-end;
}
.history-item:active {
background: rgba(17, 97, 107, 0.05); /* Dark interaction state */
}
.history-expr {
color: rgba(17, 97, 107, 0.6); /* Color 01 faded - Visible on light bg */
font-size: 26rpx;
margin-bottom: 8rpx;
font-family: -apple-system, 'SF Pro Display', monospace;
}
.history-result {
color: #11616B; /* Color 01 - Visible High Contrast */
font-size: 42rpx;
font-weight: 500;
font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
}
.history-empty {
text-align: center;
padding: 100rpx 0;
color: rgba(17, 97, 107, 0.4);
font-size: 28rpx;
}
.history-empty-icon {
font-size: 64rpx;
display: block;
margin-bottom: 16rpx;
opacity: 0.5;
}
/* Help Panel Styles */
.help-list {
padding: 0; /* padding moved to inner section to avoid scroll-view width issues */
}
.help-section {
display: flex;
flex-direction: column;
gap: 40rpx;
padding: 30rpx 40rpx 60rpx; /* Apply padding here */
box-sizing: border-box;
}
.help-item {
display: flex;
gap: 24rpx;
align-items: flex-start;
}
.help-icon {
font-size: 44rpx;
width: 60rpx;
text-align: center;
padding-top: 4rpx;
}
.help-text {
flex: 1;
display: flex;
flex-direction: column;
}
.help-h1 {
font-size: 30rpx;
font-weight: bold;
color: #11616B; /* Color 01 */
margin-bottom: 12rpx;
}
.help-p {
font-size: 26rpx;
color: #2d3436;
line-height: 1.6;
opacity: 0.8;
}
.share-btn-large {
background-color: #11616B !important; /* Color 01 */
color: white !important;
border-radius: 16rpx !important; /* Unified radius */
font-size: 30rpx !important;
font-weight: 500 !important;
margin-top: 20rpx;
width: 100% !important;
box-shadow: 0 8rpx 20rpx rgba(17, 97, 107, 0.25);
display: flex;
align-items: center;
justify-content: center;
padding: 24rpx 0;
}
/* ========== 小屏适配 ========== */
@media (max-width: 360px) {
.btn {
width: 140rpx;
height: 140rpx;
font-size: 50rpx;
}
.zero {
width: 300rpx;
}
.current-value {
font-size: 110rpx;
}
}