/* ===== Douyin Calculator Collection - Visual Storyteller Enhancements ===== */
/* Golden sci-fi theme with refined visual hierarchy, micro-interactions, and polish */

/* ─── Keyframes ─── */
@keyframes logoPulse {
    0%, 100% { opacity: .5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}
@keyframes tabFadeIn {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
    0% { opacity: 0; max-height: 0; }
    100% { opacity: 1; max-height: 100px; }
}
@keyframes resultPop {
    0% { transform: scale(.8); opacity: 0; }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-4px); }
    30%, 70% { transform: translateX(4px); }
}
@keyframes particleFloat {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
    10% { opacity: .6; }
    90% { opacity: .4; }
    100% { transform: translateY(-120px) translateX(40px) rotate(360deg); opacity: 0; }
}
@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(212, 175, 55, 0.2); }
    50% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.5); }
}
@keyframes countUp {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes copyFlash {
    0% { background: rgba(212, 175, 55, 0.3); }
    100% { background: transparent; }
}
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}
@keyframes rippleAnim {
    0% { transform: scale(0); opacity: .6; }
    100% { transform: scale(4); opacity: 0; }
}
@keyframes goldGlow {
    0%, 100% { opacity: .4; }
    50% { opacity: .8; }
}
@keyframes logoRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes contentSlideIn {
    0% { opacity: 0; transform: translateY(6px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes numberJump {
    0% { transform: translateY(0); }
    25% { transform: translateY(-6px); }
    50% { transform: translateY(0); }
}
@keyframes sectionReveal {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

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

:root {
    /* Gold palette */
    --gold: #d4af37;
    --gold-light: #ffd700;
    --gold-dark: #b8860b;
    --gold-glow: rgba(212, 175, 55, 0.3);
    --gold-glow-soft: rgba(212, 175, 55, 0.15);
    --gold-subtle: rgba(212, 175, 55, 0.08);

    /* Background */
    --bg-primary: #0a0a0f;
    --bg-secondary: #121218;
    --bg-card: rgba(18, 18, 28, 0.85);
    --bg-card-hover: rgba(24, 24, 36, 0.9);
    --bg-input: rgba(10, 10, 18, 0.6);
    --bg-input-focus: rgba(16, 16, 28, 0.7);
    --bg-section: rgba(10, 10, 18, 0.4);
    --bg-radio-hover: rgba(212, 175, 55, 0.06);

    /* Text */
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0c0;
    --text-muted: rgba(255, 255, 255, 0.45);
    --text-label: var(--gold);

    /* Borders */
    --border-color: rgba(212, 175, 55, 0.25);
    --border-hover: rgba(212, 175, 55, 0.5);
    --border-focus: rgba(212, 175, 55, 0.7);

    /* Geometry */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 4px 20px rgba(212, 175, 55, 0.15);
    --shadow-gold-strong: 0 4px 30px rgba(212, 175, 55, 0.25);

    /* Typography */
    --font: 'Noto Sans SC', 'Segoe UI', 'Microsoft YaHei', -apple-system, sans-serif;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(20,15,30,.8) 0, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(30,25,15,.6) 0, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(15,20,30,.5) 0, transparent 50%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 16px;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: rgba(212,175,55,.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,175,55,.5); }

/* ─── Container ─── */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 20px auto;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), var(--shadow-gold);
    padding: 32px;
    border: 1px solid var(--border-color);
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    animation: contentSlideIn .5s ease-out;
}
.container:hover {
    box-shadow: var(--shadow-lg), var(--shadow-gold-strong);
}

.content { position: relative; z-index: 2; }

/* ─── Header ─── */
header {
    position: relative;
    text-align: center;
    margin-bottom: 28px;
    padding-bottom: 28px;
}
header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), var(--gold-light), var(--gold), transparent);
    border-radius: 1px;
}
.logo { display: flex; justify-content: center; margin-bottom: 20px; }
.logo-icon-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, rgba(212,175,55,.25) 0, rgba(212,175,55,.08) 50%, transparent 75%);
    border: 2px solid rgba(212,175,55,.45);
    box-shadow: 0 0 40px rgba(212,175,55,.25), inset 0 0 40px rgba(212,175,55,.06);
    position: relative;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.logo-icon-wrapper::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1.5px solid rgba(212,175,55,.12);
    animation: logoPulse 3s ease-in-out infinite;
}
.logo-icon-wrapper::after {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 1px dashed rgba(212,175,55,.08);
    animation: logoRing 12s linear infinite;
}
.logo-icon-wrapper i {
    font-size: 3rem;
    filter: drop-shadow(0 0 12px rgba(255,215,0,.5));
    color: var(--gold-light);
    transition: transform var(--transition);
}
.logo-icon-wrapper:hover i {
    transform: scale(1.1);
}
header h1 {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 40%, var(--gold-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
    text-shadow: none;
    position: relative;
}
header h1::after {
    display: none;
}
header p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin: 8px auto 0;
    max-width: 500px;
    font-weight: 400;
    line-height: 1.7;
}

/* ─── Tabs ─── */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
    border-bottom: 1px solid rgba(212,175,55,.15);
    flex-wrap: wrap;
    gap: 0;
    position: relative;
}
.tab-btn {
    position: relative;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
    outline: none;
    font-family: var(--font);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.tab-btn i {
    font-size: .9rem;
    opacity: .6;
    transition: opacity var(--transition);
}
.tab-btn::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 70%;
    height: 2.5px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 1.5px;
    transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.tab-btn.active {
    color: var(--gold-light);
}
.tab-btn.active::after {
    transform: translateX(-50%) scaleX(1);
}
.tab-btn.active i {
    opacity: 1;
}
.tab-btn:hover:not(.active) {
    color: rgba(255,215,0,.6);
}
.tab-btn:hover:not(.active) i {
    opacity: .8;
}
.tab-btn:active {
    transform: scale(.97);
}

.tab-content {
    display: none;
    animation: tabFadeIn .4s ease;
}
.tab-content.active {
    display: block;
}

/* ─── Form Section Labels ─── */
.form-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: .8px;
    padding-bottom: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(212,175,55,.12);
}
.form-section-label i {
    font-size: .78rem;
    opacity: .8;
}

/* ─── Form Elements ─── */
.form-group {
    margin-bottom: 24px;
    padding: 16px 16px 8px;
    background: rgba(10,10,18,.2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(212,175,55,.06);
    transition: border-color var(--transition);
}
.form-group:focus-within {
    border-color: rgba(212,175,55,.15);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: .95rem;
    color: var(--text-label);
    letter-spacing: .3px;
}
.label-with-help {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.label-with-help label {
    margin-bottom: 0;
}
.input-container {
    position: relative;
    margin-bottom: 20px;
}

input[type=number],
input[type=text],
select {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    background: var(--bg-input);
    color: var(--gold-light);
    font-weight: 500;
    font-family: var(--font);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    outline: none;
}
input::placeholder {
    color: rgba(212,175,55,.4);
}
input:focus,
select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(212,175,55,.15), 0 0 20px rgba(212,175,55,.1);
    background: var(--bg-input-focus);
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23d4af37' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding: 14px 44px 14px 18px;
    cursor: pointer;
}
select option {
    background: var(--bg-secondary);
    color: var(--gold-light);
    padding: 8px;
}

/* ─── Input Validation States ─── */
input.input-error {
    border-color: #ff6b6b !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15) !important;
    animation: shakeX .4s ease;
}
input.input-success {
    border-color: #51cf66 !important;
    box-shadow: 0 0 0 3px rgba(81, 207, 102, 0.15) !important;
}
.validation-hint {
    font-size: .82rem;
    color: var(--text-muted);
    margin-top: 4px;
    padding-left: 4px;
    display: none;
}
.validation-hint.visible { display: block; }
.validation-hint.error { color: #ff6b6b; }
.validation-hint.success { color: #51cf66; }

/* ─── Radio / Checkbox Groups ─── */
.radio-group {
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-section);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: border-color var(--transition);
}
.radio-option {
    display: flex;
    align-items: center;
    margin: 10px 0;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
    cursor: pointer;
    background: rgba(255,255,255,.03);
    border: 1px solid transparent;
}
.radio-option:first-child {
    margin-top: 0;
}
.radio-option:last-child {
    margin-bottom: 0;
}
.radio-option:hover {
    background: var(--bg-radio-hover);
    border-color: rgba(212,175,55,.2);
    transform: translateX(4px);
}
.radio-option label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}
.radio-option label i {
    font-size: .9rem;
    opacity: .7;
    width: 18px;
    text-align: center;
}
.radio-option:has(input:checked) {
    background: rgba(212,175,55,.08);
    border-color: rgba(212,175,55,.25);
}
.radio-option:has(input:checked) label i {
    opacity: 1;
    color: var(--gold-light);
}
.custom-days-input {
    margin-top: 12px;
    margin-left: 40px;
    display: none;
    width: calc(100% - 40px);
    animation: slideDown .3s ease;
}
.checkbox-container {
    display: flex;
    align-items: center;
    margin: 16px 0;
    padding: 14px 16px;
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--transition);
}
.checkbox-container:hover {
    border-color: var(--border-hover);
}
.checkbox-container input[type=checkbox],
.radio-option input[type=radio] {
    width: 20px;
    height: 20px;
    margin-right: 14px;
    accent-color: var(--gold);
    cursor: pointer;
    flex-shrink: 0;
}
.checkbox-container label,
.radio-option label {
    margin-bottom: 0;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
}

/* ─── Help Tooltip ─── */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(212,175,55,.5);
    color: var(--gold);
    font-size: .7rem;
    font-weight: 700;
    cursor: help;
    position: relative;
    transition: border-color var(--transition), background var(--transition);
    flex-shrink: 0;
    line-height: 1;
}
.help-icon:hover {
    border-color: var(--gold-light);
    background: rgba(212,175,55,.1);
}
.help-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: .82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    z-index: 100;
    box-shadow: var(--shadow-md);
    min-width: 200px;
    text-align: left;
    font-weight: 400;
    line-height: 1.5;
}
.help-icon:hover .help-tooltip {
    display: block;
    animation: fadeInUp .2s ease;
}
.help-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-color);
}

/* ─── Presets / Quick Entry ─── */
.presets-section {
    margin: 16px 0;
    padding: 16px;
    background: var(--bg-section);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: border-color var(--transition);
}
.presets-title {
    font-size: .82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}
.presets-title i {
    font-size: .75rem;
    opacity: .7;
}
.presets-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.preset-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(212,175,55,.1), rgba(169,130,18,.06));
    border: 1px solid rgba(212,175,55,.3);
    border-radius: var(--radius-sm);
    color: var(--gold-light);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.preset-btn .preset-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    font-size: .78rem;
}
.preset-btn .preset-icon i {
    font-size: .78rem;
}
.preset-btn:hover {
    background: linear-gradient(135deg, rgba(212,175,55,.2), rgba(169,130,18,.12));
    box-shadow: 0 0 14px rgba(212,175,55,.25);
    transform: translateY(-2px);
    border-color: rgba(212,175,55,.5);
}
.preset-btn:active {
    transform: translateY(0) scale(.97);
}

/* ─── Progress Indicator ─── */
.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 12px 0;
    position: relative;
}
.progress-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: .85rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: color var(--transition);
}
.progress-step .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    border: 1.5px solid rgba(255,255,255,.15);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 700;
    transition: all var(--transition);
    flex-shrink: 0;
}
.progress-step.active .step-number {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border-color: var(--gold);
    color: #1a1a1a;
    box-shadow: 0 0 15px rgba(212,175,55,.35);
}
.progress-step.completed .step-number {
    background: rgba(81, 207, 102, 0.15);
    border-color: #51cf66;
    color: #51cf66;
}
.progress-step.active {
    color: var(--gold-light);
}
.progress-step.completed {
    color: #51cf66;
}
.progress-step .step-label {
    white-space: nowrap;
}
.progress-connector {
    width: 24px;
    height: 2px;
    background: rgba(255,255,255,.1);
    border-radius: 1px;
    transition: background var(--transition);
}
.progress-step.active + .progress-connector,
.progress-step.completed + .progress-connector {
    background: rgba(212,175,55,.3);
}

/* ─── Result Container ─── */
.result-container {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(16,16,28,.92), rgba(24,20,12,.92));
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    text-align: center;
    margin-top: 24px;
    min-height: 180px;
    flex-direction: column;
    justify-content: center;
    box-shadow: var(--shadow-md), inset 0 0 40px rgba(212,175,55,.06);
    position: relative;
    overflow: hidden;
}
.result-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(212,175,55,.06) 0, transparent 35%),
        radial-gradient(circle at 80% 70%, rgba(212,175,55,.06) 0, transparent 35%);
    pointer-events: none;
}
.result-container::after {
    content: "";
    position: absolute;
    top: -1px;
    left: 25%;
    right: 25%;
    height: 1.5px;
    background: linear-gradient(90deg, transparent, rgba(212,175,55,.4), transparent);
    border-radius: 50%;
    pointer-events: none;
}
.result-container h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
    color: var(--gold);
    z-index: 1;
    font-weight: 600;
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.result-container h2 i {
    font-size: 1.1rem;
    opacity: .8;
}
.result-pk-count,
.result-value {
    font-size: 3.6rem;
    font-weight: 800;
    color: var(--gold-light);
    text-shadow: 0 0 30px rgba(255,215,0,.45), 0 2px 4px rgba(0,0,0,.3);
    letter-spacing: -1px;
    margin: 8px 0;
    z-index: 1;
    animation: resultPop .5s cubic-bezier(.34,1.56,.64,1);
    line-height: 1.2;
}
.waiting-input {
    text-align: center;
    font-size: 1.4rem;
    color: var(--text-muted);
    font-weight: 400;
    padding: 16px 0;
    z-index: 1;
}
.result-info {
    font-size: 1rem;
    margin-top: 8px;
    color: var(--text-secondary);
    font-weight: 400;
    z-index: 1;
    line-height: 1.6;
}
.peak-pk-text {
    font-size: 1.4rem;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255,215,0,.2);
    font-weight: 600;
    letter-spacing: .5px;
    margin-bottom: 6px;
    z-index: 1;
}
.result-votes-info {
    font-size: 1rem;
    margin-top: 6px;
    color: var(--text-secondary);
    font-weight: 400;
    z-index: 1;
}
.cannot-achieve {
    font-size: 2.4rem;
    color: #ff6b6b;
    font-weight: 800;
    text-shadow: 0 0 20px rgba(255,107,107,.4);
    z-index: 1;
    animation: shakeX .6s ease;
}
.error-info {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 8px;
    z-index: 1;
}

/* ─── Breakdown Section ─── */
.breakdown-section {
    margin-top: 12px;
    padding: 14px 18px;
    background: rgba(10,10,18,.5);
    border-radius: var(--radius-md);
    border: 1px solid rgba(212,175,55,.12);
    font-size: .85rem;
    color: var(--text-secondary);
    text-align: left;
    z-index: 1;
    width: 100%;
    max-width: 500px;
    animation: fadeInUp .35s ease;
}
.breakdown-section .breakdown-title {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.breakdown-section .breakdown-note {
    display: block;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
}
.breakdown-item {
    padding: 3px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.breakdown-item .breakdown-label {
    color: var(--text-muted);
}
.breakdown-item .breakdown-value {
    color: var(--gold-light);
    font-weight: 600;
}

/* ─── Copy Button ─── */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 8px 16px;
    background: rgba(212,175,55,.08);
    border: 1px solid rgba(212,175,55,.3);
    border-radius: var(--radius-sm);
    color: var(--gold-light);
    font-size: .82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    z-index: 1;
    position: relative;
    overflow: hidden;
}
.copy-btn:hover {
    background: rgba(212,175,55,.18);
    box-shadow: 0 0 12px rgba(212,175,55,.15);
    transform: translateY(-1px);
}
.copy-btn:active {
    transform: translateY(0) scale(.97);
}
.copy-btn.copied {
    animation: copyFlash .5s ease;
    border-color: #51cf66;
    color: #51cf66;
}

/* ─── Rank Reference Table ─── */
.rank-section {
    margin-top: 32px;
    padding: 24px;
    background: var(--bg-section);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: border-color var(--transition);
}
.rank-section h3 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--gold-light);
    font-weight: 700;
    font-size: 1.2rem;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(212,175,55,.15);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.rank-section h3 i {
    font-size: 1rem;
    opacity: .8;
}
.rank-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    justify-items: center;
}
.rank-table {
    width: 100%;
    max-width: 220px;
    background: rgba(255,255,255,.03);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(212,175,55,.15);
    transition: transform var(--transition), box-shadow var(--transition);
}
.rank-table:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(212,175,55,.1);
}
.rank-table-title {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #1a1a1a;
    padding: 12px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.rank-table-title i {
    font-size: .85rem;
}
.rank-table table {
    width: 100%;
    border-collapse: collapse;
}
.rank-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(212,175,55,.1);
    color: var(--text-secondary);
    font-size: .9rem;
}
.rank-table tr:nth-child(even) {
    background: rgba(255,255,255,.02);
}
.rank-table tr:last-child td {
    border-bottom: none;
}
.rank-table tr:hover {
    background: rgba(212,175,55,.05);
}

/* ─── Controls & Action Buttons ─── */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
    padding: 16px;
    background: var(--bg-section);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.action-button {
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(212,175,55,.12), rgba(169,130,18,.08));
    border: 1px solid rgba(212,175,55,.4);
    border-radius: var(--radius-sm);
    color: var(--gold-light);
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 600;
    font-size: .95rem;
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}
.action-button::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(212,175,55,.15), transparent 70%);
    opacity: 0;
    transition: opacity var(--transition);
}
.action-button:hover {
    background: linear-gradient(135deg, rgba(212,175,55,.2), rgba(169,130,18,.15));
    box-shadow: 0 0 18px rgba(212,175,55,.25);
    transform: translateY(-2px);
}
.action-button:hover::before {
    opacity: 1;
}
.action-button:active {
    transform: translateY(0) scale(.97);
}
.action-button i {
    font-size: 1rem;
    position: relative;
    z-index: 1;
}

/* ─── Gift Table ─── */
.table-container {
    overflow-x: auto;
    margin-bottom: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-section);
}
#calculation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
#calculation-table th {
    background: linear-gradient(180deg, rgba(212,175,55,.15), rgba(169,130,18,.08));
    color: var(--gold-light);
    font-weight: 700;
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid rgba(212,175,55,.2);
    white-space: nowrap;
    font-size: .85rem;
}
#calculation-table td {
    height: 60px;
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid rgba(212,175,55,.08);
    color: var(--text-secondary);
    vertical-align: middle;
}
#calculation-table tr:hover {
    background: rgba(212,175,55,.04);
}
#calculation-table tr.total-row {
    background: linear-gradient(180deg, rgba(212,175,55,.1), rgba(169,130,18,.05)) !important;
}
#calculation-table tr.total-row td {
    font-weight: 700;
    border-top: 2px solid rgba(212,175,55,.3);
}
#calculation-table input[type=number],
#calculation-table input[type=text] {
    height: 36px;
    width: 100%;
    padding: 8px 10px;
    background: rgba(0,0,0,.3);
    border: 1px solid rgba(212,175,55,.25);
    border-radius: 6px;
    color: var(--gold-light);
    text-align: center;
    font-weight: 500;
    font-size: .9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: var(--font);
    outline: none;
}
#calculation-table input[type=number]:focus,
#calculation-table input[type=text]:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(212,175,55,.12);
}
#calculation-table input[type=number]::-webkit-inner-spin-button {
    opacity: .5;
}
.total-value {
    font-size: 1.15rem;
    color: var(--gold-light) !important;
    font-weight: 800 !important;
}
.total-value.flash-update {
    animation: resultPop .3s cubic-bezier(.34,1.56,.64,1);
}
.diamond-checkbox {
    text-align: center;
}
.diamond-checkbox input[type=checkbox] {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
    cursor: pointer;
}
.add-gift-row td {
    padding: 12px;
    border-bottom: none !important;
}
.add-gift-button,
.delete-button {
    height: 36px;
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 600;
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.add-gift-button {
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(212,175,55,.12), rgba(169,130,18,.08));
    border: 1px solid rgba(212,175,55,.4);
    border-radius: var(--radius-sm);
    color: var(--gold-light);
    font-size: .9rem;
}
.add-gift-button:hover {
    background: linear-gradient(135deg, rgba(212,175,55,.2), rgba(169,130,18,.15));
    box-shadow: 0 0 14px rgba(212,175,55,.2);
    transform: translateY(-2px);
}
.add-gift-button:active {
    transform: translateY(0) scale(.97);
}
.delete-button {
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(220,53,69,.15), rgba(169,18,18,.08));
    border: 1px solid rgba(220,53,69,.4);
    border-radius: 6px;
    color: #ff6b6b;
    font-size: .85rem;
}
.delete-button:hover {
    background: linear-gradient(135deg, rgba(220,53,69,.25), rgba(169,18,18,.15));
    box-shadow: 0 0 12px rgba(220,53,69,.2);
    transform: translateY(-1px);
}
.delete-button:active {
    transform: translateY(0) scale(.97);
}

/* ─── Footer ─── */
.footer-info {
    text-align: center;
    margin-top: 32px;
    color: var(--text-muted);
    font-size: .85rem;
    padding: 16px;
    border-radius: var(--radius-md);
    background: rgba(10,10,18,.3);
    border: 1px solid rgba(212,175,55,.08);
}
.footer-info i {
    font-size: .75rem;
    margin-right: 3px;
    opacity: .5;
}
.footer-version {
    opacity: .3;
    font-size: 10px;
}

/* ─── Particles & Decorations ─── */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}
.particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212,175,55,.3), transparent 70%);
    animation: particleFloat 15s infinite linear;
}
.gold-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
}
.gold-line {
    position: absolute;
    background: linear-gradient(90deg, transparent, rgba(212,175,55,.15), transparent);
    height: 1px;
}
.gold-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 1.5px solid rgba(212,175,55,.3);
    opacity: .6;
}
.corner-tl,
.corner-tr {
    top: 12px;
    border-bottom: none;
}
.corner-tl {
    left: 12px;
    border-right: none;
}
.corner-tr {
    right: 12px;
    border-left: none;
}
.corner-bl,
.corner-br {
    bottom: 12px;
    border-top: none;
}
.corner-bl {
    left: 12px;
    border-right: none;
}
.corner-br {
    right: 12px;
    border-left: none;
}

/* ─── Form section animations ─── */
.form-section {
    animation: sectionReveal .35s ease;
}

/* ─── Responsive ─── */
@media (max-width: 992px) {
    .container {
        padding: 24px 20px;
        margin: 12px auto;
    }
    header h1 {
        font-size: 2rem;
    }
    .rank-tables {
        gap: 12px;
    }
    .rank-table {
        max-width: none;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 20px 16px;
        border-radius: var(--radius-lg);
    }
    header {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
    header h1 {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }
    header p {
        font-size: .9rem;
    }
    .logo-icon-wrapper {
        width: 68px;
        height: 68px;
    }
    .logo-icon-wrapper i {
        font-size: 2.2rem;
    }
    .logo-icon-wrapper::after {
        display: none;
    }
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0;
        padding-bottom: 2px;
    }
    .tab-btn {
        padding: 12px 16px;
        font-size: .85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .tab-btn::after {
        width: 60%;
    }
    .tab-btn i {
        font-size: .8rem;
    }
    .result-pk-count,
    .result-value {
        font-size: 2.4rem;
    }
    .result-container h2,
    .waiting-input {
        font-size: 1.1rem;
    }
    .result-container {
        padding: 24px 20px;
        min-height: 130px;
    }
    .peak-pk-text,
    .rank-section h3 {
        font-size: 1.2rem;
    }
    .cannot-achieve {
        font-size: 1.8rem;
    }
    input[type=number],
    input[type=text],
    select {
        padding: 12px 16px;
        font-size: 1rem;
    }
    .form-group {
        padding: 12px 12px 4px;
    }
    .radio-group {
        padding: 12px;
    }
    .radio-option {
        padding: 10px 12px;
        margin: 8px 0;
    }
    .custom-days-input {
        margin-left: 36px;
        width: calc(100% - 36px);
    }
    .controls {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    .action-buttons {
        width: 100%;
        justify-content: center;
    }
    .action-button {
        width: 100%;
    }
    .rank-tables {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .rank-table {
        max-width: none;
    }
    .rank-section {
        padding: 16px;
    }
    #calculation-table {
        font-size: .8rem;
    }
    #calculation-table td,
    #calculation-table th {
        padding: 8px 6px;
    }
    #calculation-table td {
        height: 52px;
        padding: 6px 8px;
        font-size: .8rem;
    }
    .total-value {
        font-size: 1rem;
    }
    .footer-info {
        font-size: .78rem;
        padding: 12px;
    }
    .error-info,
    .result-info,
    .result-votes-info {
        font-size: .9rem;
    }
    .progress-bar {
        flex-wrap: wrap;
        gap: 4px;
    }
    .progress-step {
        padding: 4px 10px;
        font-size: .8rem;
    }
    .progress-step .step-number {
        width: 24px;
        height: 24px;
        font-size: .72rem;
    }
    .progress-connector {
        width: 16px;
    }
    .preset-btn {
        font-size: .8rem;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 14px 10px;
        border-radius: var(--radius-md);
    }
    header {
        margin-bottom: 16px;
        padding-bottom: 16px;
    }
    header h1 {
        font-size: 1.25rem;
        letter-spacing: 1px;
    }
    header p {
        font-size: .82rem;
    }
    .logo-icon-wrapper {
        width: 56px;
        height: 56px;
        min-height: 56px;
    }
    .logo-icon-wrapper i {
        font-size: 1.8rem;
    }
    .logo-icon-wrapper::after {
        display: none;
    }
    .tab-btn {
        padding: 10px 12px;
        font-size: .78rem;
    }
    .tab-btn i {
        display: none;
    }
    .result-pk-count,
    .result-value {
        font-size: 1.8rem;
    }
    .cannot-achieve {
        font-size: 1.3rem;
    }
    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    .action-button {
        width: 100%;
    }
    #calculation-table td,
    #calculation-table th {
        padding: 6px 4px;
        font-size: .72rem;
    }
    #calculation-table input[type=number],
    #calculation-table input[type=text] {
        height: 32px;
        padding: 4px 6px;
        font-size: .72rem;
    }
    .rank-table-title {
        font-size: .85rem;
        padding: 10px;
    }
    .rank-table td {
        padding: 7px;
        font-size: .82rem;
    }
    .result-container {
        padding: 18px 14px;
        min-height: 110px;
    }
    .preset-btn {
        font-size: .75rem;
        padding: 5px 10px;
    }
    .preset-btn .preset-icon i {
        font-size: .7rem;
    }
    .form-section-label {
        font-size: .75rem;
    }
}
