/* ============================================================
   命书 · 滑轮选择器样式 v6
   indicator 锚定在 .wheel-body 内，calc 自动居中
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --wheel-item-height: 44px;
    --wheel-body-height: 220px;
}

@media (min-width: 640px)  { :root { --wheel-body-height: 260px; } }
@media (min-width: 768px)  { :root { --wheel-body-height: 300px; } }
@media (min-width: 1024px) { :root { --wheel-body-height: 340px; } }

/* ---------- 触发器 ---------- */
.wheel-trigger {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all .2s ease;
    margin-bottom: 12px;
}
.wheel-trigger:hover {
    border-color: var(--ink-soft);
    box-shadow: 0 2px 8px rgba(26,26,26,0.06);
}
.wheel-trigger-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.wheel-trigger-label {
    font-size: 12px;
    color: var(--ink-soft);
    letter-spacing: 2px;
    white-space: nowrap;
}
.wheel-trigger-value {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    font-family: "Songti SC", "STSong", serif;
    text-align: center;
    letter-spacing: 2px;
}
.wheel-trigger-arrow {
    font-size: 12px;
    color: var(--ink-mute);
    transition: transform .2s;
}
.wheel-trigger:active .wheel-trigger-arrow {
    transform: translateY(2px);
}

/* ---------- 模态框 ---------- */
.wheel-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    visibility: hidden;
    opacity: 0;
    transition: opacity .3s, visibility .3s;
}
.wheel-modal.active {
    visibility: visible;
    opacity: 1;
}
.wheel-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
}
.wheel-container {
    position: relative;
    background: var(--paper-3);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.wheel-modal.active .wheel-container {
    transform: translateY(0);
}

/* ---------- 头部 ---------- */
.wheel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-soft);
    flex-shrink: 0;
}
.wheel-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--ink);
}
.wheel-cancel,
.wheel-confirm {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 12px;
    letter-spacing: 2px;
    transition: color .2s;
}
.wheel-cancel { color: var(--ink-soft); }
.wheel-confirm { color: var(--red); font-weight: 700; }
.wheel-cancel:active,
.wheel-confirm:active { opacity: 0.7; }

/* ---------- 公历/农历切换 ---------- */
.wheel-calendar-toggle {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 16px 20px 8px;
    border: 1.5px solid var(--ink);
    flex-shrink: 0;
}
.wheel-cal-btn {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: none;
    color: var(--ink-2);
    font-family: inherit;
    font-size: 14px;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all .2s;
}
.wheel-cal-btn:first-child {
    border-right: 1px solid var(--ink);
}
.wheel-cal-btn.active {
    background: var(--red);
    color: var(--paper);
}

/* ---------- 滑轮区域 ---------- */
.wheel-body {
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: 0 20px 20px;
    flex: 1;
    overflow: hidden;
    position: relative;
    height: var(--wheel-body-height);
    min-height: var(--wheel-body-height);
    max-height: var(--wheel-body-height);
}

/* 5列布局 */
.wheel-body-5col .wheel-column-wrapper {
    flex: 1;
    min-width: 0;
}
.wheel-body-5col .wheel-column-wrapper:nth-child(1),
.wheel-body-5col .wheel-column-wrapper:nth-child(4),
.wheel-body-5col .wheel-column-wrapper:nth-child(5) {
    flex: 0.9;
}
.wheel-body-5col .wheel-column-wrapper:nth-child(2),
.wheel-body-5col .wheel-column-wrapper:nth-child(3) {
    flex: 1;
}

/* ---------- 单列包装 ---------- */
.wheel-column-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    height: 100%;
}
.wheel-column-label {
    font-size: 11px;
    color: var(--ink-mute);
    letter-spacing: 2px;
    margin-bottom: 4px;
    padding-top: 4px;
    flex-shrink: 0;
    height: 20px;
    line-height: 20px;
}

/* ---------- 滑轮列 ---------- */
.wheel-column {
    flex: 1;
    width: 100%;
    overflow: hidden;
    position: relative;
    touch-action: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;

    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 5%,
        black 30%,
        black 70%,
        transparent 95%,
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 5%,
        black 30%,
        black 70%,
        transparent 95%,
        transparent 100%
    );
}
.wheel-column:active { cursor: grabbing; }

/* ---------- column-content ：用 CSS 变量精确算出居中 padding ---------- */
/*
   推导：
   column 高度 = body高度 - label块(28px) - body底部padding(20px)
              = var(--wheel-body-height) - 48px
   居中 padding = (column高 - itemHeight) / 2
              = (var(--wheel-body-height) - 48px - var(--wheel-item-height)) / 2
*/
.wheel-column-content {
    will-change: transform;
    padding-top:    calc((var(--wheel-body-height) - 48px - var(--wheel-item-height)) / 2);
    padding-bottom: calc((var(--wheel-body-height) - 48px - var(--wheel-item-height)) / 2);
}

/* ---------- 滑轮项 ---------- */
.wheel-item {
    height: var(--wheel-item-height);
    line-height: var(--wheel-item-height);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--ink-mute);
    font-family: "Songti SC", "STSong", serif;
    transition: all .2s;
    user-select: none;
    -webkit-user-select: none;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}
.wheel-item.active {
    color: var(--ink);
    font-size: 22px;
    font-weight: 700;
}

/* ---------- 选中指示器 ：锚定在 body 内，calc 自动居中 ---------- */
/*
   推导：
   .wheel-column-label 块高 = height(20) + padding-top(4) + margin-bottom(4) = 28px
   .wheel-body padding-bottom = 20px
   column 在 body 内的中心 ≈ 28 + (bodyHeight - 28 - 20) / 2 = (bodyHeight + 8) / 2
*/
.wheel-indicator {
    position: absolute;
    left: 20px;
    right: 20px;
    top: calc((var(--wheel-body-height) + 8px) / 2);
    transform: translateY(-50%);
    height: var(--wheel-item-height);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: rgba(179, 48, 42, 0.02);
    pointer-events: none;
    z-index: 1;
}

/* ---------- 桌面端适配 ---------- */
@media (min-width: 640px) {
    .wheel-container {
        max-width: 720px;
        margin: 0 auto;
        border-radius: 16px;
        max-height: 70vh;
        transform: translateY(20px);
        opacity: 0;
        transition: transform .3s, opacity .3s;
    }
    .wheel-modal.active .wheel-container {
        transform: translateY(0);
        opacity: 1;
    }
    .wheel-modal {
        justify-content: center;
        align-items: center;
        padding: 20px;
    }
    .wheel-body-5col {
        padding: 0 24px 20px;
    }
    .wheel-item { font-size: 20px; width:20vh;}
    .wheel-item.active { font-size: 24px; }
}

@media (min-width: 768px) {
    .wheel-container { max-width: 780px; }
    .wheel-item { font-size: 19px;width:20vh; }
    .wheel-item.active { font-size: 19px; }
}

@media (min-width: 1024px) {
    .wheel-container { max-width: 860px; }
    .wheel-item { 
		font-size: 20px;
		width:20vh;
		}
    .wheel-item.active { font-size: 20px; }
}

/* ---------- 防止拖拽时选中文本 ---------- */
.wheel-column,
.wheel-column * {
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}


/* 日期时间触发器副标题 */
.wheel-trigger-sub {
	font-weight: 600;
    font-size: 17px;
    color: var(--ink-soft);
    letter-spacing: 1px;
    margin-top: 4px;
    text-align: center;
    font-family: "Songti SC", "STSong", serif;
}