/* ========== 样式文件: style.css ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-blur: 12px;
    --card-bg: rgba(255, 255, 255, 0.92);
    --border-radius: 20px;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --mode-bg: rgba(255, 255, 255, 0.7);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #0f172a;
    position: relative;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -2;
}

.background-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: -1;
}

/* 主容器 - 垂直布局 */
.card {
    width: 100%;
    max-width: 550px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-bottom: 16px;
}

.title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1e293b, #2d3a4e);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 12px;
}

.mode-switch {
    display: flex;
    background: var(--mode-bg);
    border-radius: 40px;
    padding: 4px;
    margin-bottom: 16px;
    gap: 6px;
}

.mode-btn {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    border-radius: 32px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--text-dark);
}

.mode-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}

.time-ranges {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    max-height: 50vh;
    overflow-y: auto;
}

.time-item {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.time-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 6px;
}

.time-field {
    flex: 1;
}

.time-field label {
    display: block;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 2px;
}

.time-field input {
    width: 100%;
    padding: 8px 6px;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 0.85rem;
    text-align: center;
    font-family: monospace;
    background: white;
}

.time-field input:focus {
    outline: none;
    border-color: var(--primary);
}

.delete-btn {
    width: 40px;
    height: 40px;
    background: var(--danger);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:active { transform: scale(0.95); }

.cross-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 4px;
}

.cross-option input { width: 14px; height: 14px; accent-color: var(--primary); }
.cross-option label { font-size: 0.7rem; color: var(--text-light); }

.add-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 40px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.add-btn:active { transform: scale(0.98); }

/* 计算器模式样式 */
.calculator-panel {
    display: none;
    background: rgba(30, 41, 59, 0.95);
    border-radius: 24px;
    padding: 16px;
    margin-bottom: 12px;
}

.calc-expression-full {
    background: rgba(15, 23, 42, 0.9);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-family: monospace;
    min-height: 36px;
    max-height: 36px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scroll-behavior: smooth;
    display: flex;
    align-items: center;
}

.calc-expression-full::-webkit-scrollbar {
    height: 3px;
}

.calc-expression-full::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.calc-expression-full::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 3px;
}

.history-placeholder {
    color: #64748b;
    font-size: 0.7rem;
    opacity: 0.7;
    white-space: nowrap;
}

.history-item {
    display: inline-block;
    color: #94a3b8;
    font-size: 0.7rem;
    padding: 0 4px;
    white-space: nowrap;
}

.history-operator {
    display: inline-block;
    color: #3b82f6;
    font-weight: 600;
    padding: 0 4px;
}

.history-number {
    display: inline-block;
    color: #e2e8f0;
    font-weight: 500;
}

.history-equal {
    display: inline-block;
    color: #10b981;
    font-weight: 600;
    padding: 0 4px;
}

.calc-screen {
    background: #0f172a;
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 12px;
    text-align: right;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    min-height: 70px;
}

.calc-current {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: monospace;
    color: #e2e8f0;
    letter-spacing: 2px;
    transition: all 0.15s ease;
    line-height: 1.3;
}

.calc-current.preview {
    color: #94a3b8;
    opacity: 0.7;
}

.calc-current.highlight {
    animation: highlightFlash 0.3s ease-out;
}

@keyframes highlightFlash {
    0% { transform: scale(1); color: #e2e8f0; }
    30% { transform: scale(1.05); color: #10b981; text-shadow: 0 0 8px rgba(16,185,129,0.5); }
    100% { transform: scale(1); color: #e2e8f0; }
}

.calc-input-area {
    background: #1e293b;
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 12px;
    text-align: center;
}

.input-label {
    font-size: 0.6rem;
    color: #94a3b8;
    margin-bottom: 2px;
}

.input-value {
    font-size: 1.3rem;
    font-weight: 600;
    font-family: monospace;
    color: #f1f5f9;
    letter-spacing: 2px;
}

.calc-keyboard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.calc-key {
    padding: 14px 8px;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.08s linear;
    font-family: monospace;
}

.calc-key:active {
    transform: scale(0.94);
}

.key-number {
    background: #334155;
    color: #f1f5f9;
}

.key-operator {
    background: #3b82f6;
    color: white;
    font-size: 1.4rem;
}

.key-clear, .key-clear-all {
    background: #ef4444;
    color: white;
}

.key-delete {
    background: #f59e0b;
    color: white;
}

.key-equal {
    background: #10b981;
    color: white;
    font-size: 1.4rem;
    grid-column: span 4;
}

.extra-section {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    padding: 10px;
    margin-bottom: 12px;
}

.extra-title {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.extra-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.extra-field { flex: 1; }
.extra-field label { font-size: 0.6rem; color: var(--text-light); }
.extra-field input {
    width: 100%;
    padding: 8px;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    text-align: center;
    background: white;
}

.separator { font-weight: 600; }
.hint { font-size: 0.6rem; margin-top: 6px; color: var(--text-light); }
.badge {
    font-size: 0.6rem;
    background: rgba(59,130,246,0.2);
    padding: 2px 6px;
    border-radius: 20px;
    color: var(--primary-dark);
}

.calc-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    border: none;
    border-radius: 40px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 12px;
}

.result-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 10px;
}

.result-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 4px;
}

.result-value {
    width: 100%;
    padding: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    font-family: monospace;
    background: white;
    border-radius: 14px;
}

/* 页脚使用说明样式 */
.footer-instructions {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.instructions-details {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.instructions-summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-dark);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: all 0.2s;
}

.instructions-summary::-webkit-details-marker {
    display: none;
}

.instructions-summary:hover {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
}

.summary-icon {
    font-size: 1rem;
    margin-right: 8px;
}

.summary-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
    opacity: 0.6;
}

details[open] .summary-arrow {
    transform: rotate(180deg);
}

.instructions-content {
    padding: 12px 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease;
}

.instruction-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.instruction-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-icon {
    font-size: 1rem;
}

.section-content {
    font-size: 0.7rem;
    color: var(--text-light);
    line-height: 1.5;
}

.section-content p {
    margin-bottom: 6px;
}

.section-content ul {
    margin: 6px 0;
    padding-left: 20px;
}

.section-content li {
    margin: 4px 0;
}

.section-content code, .section-content kbd {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.7rem;
}

.sub-section {
    margin-top: 8px;
    padding-left: 8px;
    border-left: 2px solid var(--primary);
}

.example-box {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 0.7rem;
}

.note-box {
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 0.7rem;
    color: var(--success-dark);
}

.tips-section {
    background: rgba(245, 158, 11, 0.08);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 0;
}

.tips-section .section-title {
    color: #d97706;
}

.footer-note {
    text-align: center;
    font-size: 0.6rem;
    color: var(--text-light);
    padding-top: 10px;
    margin-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    opacity: 0.7;
}

/* 版权信息样式 - 页面底部居中 */
.copyright-footer {
    text-align: center;
    padding: 8px 12px 12px 12px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
}

.copyright-separator {
    opacity: 0.4;
}

.copyright-footer a {
    color: rgba(59, 130, 246, 0.8);
    text-decoration: none;
    transition: all 0.2s;
}

.copyright-footer a:hover {
    color: #3b82f6;
    text-decoration: underline;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.time-item { animation: fadeIn 0.2s ease; }

/* 移动端适配 */
@media (max-width: 480px) {
    body { padding: 8px; }
    .card { padding: 10px; }
    .calc-screen { padding: 10px 12px; min-height: 60px; }
    .calc-current { font-size: 1.4rem; }
    .input-value { font-size: 1.1rem; }
    .calc-key { padding: 10px 6px; font-size: 1rem; }
    .calc-keyboard { gap: 6px; }
    .delete-btn { width: 36px; height: 36px; }
    .calc-expression-full { min-height: 32px; max-height: 32px; padding: 6px 10px; }
    .history-item, .history-operator, .history-number, .history-equal { font-size: 0.65rem; }
    .instructions-summary { padding: 8px 12px; font-size: 0.75rem; }
    .instructions-content { padding: 10px 12px; }
    .section-title { font-size: 0.8rem; }
    .section-content { font-size: 0.65rem; }
    .section-content ul { padding-left: 16px; }
    .copyright-footer { padding: 6px 10px 10px 10px; font-size: 0.6rem; gap: 6px; }
}

.time-ranges::-webkit-scrollbar { width: 3px; }
.time-ranges::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); border-radius: 10px; }
.time-ranges::-webkit-scrollbar-thumb { background: rgba(59, 130, 246, 0.5); border-radius: 10px; }

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .instructions-details { background: rgba(255, 255, 255, 0.05); }
    .section-content code, .section-content kbd { background: rgba(255, 255, 255, 0.1); color: #e2e8f0; }
    .example-box { background: rgba(59, 130, 246, 0.15); }
    .note-box { background: rgba(16, 185, 129, 0.15); }
    .tips-section { background: rgba(245, 158, 11, 0.1); }
}