/* =====================================================
   K-DYNASTY · Web Edition
   Unified design with iOS/iPadOS app
   Triple Theme: Auto / Cine / Liquid Glass
   ===================================================== */

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

/* ═══════════════════════════════════════
   CSS Variables
═══════════════════════════════════════ */
:root {
    --nav-height: 64px;
    --tab-height: 52px;
    --dial-width: 68px;
    --page-h: calc(100dvh - var(--nav-height) - var(--tab-height));
    --card-h: calc(var(--page-h) * 0.62);
    --dial-item-h: 40px;
    --radius-card: 0px;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    --transition-theme: 0.5s cubic-bezier(.4,0,.2,1);
}

/* ── Cine Theme (dark cinematic · Netflix) ──── */
[data-theme="cine"] {
    --t-bg:            #141414;
    --t-surface:       #1f1f1f;
    --t-nav-bg:        rgba(20,20,20,0.92);
    --t-tab-bg:        rgba(20,20,20,0.94);
    --t-text:          #ffffff;
    --t-text-2:        rgba(255,255,255,0.6);
    --t-text-3:        rgba(255,255,255,0.35);
    --t-text-4:        rgba(255,255,255,0.18);
    --t-border:        rgba(255,255,255,0.08);
    --t-accent:        #E50914;
    --t-accent-tint:   rgba(229,9,20,0.12);
    --t-glass:         rgba(255,255,255,0.08);
    --t-glass-border:  rgba(255,255,255,0.10);
    --t-dial-bg:       #0e0e0e;
    --t-dial-border:   rgba(255,255,255,0.06);
    --t-dial-fade-clr: #0e0e0e;
    --t-input-bg:      rgba(255,255,255,0.08);
    --t-input-text:    #fff;
    --t-input-ph:      rgba(255,255,255,0.25);
    --t-sheet-bg:      #1f1f1f;
    --t-sheet-text:    rgba(255,255,255,0.72);
    --t-shadow:        none;
    --radius-card:     0px;
}

/* ── Liquid Glass Theme (light · Apple) ──── */
[data-theme="liquid"] {
    --t-bg:            #f2f2f7;
    --t-surface:       rgba(255,255,255,0.72);
    --t-nav-bg:        rgba(255,255,255,0.82);
    --t-tab-bg:        rgba(255,255,255,0.85);
    --t-text:          #1c1c1e;
    --t-text-2:        #636366;
    --t-text-3:        #aeaeb2;
    --t-text-4:        #d1d1d6;
    --t-border:        rgba(0,0,0,0.06);
    --t-accent:        #007AFF;
    --t-accent-tint:   rgba(0,122,255,0.10);
    --t-glass:         rgba(255,255,255,0.55);
    --t-glass-border:  rgba(255,255,255,0.5);
    --t-dial-bg:       rgba(245,245,247,0.94);
    --t-dial-border:   rgba(0,0,0,0.05);
    --t-dial-fade-clr: #f2f2f7;
    --t-input-bg:      rgba(0,0,0,0.04);
    --t-input-text:    #1c1c1e;
    --t-input-ph:      #aeaeb2;
    --t-sheet-bg:      #ffffff;
    --t-sheet-text:    #444;
    --t-shadow:        0 2px 20px rgba(0,0,0,0.06);
    --radius-card:     20px;
}

/* ═══════════════════════════════════════
   Base
═══════════════════════════════════════ */
html, body {
    height: 100%; overflow: hidden;
    background: var(--t-bg);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--t-text);
    transition: background-color var(--transition-theme), color var(--transition-theme);
}

/* ═══════════════════════════════════════
   NavBar
═══════════════════════════════════════ */
.nav-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--t-nav-bg);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border-bottom: 0.5px solid var(--t-border);
    padding: 0 20px;
    display: flex; flex-direction: column;
    transition: background-color var(--transition-theme), border-color var(--transition-theme);
}
.nav-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 64px; flex-shrink: 0;
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: var(--t-accent);
    color: #fff; font-weight: 800; font-size: 16px;
    border-radius: 9px;
    letter-spacing: -0.5px;
    transition: background-color var(--transition-theme);
}
.nav-title-group { display: flex; flex-direction: column; }
.nav-large-title {
    font-size: 18px; font-weight: 800; letter-spacing: -0.3px;
    color: var(--t-text);
    transition: color var(--transition-theme);
}
.nav-subtitle {
    font-size: 11px; font-weight: 500; letter-spacing: 0.3px;
    color: var(--t-text-3);
    transition: color var(--transition-theme);
}
.nav-actions { display: flex; align-items: center; gap: 8px; }

.nav-action-btn {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--t-input-bg); border: none;
    display: flex; align-items: center; justify-content: center;
    color: var(--t-accent); cursor: pointer;
    transition: transform .15s, background-color var(--transition-theme);
}
.nav-action-btn:hover { transform: scale(1.06); }
.nav-action-btn:active { transform: scale(0.92); }
.nav-action-btn svg { stroke: var(--t-accent); }

/* ── Dropdowns ──── */
.nav-select {
    height: 30px;
    padding: 0 22px 0 10px;
    background: var(--t-input-bg);
    color: var(--t-text);
    border: 0.5px solid var(--t-border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
    transition: background-color var(--transition-theme), color var(--transition-theme), border-color var(--transition-theme);
}
.nav-select option { background: var(--t-bg); color: var(--t-text); }

/* ── Search Bar ──── */
.search-bar {
    display: flex; align-items: center; gap: 8px;
    background: var(--t-input-bg);
    border-radius: 10px; padding: 8px 14px;
    margin-bottom: 10px;
    transition: background-color var(--transition-theme);
}
.search-icon { color: var(--t-text-3); flex-shrink: 0; }
.search-bar input {
    flex: 1; background: transparent; border: none; outline: none;
    font-size: 15px; color: var(--t-input-text); font-family: var(--font);
}
.search-bar input::placeholder { color: var(--t-input-ph); }
.search-clear {
    background: none; border: none; color: var(--t-text-3);
    font-size: 14px; cursor: pointer; padding: 2px 4px;
}

/* ═══════════════════════════════════════
   App Main (dial + pages)
═══════════════════════════════════════ */
.app-main {
    position: fixed;
    top: var(--nav-height);
    bottom: var(--tab-height);
    left: 0; right: 0;
    overflow: hidden;
    display: flex; flex-direction: row;
}

/* ═══════════════════════════════════════
   Dial
═══════════════════════════════════════ */
.dial-col {
    width: var(--dial-width);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: var(--t-dial-bg);
    border-right: 0.5px solid var(--t-dial-border);
    user-select: none;
    cursor: ns-resize;
    z-index: 10;
    transition: background-color var(--transition-theme), border-color var(--transition-theme);
}
.dial-center-bar {
    position: absolute;
    top: 50%;
    left: 5px; right: 5px;
    height: var(--dial-item-h);
    margin-top: calc(var(--dial-item-h) / -2);
    background: var(--t-accent-tint);
    border: 0.5px solid var(--t-accent-tint);
    border-radius: 8px;
    pointer-events: none; z-index: 2;
}
.dial-items {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex; flex-direction: column; align-items: center;
    will-change: transform;
    transition: transform .28s cubic-bezier(.32,.72,0,1);
}
.dial-item {
    width: 100%; height: var(--dial-item-h); flex-shrink: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 0 4px; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.dial-item-name {
    font-size: 10px; font-weight: 600;
    color: var(--t-text-3); text-align: center;
    white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 58px;
    transition: color .25s, font-weight .15s;
}
.dial-item-year {
    font-size: 8px; color: var(--t-text-4);
    font-variant-numeric: tabular-nums;
    transition: color .25s;
}
.dial-item.dial-focused .dial-item-name {
    color: var(--t-accent); font-weight: 700;
}
.dial-item.dial-focused .dial-item-year {
    color: var(--t-accent);
    opacity: 0.7;
}
.dial-fade-top, .dial-fade-bottom {
    position: absolute; left: 0; right: 0; height: 38%;
    pointer-events: none; z-index: 3;
    transition: background var(--transition-theme);
}
.dial-fade-top    { top: 0;    background: linear-gradient(to bottom, var(--t-dial-fade-clr), transparent); }
.dial-fade-bottom { bottom: 0; background: linear-gradient(to top,    var(--t-dial-fade-clr), transparent); }

/* ═══════════════════════════════════════
   H-Pages (horizontal scroll)
═══════════════════════════════════════ */
.h-pages {
    flex: 1; height: 100%;
    display: flex; flex-direction: row;
    overflow-x: scroll; overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-padding: 0 4%;
}
.h-pages::-webkit-scrollbar { display: none; }

.h-page {
    width: 94%; min-width: 94%; height: 100%;
    flex-shrink: 0;
    scroll-snap-align: center;
    overflow: hidden;
    border-radius: 16px;
    margin: 0 2px;
}

/* ═══════════════════════════════════════
   Page Scroll (Y snap center)
═══════════════════════════════════════ */
.page-scroll {
    width: 100%; height: 100%;
    overflow-y: scroll; overflow-x: hidden;
    scroll-snap-type: y proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.page-scroll::-webkit-scrollbar { display: none; }

.page-list {
    padding-top:    calc((var(--page-h) - var(--card-h)) / 2);
    padding-bottom: calc((var(--page-h) - var(--card-h)) / 2);
}

/* ═══════════════════════════════════════
   Era Card (typographic)
═══════════════════════════════════════ */
.era-king-card {
    height: var(--card-h);
    flex-shrink: 0;
    scroll-snap-align: center;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 32px 28px;
    opacity: 0.5;
    will-change: opacity, transform;
    transform-origin: center center;
    position: relative; overflow: hidden;
    background: #0d0d0d;
    border-radius: var(--radius-card);
    transition: border-radius var(--transition-theme);
}
.era-king-card::before {
    content: '';
    position: absolute; inset: 0;
    opacity: 0.08;
    background: var(--era-color, #333);
    pointer-events: none;
    border-radius: inherit;
}

/* Liquid era card */
.era-king-card.card-liquid {
    background: rgba(255,255,255,0.65);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    border: 0.5px solid rgba(255,255,255,0.5);
}
.era-king-card.card-liquid .ekc-name { text-shadow: none; color: #1c1c1e; }
.era-king-card.card-liquid .ekc-year { color: #636366; }
.era-king-card.card-liquid .ekc-reign { color: #aeaeb2; }
.era-king-card.card-liquid .ekc-event { color: #aeaeb2; }

.ekc-badge {
    font-size: 10px; font-weight: 700;
    letter-spacing: 2px; text-transform: uppercase;
    color: var(--t-accent);
    margin-bottom: 16px;
    position: relative;
}
.ekc-name {
    font-size: 48px; font-weight: 900;
    color: #fff; letter-spacing: -2.5px;
    line-height: 1; margin-bottom: 14px;
    position: relative;
    text-shadow: 0 2px 24px rgba(0,0,0,0.3);
}
.ekc-year {
    font-size: 15px; font-weight: 500;
    color: rgba(255,255,255,0.6);
    margin-bottom: 4px; position: relative;
    font-variant-numeric: tabular-nums;
}
.ekc-reign {
    font-size: 12px; color: rgba(255,255,255,0.3);
    margin-bottom: 18px; position: relative;
}
.ekc-event {
    font-size: 12px; line-height: 1.7;
    color: rgba(255,255,255,0.4);
    text-align: center;
    max-width: 260px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden; position: relative;
}

/* ═══════════════════════════════════════
   King Card (image + text)
═══════════════════════════════════════ */
.king-card {
    height: var(--card-h);
    flex-shrink: 0;
    scroll-snap-align: center;
    display: flex; flex-direction: row;
    overflow: hidden;
    opacity: 0.5;
    will-change: opacity, transform;
    transform-origin: center center;
    position: relative;
    border-radius: var(--radius-card);
    cursor: pointer;
    transition: border-radius var(--transition-theme);
}
.king-card:hover { filter: brightness(1.03); }

/* Liquid king card */
.king-card.card-liquid {
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    border: 0.5px solid rgba(255,255,255,0.4);
}
.king-card.card-liquid .kc-content {
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
}
.king-card.card-liquid .kc-fade {
    background: linear-gradient(to right, transparent 0%, rgba(255,255,255,0.55) 60%);
}
.king-card.card-liquid .kc-name { color: #1c1c1e; }
.king-card.card-liquid .kc-year { color: #636366; }
.king-card.card-liquid .kc-text { color: #636366; }
.king-card.card-liquid .kc-tap-hint { color: #aeaeb2; }
.king-card.card-liquid .kc-type-badge { color: var(--t-accent); }
.king-card.card-liquid .kc-era-tag { color: #aeaeb2; }

/* Image side */
.kc-image {
    width: 42%; flex-shrink: 0;
    position: relative; overflow: hidden;
}
.kc-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}
.kc-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 64px;
}
.kc-fade {
    position: absolute;
    top: 0; right: -1px; bottom: 0;
    width: 65%;
    background: linear-gradient(to right, transparent 0%, var(--kc-bg, #111) 60%);
    pointer-events: none;
}

/* Text side */
.kc-content {
    flex: 1;
    background: var(--kc-bg, #111);
    padding: 0 22px 0 8px;
    display: flex; flex-direction: column;
    justify-content: center;
    gap: 7px; overflow: hidden; min-width: 0;
}
.kc-type-badge {
    font-size: 10px; font-weight: 700;
    letter-spacing: 1.6px; text-transform: uppercase;
    color: var(--t-accent);
}
.kc-era-tag {
    font-size: 11px; font-weight: 500;
    color: rgba(255,255,255,0.38);
    letter-spacing: 0.3px;
}
.kc-name {
    font-size: 26px; font-weight: 800;
    color: #fff; letter-spacing: -1px;
    line-height: 1.05;
}
.kc-year {
    font-size: 12px; color: rgba(255,255,255,0.48);
    font-variant-numeric: tabular-nums;
}
.kc-divider {
    width: 28px; height: 2px;
    background: var(--t-accent); opacity: 0.5;
    border-radius: 1px;
}
.kc-text {
    font-size: 12px; line-height: 1.7;
    color: rgba(255,255,255,0.5);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.kc-tap-hint {
    font-size: 11px; color: rgba(255,255,255,0.18);
    margin-top: 2px; font-weight: 500;
}

/* Multi-item list inside card */
.kc-multi-list {
    flex: 1;
    overflow-y: auto;
    display: flex; flex-direction: column;
    gap: 6px;
    min-height: 0;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.kc-multi-list::-webkit-scrollbar { width: 3px; }
.kc-multi-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.kc-multi-item {
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.kc-multi-item:hover { background: rgba(255,255,255,0.12); }
.kc-multi-badge {
    font-size: 9px; font-weight: 700;
    letter-spacing: 1.2px; text-transform: uppercase;
    color: var(--t-accent);
}
.kc-multi-title {
    font-size: 14px; font-weight: 700;
    color: #fff;
    line-height: 1.3;
}
.kc-multi-addr {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

/* Liquid theme overrides for multi-item */
.king-card.card-liquid .kc-multi-item { background: rgba(0,0,0,0.04); }
.king-card.card-liquid .kc-multi-item:hover { background: rgba(0,0,0,0.08); }
.king-card.card-liquid .kc-multi-title { color: #1c1c1e; }
.king-card.card-liquid .kc-multi-addr { color: #8e8e93; }
.king-card.card-liquid .kc-multi-list { scrollbar-color: rgba(0,0,0,0.1) transparent; }
.king-card.card-liquid .kc-multi-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); }

/* ═══════════════════════════════════════
   Bottom Sheet / Detail
═══════════════════════════════════════ */
.detail-sheet {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: flex-end;
    pointer-events: none; opacity: 0;
    transition: opacity .3s ease;
}
.detail-sheet.open { opacity: 1; pointer-events: all; }
.sheet-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.sheet-panel {
    position: relative; z-index: 1;
    width: 100%; max-width: 640px; margin: 0 auto;
    background: var(--t-sheet-bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 88vh; overflow-y: auto;
    transform: translateY(100%);
    transition: transform .42s cubic-bezier(.32,.72,0,1), background-color var(--transition-theme);
    scrollbar-width: none;
}
.sheet-panel::-webkit-scrollbar { display: none; }
.detail-sheet.open .sheet-panel { transform: translateY(0); }

.sheet-drag-bar {
    width: 36px; height: 4px; border-radius: 2px;
    background: var(--t-text-4);
    margin: 10px auto 0;
}
.sheet-close-btn {
    position: absolute; top: 16px; right: 16px; z-index: 10;
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    transition: transform .15s;
}
.sheet-close-btn:hover { transform: scale(1.1); }

.sheet-hero {
    position: relative; width: 100%; aspect-ratio: 16/9;
    background: var(--t-surface); overflow: hidden; margin-top: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 64px; color: var(--t-text-3);
}
.sheet-hero img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.sheet-hero-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 28px 24px 18px;
    background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
}
.sheet-hero-era {
    font-size: 10px; font-weight: 700; color: var(--t-accent);
    letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px;
}
.sheet-hero-name {
    font-size: 28px; font-weight: 800; color: #fff;
    letter-spacing: -0.5px; margin-bottom: 4px;
}
.sheet-hero-period {
    font-size: 13px; color: rgba(255,255,255,.55);
    font-variant-numeric: tabular-nums;
}
.sheet-content { padding: 22px 24px 44px; }
.sheet-section-label {
    font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
    color: var(--t-text-3); margin-bottom: 10px; margin-top: 22px;
}
.sheet-section-label:first-child { margin-top: 0; }
.sheet-event-text {
    font-size: 15px; line-height: 1.8; color: var(--t-sheet-text);
    transition: color var(--transition-theme);
}
.sheet-media-text {
    font-size: 14px; color: var(--t-accent); font-weight: 500;
}
.sheet-media-source {
    font-size: 13px; color: var(--t-sub); margin-bottom: 4px; opacity: 0.8;
}
.sheet-gallery {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
    margin-top: 16px;
}

.navigate-btn {
    display: block; width: 100%; margin-top: 18px; padding: 14px;
    background: var(--t-accent); color: #fff;
    font-size: 15px; font-weight: 600; font-family: var(--font);
    border: none; border-radius: var(--radius-md); cursor: pointer;
    transition: opacity .15s, transform .15s;
}
.navigate-btn:hover { transform: translateY(-1px); }
.navigate-btn:active { opacity: 0.8; transform: scale(0.98); }

/* ═══════════════════════════════════════
   Tab Bar
═══════════════════════════════════════ */
.tab-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--tab-height); z-index: 100;
    display: flex; align-items: center;
    background: var(--t-tab-bg);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border-top: 0.5px solid var(--t-border);
    padding-bottom: env(safe-area-inset-bottom, 0);
    transition: background-color var(--transition-theme), border-color var(--transition-theme);
}
.tab-indicator {
    position: absolute; top: 50%; left: 0;
    transform: translateY(-50%) translateX(0);
    height: 32px; width: calc(25% - 14px);
    margin-left: 7px;
    background: var(--t-glass);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-sm);
    border: 0.5px solid var(--t-glass-border);
    pointer-events: none; z-index: 0;
    will-change: transform;
    transition: background-color var(--transition-theme), border-color var(--transition-theme);
}
.tab-item {
    flex: 1; height: 100%;
    display: flex; align-items: center; justify-content: center;
    gap: 5px;
    background: none; border: none; cursor: pointer; padding: 6px 4px;
    -webkit-tap-highlight-color: transparent;
    position: relative; z-index: 1;
}
.tab-item:active { opacity: 0.6; }
.tab-icon { font-size: 14px; display: none; }
.tab-label {
    font-size: 13px; font-weight: 500;
    color: var(--t-text-3); letter-spacing: -0.1px;
    transition: color .25s, font-weight .15s;
    font-family: var(--font);
}
.tab-item.active .tab-label { color: var(--t-text); font-weight: 700; }

/* ═══════════════════════════════════════
   Loading / Empty
═══════════════════════════════════════ */
.loading-wrap {
    height: var(--page-h);
    display: flex; align-items: center; justify-content: center;
}
.spinner {
    width: 28px; height: 28px;
    border: 2px solid var(--t-border);
    border-top-color: var(--t-accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-card {
    height: var(--card-h);
    flex-shrink: 0;
    scroll-snap-align: center;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: #0d0d0d;
    border-radius: var(--radius-card);
    opacity: 0.5;
    will-change: opacity, transform;
    transform-origin: center center;
    gap: 10px;
}
.empty-card.card-liquid {
    background: rgba(255,255,255,0.65);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 16px rgba(0,0,0,0.05);
    border: 0.5px solid rgba(255,255,255,0.4);
}
.empty-card.card-liquid .empty-card-king { color: #aeaeb2; }
.empty-card.card-liquid .empty-card-text { color: #c7c7cc; }
.empty-card-icon { font-size: 32px; opacity: 0.25; }
.empty-card-king {
    font-size: 22px; font-weight: 700;
    color: rgba(255,255,255,0.18); letter-spacing: -0.5px;
}
.empty-card-text { font-size: 12px; color: rgba(255,255,255,0.18); }

/* ═══════════════════════════════════════
   Desktop Responsive (>= 768px)
═══════════════════════════════════════ */
@media (min-width: 768px) {
    :root {
        --dial-width: 80px;
        --dial-item-h: 44px;
    }
    .nav-bar { padding: 0 28px; }
    .nav-large-title { font-size: 20px; }
    .h-page { width: 90%; min-width: 90%; }

    .ekc-name { font-size: 56px; }
    .kc-name { font-size: 30px; }
    .kc-text { -webkit-line-clamp: 5; }

    .dial-item-name { font-size: 11px; max-width: 68px; }
    .dial-item-year { font-size: 9px; }

    /* Desktop detail: side panel */
    .detail-sheet { align-items: stretch; justify-content: flex-end; }
    .sheet-panel {
        max-width: 480px; max-height: 100vh;
        border-radius: var(--radius-lg) 0 0 var(--radius-lg);
        margin: 0;
        transform: translateX(100%);
    }
    .detail-sheet.open .sheet-panel {
        transform: translateX(0);
    }
}

@media (min-width: 1200px) {
    :root {
        --dial-width: 90px;
    }
    .h-page { width: 85%; min-width: 85%; }
    .ekc-name { font-size: 64px; }
    .kc-image { width: 45%; }
    .kc-name { font-size: 34px; }
}

/* ═══════════════════════════════════════
   Animations
═══════════════════════════════════════ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   Contact Modal
═══════════════════════════════════════ */
.contact-modal {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
}
.contact-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.6); backdrop-filter: blur(6px);
}
.contact-panel {
    position: relative; z-index: 1;
    width: 90%; max-width: 400px;
    background: var(--card-bg, #1a1a1a);
    border: 1px solid var(--card-border, rgba(255,255,255,.08));
    border-radius: 18px;
    overflow: hidden;
    animation: contactSlideUp .3s ease-out;
}
@keyframes contactSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.contact-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 20px 12px;
}
.contact-header h2 {
    font-size: 18px; font-weight: 700; color: var(--text-primary, #fff);
    margin: 0;
}
.contact-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-secondary, rgba(255,255,255,.5));
    padding: 4px; border-radius: 8px; display: flex;
}
.contact-close:hover { color: var(--text-primary, #fff); }
.contact-body {
    padding: 0 20px 24px;
}
.contact-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; margin-bottom: 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px;
    text-decoration: none; color: inherit;
    transition: background .15s;
}
.contact-item:hover { background: rgba(255,255,255,.08); }
.contact-item-icon {
    font-size: 20px; width: 30px; text-align: center; flex-shrink: 0;
}
.contact-item-content {
    flex: 1; min-width: 0;
}
.contact-item-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .5px; opacity: .5; margin-bottom: 2px;
}
.contact-item-value {
    font-size: 14px; font-weight: 500; color: var(--text-primary, #fff);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.contact-item-arrow {
    font-size: 14px; opacity: .3; flex-shrink: 0;
}
.contact-notice {
    margin-top: 12px; padding: 14px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px;
}
.contact-notice-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .5px; opacity: .5; margin-bottom: 6px;
}
.contact-notice-text {
    font-size: 13px; line-height: 1.6; color: var(--text-secondary, rgba(255,255,255,.6));
    white-space: pre-line;
}
.contact-empty {
    text-align: center; padding: 32px 16px;
    font-size: 14px; color: var(--text-secondary, rgba(255,255,255,.5));
}
.contact-legal {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 16px; padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,.06);
    font-size: 12px;
}
.contact-legal a {
    color: var(--text-secondary, rgba(255,255,255,.45));
    cursor: pointer; text-decoration: none;
    transition: color .15s;
}
.contact-legal a:hover { color: var(--text-primary, #fff); text-decoration: underline; }
.contact-legal span { color: rgba(255,255,255,.2); }
/* Light theme adjustments */
[data-theme="liquid"] .contact-panel {
    background: rgba(255,255,255,.95);
    border-color: rgba(0,0,0,.12);
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
[data-theme="liquid"] .contact-header h2 { color: #1a1a1a; }
[data-theme="liquid"] .contact-close { color: rgba(0,0,0,.4); }
[data-theme="liquid"] .contact-close:hover { color: #1a1a1a; }
[data-theme="liquid"] .contact-item {
    background: rgba(0,0,0,.04);
    border-color: rgba(0,0,0,.08);
}
[data-theme="liquid"] .contact-item:hover { background: rgba(0,0,0,.07); }
[data-theme="liquid"] .contact-item-value { color: #1a1a1a; }
[data-theme="liquid"] .contact-item-label { color: rgba(0,0,0,.5); }
[data-theme="liquid"] .contact-notice {
    background: rgba(0,0,0,.03);
    border-color: rgba(0,0,0,.08);
}
[data-theme="liquid"] .contact-notice-title { color: rgba(0,0,0,.5); }
[data-theme="liquid"] .contact-notice-text { color: rgba(0,0,0,.6); }
[data-theme="liquid"] .contact-empty { color: rgba(0,0,0,.4); }
[data-theme="liquid"] .contact-legal { border-top-color: rgba(0,0,0,.08); }
[data-theme="liquid"] .contact-legal a { color: rgba(0,0,0,.4); }
[data-theme="liquid"] .contact-legal a:hover { color: #1a1a1a; }
[data-theme="liquid"] .contact-legal span { color: rgba(0,0,0,.15); }
/* Auto theme (respects system preference) */
@media (prefers-color-scheme: light) {
    [data-theme="auto"] .contact-panel {
        background: rgba(255,255,255,.95);
        border-color: rgba(0,0,0,.12);
        box-shadow: 0 20px 60px rgba(0,0,0,.15);
    }
    [data-theme="auto"] .contact-header h2 { color: #1a1a1a; }
    [data-theme="auto"] .contact-close { color: rgba(0,0,0,.4); }
    [data-theme="auto"] .contact-close:hover { color: #1a1a1a; }
    [data-theme="auto"] .contact-item {
        background: rgba(0,0,0,.04);
        border-color: rgba(0,0,0,.08);
    }
    [data-theme="auto"] .contact-item:hover { background: rgba(0,0,0,.07); }
    [data-theme="auto"] .contact-item-value { color: #1a1a1a; }
    [data-theme="auto"] .contact-item-label { color: rgba(0,0,0,.5); }
    [data-theme="auto"] .contact-notice {
        background: rgba(0,0,0,.03);
        border-color: rgba(0,0,0,.08);
    }
    [data-theme="auto"] .contact-notice-title { color: rgba(0,0,0,.5); }
    [data-theme="auto"] .contact-notice-text { color: rgba(0,0,0,.6); }
    [data-theme="auto"] .contact-empty { color: rgba(0,0,0,.4); }
    [data-theme="auto"] .contact-legal { border-top-color: rgba(0,0,0,.08); }
    [data-theme="auto"] .contact-legal a { color: rgba(0,0,0,.4); }
    [data-theme="auto"] .contact-legal a:hover { color: #1a1a1a; }
    [data-theme="auto"] .contact-legal span { color: rgba(0,0,0,.15); }
}
