/* ============================================
   火车票纪念票生成器 — 全屏轮播主题 v4.0
   参考 hcp_html 布局：固定背景轮播 + 浮动内容

   ★ 快速调整轮播效果（修改此区域即可） ★
   ============================================ */

:root {
    color-scheme: light;

    /* ── 轮播遮罩 & 模糊（核心可配置项） ── */
    --slider-overlay-opacity: 0.18;    /* 遮罩不透明度 0~1 */
    --slider-blur: 4px;                /* 模糊半径；设 0 关闭模糊 */
    --slider-transition: 1.5s ease-in-out;  /* 切换过渡时长 */

    /* ── 12306 配色体系 ── */
    --blue-6: #0052D9;
    --blue-5: #1677FF;
    --blue-4: #4096FF;
    --blue-3: #69B1FF;
    --blue-2: #91CAFF;
    --blue-1: #BAE0FF;
    --blue-0: #E8F4FF;

    --gray-9: #1F1F1F;
    --gray-8: #262626;
    --gray-7: #434343;
    --gray-6: #595959;
    --gray-5: #737373;
    --gray-4: #8C8C8C;
    --gray-3: #A6A6A6;
    --gray-2: #D9D9D9;
    --gray-1: #E8E8E8;
    --gray-0: #F5F5F5;

    --red-5: #CF1322;
    --red-4: #F5222D;
    --red-3: #FF4D4F;
    --red-2: #FF7875;

    --bg-card: #ffffff;
    --border-color: rgba(200,210,220,.45);

    --text-primary: var(--gray-8);
    --text-secondary: var(--gray-5);
    --text-placeholder: var(--gray-4);

    /* 车票专用 */
    --ink: #263033;
    --muted: #6f7d80;
    --rail-red: #df7d72;
    --paper: #f6f4ef;
    --line: #94a7a9;
    --ticket-bg: #d8fffb;
    --ticket-deep: #63d6e2;

    /* 圆角 / 阴影 / 过渡 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.14), 0 4px 8px rgba(0,0,0,0.08);
    --transition: all .2s ease;
}

/* ========== Reset & Base ========== */

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    line-height: 1.5715;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

button,
input { font: inherit; }

/* ========== ════ 全屏背景轮播 ════ ========== */

.bg-slider {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
}

.slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    opacity: 0;
    transition: opacity var(--slider-transition);
}
.slide.active { opacity: 1; }

/* ── 遮罩 + 模糊叠加层 ──
   两个独立层叠在一起，分别控制遮罩和模糊。
   只需改 :root 的两个 CSS 变量即可全局调整。 ── */
.slider-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, var(--slider-overlay-opacity));
    backdrop-filter: blur(var(--slider-blur));
    -webkit-backdrop-filter: blur(var(--slider-blur));
}

/* ========== 轮播指示器（底部固定） ========== */

.slider-dots {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 100;
}

.dot {
    width: 11px; height: 11px;
    border-radius: 50%;
    background: rgba(255,255,255,.40);
    border: 1.5px solid rgba(255,255,255,.55);
    cursor: pointer;
    transition: all .35s ease;
}
.dot.active {
    background: rgba(255,255,255,.92);
    border-color: rgba(255,255,255,.95);
    transform: scale(1.25);
    box-shadow: 0 0 8px rgba(255,255,255,.35);
}
.dot:hover:not(.active) {
    background: rgba(255,255,255,.65);
    transform: scale(1.12);
}

/* ========== ════ 主内容容器 ════ ========== */

.content-wrap {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 0 56px;
}

/* 统一子元素宽度：顶栏 / 统计栏 / 上传区 / 票卡 / 空状态 / 页脚 全部等宽 */
.site-header,
.stats-bar,
.upload-card,
.ticket-grid,
.empty-state,
.site-footer {
    width: 100%;
}

/* ========== 顶栏（毛玻璃卡片） ========== */

.site-header {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.header-inner {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon { font-size: 26px; }

.brand-text {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--blue-6);
}

.header-nav { flex: 1; display: flex; justify-content: flex-end; }
.nav-hint {
    color: var(--text-secondary);
    font-size: 13px;
    letter-spacing: .3px;
}

/* ========== 按钮系统 ========== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 34px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    white-space: nowrap;
    outline: none;
    font-weight: 500;
}
.btn:hover:not(:disabled) { border-color: var(--blue-4); color: var(--blue-6); }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }

.btn-primary {
    background: var(--blue-6);
    border-color: var(--blue-6);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--blue-5);
    border-color: var(--blue-5);
    color: #fff;
}
.btn-primary:active:not(:disabled) {
    background: #003EB3;
    border-color: #003EB3;
}

.btn-default {
    background: #ffffff;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-default:hover:not(:disabled) {
    color: var(--blue-6);
    border-color: var(--blue-3);
}

.btn-danger-outline {
    background: transparent;
    border-color: var(--red-2);
    color: var(--red-5);
}
.btn-danger-outline:hover:not(:disabled) {
    background: rgba(245,34,45,.07);
    border-color: var(--red-3);
    color: var(--red-4);
}

/* ========== 统计栏 ========== */

.stats-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 13px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.stat-num {
    font-size: 25px;
    font-weight: 700;
    color: var(--blue-6);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 14px; color: var(--text-secondary); }

.stat-divider {
    width: 1px; height: 30px;
    background: var(--border-color);
}
.stat-spacer { flex: 1; }
.stat-actions { display: flex; gap: 8px; }

/* ========== 上传区域 ========== */

.upload-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--blue-2);
    transition: var(--transition);
    cursor: pointer;
    margin-bottom: 16px;
    overflow: hidden;
}
.upload-card:hover,
.upload-card.dragging {
    border-color: var(--blue-4);
    background: rgba(232,244,255,.88);
}

.upload-card-inner {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    padding: 42px 20px;
}

.upload-icon {
    width: 64px; height: 64px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--blue-0);
    transition: var(--transition);
}
.upload-card:hover .upload-icon {
    background: #D6EBFF;
    transform: scale(1.05);
}

.upload-text strong {
    display: block;
    font-size: 17px;
    color: var(--text-primary);
    font-weight: 600;
}
.upload-text p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    max-width: 380px;
}

.upload-card input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* ========== 车票卡片网格 ========== */

.ticket-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ticket-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: grid;
    gap: 0;
    transition: transform .2s ease, box-shadow .2s ease;
}
.ticket-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.ticket-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(to right, #fafcff, #f0f6ff);
    border-bottom: 1px solid var(--border-color);
}

.ticket-ops { display: flex; gap: 6px; }

/* 风格切换 */
.style-toggle {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-card);
}
.style-option {
    min-height: 28px;
    border: 0;
    border-right: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    padding: 0 10px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}
.style-option:last-child { border-right: 0; }
.style-option.active {
    background: var(--blue-6);
    color: #fff;
}
.style-option:hover:not(.active) {
    color: var(--blue-6);
    background: var(--blue-0);
}

/* ========== 车票渲染区（保持原有定位逻辑） ========== */

.ticket {
    position: relative;
    aspect-ratio: 1290 / 845;
    min-height: 0;
    overflow: hidden;
    border-radius: 0;
    background:
        url("../images/reference-ticket-clean.jpg?v=5") center / 106% 106% no-repeat;
    container-type: inline-size;
}

.ticket.ticket-style-pink {
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}
.ticket::before,
.ticket::after { display: none; }

.ticket.ticket-style-pink::before {
    content: "";
    display: block;
    position: absolute;
    inset: 4.3% 3.2%;
    z-index: 0;
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,.16) 0 2px, transparent 2px 8px),
        linear-gradient(0deg, rgba(255,203,199,.94), rgba(255,203,199,.94));
}
.ticket.ticket-style-pink::after {
    content: "";
    display: block;
    position: absolute;
    inset: 4.3% 3.2%;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 23%, rgba(255,255,255,.24), transparent 21%),
        radial-gradient(ellipse at 69% 28%, rgba(255,255,255,.18), transparent 24%);
    pointer-events: none;
}

/* mask 层 */
.ticket-mask {
    position: absolute;
    background: #d7fffb;
    z-index: 1;
    display: none;
}
.mask-code, .mask-from, .mask-train, .mask-to,
.mask-left-info, .mask-right-info, .mask-person,
.mask-notice, .mask-qr { display: none; }

/* 删除按钮 */
.delete-ticket {
    position: static !important;
    display: inline-flex;
    width: auto !important;
    height: 28px !important;
    border-radius: var(--radius-sm) !important;
    opacity: 1 !important;
}

/* 票号 */
.ticket-code {
    position: absolute;
    left: 6.3%; top: 7.1%;
    color: var(--rail-red);
    font-family: "Courier New", monospace;
    font-size: clamp(17px, 4.15cqw, 54px);
    letter-spacing: 0;
    z-index: 2;
    text-shadow: 0 .5px 0 rgba(215,255,251,.7);
}
.ticket.ticket-style-pink .ticket-code {
    left: 9.2%; top: 9.9%;
    color: #ff8a7f; text-shadow: none;
}

/* 水印 */
.train-watermark { display: none; }

/* 站名 */
.station {
    position: absolute; top: 17.6%; width: 31%;
    text-align: center; z-index: 2;
}
.station-from { left: 6.6%; }
.station-to { right: 6.6%; }
.ticket.ticket-style-pink .station { top: 22%; }
.ticket.ticket-style-pink .station-from { left: 7.8%; }
.ticket.ticket-style-pink .station-to { right: 8.8%; width: 29%; }

.station strong {
    display: block; font-size: clamp(29px, 6.85cqw, 88px);
    font-weight: 500; line-height: 1; white-space: nowrap;
    text-shadow: 0 1px 0 rgba(215,255,251,.7);
}
.station span {
    display: block; margin-top: 6%;
    color: var(--muted); font-size: clamp(13px, 3.05cqw, 38px);
    text-shadow: 0 .5px 0 rgba(215,255,251,.7);
}
.ticket.ticket-style-pink .station strong,
.ticket.ticket-style-pink .train-block strong,
.ticket.ticket-style-pink .depart, .ticket.ticket-style-pink .arrival,
.ticket.ticket-style-pink .price, .ticket.ticket-style-pink .source,
.ticket.ticket-style-pink .seat, .ticket.ticket-style-pink .person {
    color: #303437; text-shadow: none;
}
.ticket.ticket-style-pink .station span { color: #7d8587; text-shadow: none; }

/* 车次 */
.train-block {
    position: absolute; top: 18.5%; left: 41%; width: 18%;
    text-align: center; z-index: 2;
}
.ticket.ticket-style-pink .train-block { top: 22.5%; }

.train-block strong {
    display: block; font-size: clamp(21px, 5.05cqw, 64px);
    font-weight: 450; line-height: 1.1;
    text-shadow: 0 1px 0 rgba(215,255,251,.7);
}
.train-block i {
    display: block; width: 58%; height: 2px; margin: 8% auto 0;
    background: var(--ink); position: relative;
}
.train-block i::after {
    content: ""; position: absolute; right: -1px; top: -4px;
    border-left: 16px solid var(--ink);
    border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.ticket.ticket-style-pink .train-block i { background: #303437; }
.ticket.ticket-style-pink .train-block i::after { border-left-color: #303437; }

/* 出发/到达/价格/座位/乘客 */
.depart, .arrival, .price, .source, .seat, .person {
    position: absolute; color: #3f4f53;
    font-size: clamp(14px, 3.65cqw, 46px);
    line-height: 1.2; z-index: 2;
    text-shadow: 0 .5px 0 rgba(215,255,251,.7);
}
.depart { left: 6.4%; top: 40.1%; }
.ticket.ticket-style-pink .depart { left: 9.2%; top: 42.6%; }

.arrival {
    left: 59.8%; top: 40.1%; max-width: 36%;
    white-space: nowrap; border: 0; background: transparent;
    padding: 0 2px 2px; cursor: pointer; color: #3f4f53;
}
.ticket.ticket-style-pink .arrival { left: 58.5%; top: 42.6%; max-width: 34%; }
.arrival.empty-arrival { color: #66777a; }

.price { left: 6.4%; top: 50.2%; }
.ticket.ticket-style-pink .price { left: 9.2%; top: 51.8%; }

.source { left: 22.4%; top: 50.2%; }
.ticket.ticket-style-pink .source { left: 25.5%; top: 51.8%; }

.seat { left: 59.8%; top: 50.3%; max-width: 38%; font-size: clamp(12px, 3.05cqw, 39px); white-space: nowrap; }
.ticket.ticket-style-pink .seat { left: 58.5%; top: 51.8%; max-width: 39%; }

.person { left: 6.4%; top: 62.3%; max-width: 58%; font-size: clamp(12px, 3.45cqw, 44px); white-space: nowrap; }
.ticket.ticket-style-pink .person { left: 9.2%; top: 63.7%; }

/* 提示文字框 */
.notice {
    position: absolute; left: 6.4%; top: 69.8%; width: 60.1%; height: 16.1%;
    border: 2px dashed rgba(93,114,118,.55);
    display: grid; place-items: center; align-content: center; gap: 5%;
    color: #7b8b8e; font-size: clamp(12px, 2.95cqw, 36px);
    text-align: center; z-index: 2;
}
.ticket.ticket-style-pink .notice {
    left: 9.2%; top: 71.1%; width: 57.6%; height: 15.4%;
    border-color: rgba(71,76,78,.56); color: #899092;
}
.notice span { display: block; }

/* 市花 */
.region-flower {
    position: absolute; left: 5.5%; bottom: 9.6%; width: 9.2%; aspect-ratio: 1;
    z-index: 1; opacity: .28; pointer-events: none; mix-blend-mode: multiply;
}
.ticket.ticket-style-pink .region-flower { left: 7%; bottom: 12.2%; opacity: .18; }
.region-flower svg { width: 100%; height: 100%; display: block; filter: saturate(.9); }

/* 二维码 */
.qr-box {
    position: absolute; right: 8.1%; top: 61.4%; width: 14.5%; aspect-ratio: 1;
    background: #fff; display: grid; place-items: center;
    border-radius: 4px; z-index: 2;
}
.ticket.ticket-style-pink .qr-box { right: 9.1%; top: 65.2%; width: 13.3%; }
.qr-box::before { display: none; }
.qr-box img, .qr-box canvas { width: 92%; height: 92%; display: block; }

.bottom-code, .brand { display: none; }

/* ========== 空状态 ========== */

.empty-state {
    padding: 72px 20px; text-align: center;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
    margin-top: 10px;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { margin: 0; color: var(--text-placeholder); font-size: 15px; }

/* ========== 弹窗（Modal） ========== */

.modal-overlay {
    position: fixed; inset: 0; z-index: 300;
    display: grid; place-items: center; padding: 20px;
    background: rgba(0,0,0,.38);
}
.modal-overlay[hidden] { display: none; }

.modal-box {
    width: min(380px, 100%);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: 0 20px 52px rgba(0,0,0,.22);
    overflow: hidden;
}

.modal-header { padding: 18px 22px 0; }
.modal-header h3 { margin: 0; font-size: 17px; font-weight: 600; color: var(--text-primary); }

.modal-body { padding: 18px 22px 22px; }
.modal-body label {
    display: block; margin-bottom: 8px;
    color: var(--text-secondary); font-size: 13px; font-weight: 500;
}
.modal-body input {
    width: 100%; height: 40px;
    border: 1px solid var(--border-color); border-radius: var(--radius-sm);
    background: var(--bg-card); color: var(--text-primary);
    padding: 0 12px; outline: none;
    transition: var(--transition);
}
.modal-body input:focus {
    border-color: var(--blue-4);
    box-shadow: 0 0 0 3px rgba(0,82,217,.12);
}
.dialog-actions {
    display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px;
}

/* ========== 底部页脚 ========== */

.site-footer {
    text-align: center;
    padding: 18px;
    color: var(--text-placeholder);
    font-size: 13px;
    margin-top: 20px;
    background: transparent;
    border-top: 1px solid var(--border-color);
}

/* ========== 响应式适配 ========== */

/* 平板 / 大屏手机：内容占满可用宽度，避免两侧过宽留白 */
@media (max-width: 680px) {
    .content-wrap { max-width: 100%; padding: 16px 14px 52px; }

    .header-inner { padding: 12px 16px; flex-direction: column; align-items: stretch; gap: 8px; }
    .header-nav { justify-content: center; }
    .nav-hint { font-size: 12px; text-align: center; }
    .brand-text { font-size: 17px; }

    .stats-bar { flex-wrap: wrap; gap: 10px; padding: 12px 14px; justify-content: center; }
    .stat-divider { display: none; }
    .stat-spacer { display: none; }
    .stat-actions { width: 100%; justify-content: center; order: 3; margin-top: 6px; }

    .upload-card-inner { padding: 28px 16px; }
    .upload-icon { width: 48px; height: 48px; }

    .ticket-grid { gap: 14px; }
    .ticket-card-header { padding: 8px 12px; }
    .style-toggle { display: none; }

    .empty-state { padding: 48px 16px; border-radius: var(--radius-md); }

    .slider-dots { bottom: 16px; gap: 8px; }
    .dot { width: 9px; height: 9px; }
}

/* 小屏手机：进一步压缩间距，防止溢出 */
@media (max-width: 420px) {
    .content-wrap { padding: 12px 10px 48px; }

    .header-inner { padding: 10px 12px; }
    .brand-text { font-size: 15px; }
    .nav-hint { font-size: 11px; }

    .stats-bar { padding: 10px 12px; }
    .stat-num { font-size: 21px; }
    .stat-label { font-size: 12px; }
    .btn { padding: 0 12px; font-size: 13px; }
    .btn-sm { padding: 0 9px; font-size: 12px; }

    .upload-card-inner { padding: 22px 12px; }
    .upload-text strong { font-size: 15px; }
    .upload-text p { font-size: 12px; }

    .ticket-card-header { padding: 8px 10px; }

    .slider-dots { bottom: 12px; gap: 7px; }
    .dot { width: 8px; height: 8px; }
}
