:root, [data-theme="mist"] {
    --bg: #f0f4f8;
    --white: #1a2a3a;
    --white-dim: rgba(30, 50, 70, 0.7);
    --white-ghost: rgba(40, 70, 100, 0.35);
    --white-whisper: rgba(60, 90, 120, 0.12);
    --border: rgba(60, 100, 140, 0.15);
    --border-active: rgba(50, 90, 140, 0.35);
    --surface: rgba(60, 100, 150, 0.06);
    --surface-hover: rgba(60, 100, 150, 0.1);
    --particle: 50, 100, 160;
    --moon: #4a7a9f;
    --forest: #5a8aaa;
    --fog-bg: rgba(240, 244, 248, 0.7);
}

[data-theme="ink"] {
    --bg: #f5f5f5;
    --white: #111111;
    --white-dim: rgba(20, 20, 20, 0.7);
    --white-ghost: rgba(30, 30, 30, 0.3);
    --white-whisper: rgba(40, 40, 40, 0.1);
    --border: rgba(0, 0, 0, 0.1);
    --border-active: rgba(0, 0, 0, 0.3);
    --surface: rgba(0, 0, 0, 0.03);
    --surface-hover: rgba(0, 0, 0, 0.06);
    --particle: 60, 60, 60;
    --moon: #333333;
    --forest: #444444;
    --fog-bg: rgba(245, 245, 245, 0.7);
}

[data-theme="aurora"] {
    --bg: #f0f8f4;
    --white: #1a3a2a;
    --white-dim: rgba(20, 60, 40, 0.7);
    --white-ghost: rgba(30, 80, 55, 0.35);
    --white-whisper: rgba(40, 100, 70, 0.12);
    --border: rgba(40, 140, 90, 0.15);
    --border-active: rgba(40, 160, 100, 0.35);
    --surface: rgba(40, 150, 90, 0.05);
    --surface-hover: rgba(40, 160, 100, 0.09);
    --particle: 50, 150, 100;
    --moon: #3a9a6a;
    --forest: #408a60;
    --fog-bg: rgba(240, 248, 244, 0.7);
}

[data-theme="dream"] {
    --bg: #f5f0fa;
    --white: #2a1a3a;
    --white-dim: rgba(50, 30, 70, 0.7);
    --white-ghost: rgba(70, 40, 100, 0.35);
    --white-whisper: rgba(90, 60, 130, 0.12);
    --border: rgba(120, 80, 180, 0.12);
    --border-active: rgba(130, 80, 200, 0.3);
    --surface: rgba(120, 80, 180, 0.05);
    --surface-hover: rgba(130, 90, 190, 0.09);
    --particle: 120, 80, 180;
    --moon: #7a50b0;
    --forest: #8060a0;
    --fog-bg: rgba(245, 240, 250, 0.7);
}

[data-theme="amber"] {
    --bg: #faf6f0;
    --white: #3a2a1a;
    --white-dim: rgba(60, 40, 20, 0.7);
    --white-ghost: rgba(80, 55, 30, 0.35);
    --white-whisper: rgba(100, 70, 30, 0.12);
    --border: rgba(160, 120, 50, 0.15);
    --border-active: rgba(180, 130, 50, 0.35);
    --surface: rgba(170, 130, 50, 0.05);
    --surface-hover: rgba(180, 140, 60, 0.09);
    --particle: 160, 120, 50;
    --moon: #a08030;
    --forest: #907040;
    --fog-bg: rgba(250, 246, 240, 0.7);
}
[data-theme="cyber"] {
    --bg: #0a0a0a;
    --white: #f0f0f0;
    --white-dim: rgba(240, 240, 240, 0.8);
    --white-ghost: rgba(200, 200, 200, 0.45);
    --white-whisper: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.15);
    --border-active: rgba(255, 255, 255, 0.5);
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --particle: 220, 230, 255;
    --moon: #e0e8ff;
    --forest: #a0b0c0;
    --fog-bg: rgba(10, 10, 10, 0.8);
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: "Inter", "Noto Sans SC", -apple-system, sans-serif;
    background: var(--bg);
    color: var(--white);
    min-height: 100dvh;
    overflow-x: hidden;
    font-weight: 300;
    transition: background-color 0.4s ease, color 0.3s ease;
    letter-spacing: -0.01em;
}

#bgCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

.app { position: relative; z-index: 1; }

.page {
    display: none;
    min-height: 100dvh;
    padding: 30px 32px;
    animation: fadeIn 0.6s ease;
}
.page.active { display: flex; flex-direction: column; align-items: center; }

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

/* === PAGE 1: WORLD === */
.page-world { position: relative; }
.geo-accent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70vmin;
    height: 70vmin;
    pointer-events: none;
    opacity: 1;
    animation: geoSpin 180s linear infinite;
}
.geo-svg { width: 100%; height: 100%; color: var(--white); }
@keyframes geoSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.world-header {
    text-align: center;
    margin-bottom: 48px;
    padding-top: 80px;
    width: 100%;
    max-width: 600px;
}
.overline {
    font-size: 0.6rem;
    font-weight: 400;
    letter-spacing: 0.35em;
    color: var(--white-ghost);
    text-transform: uppercase;
    margin-bottom: 8px;
}
.logo {
    font-family: "Space Grotesk", "Inter", sans-serif;
    font-size: 8rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 0.8;
}
.subtitle {
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.4em;
    color: var(--white-dim);
    margin-top: 16px;
    text-transform: uppercase;
}

.world-mode-switch {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
    width: 100%;
    max-width: 500px;
}
.mode-btn {
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    padding: 14px 0;
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    color: var(--white-ghost);
    cursor: pointer;
    transition: all 0.4s;
    text-align: center;
}
.mode-btn.active { border-bottom-color: var(--white); color: var(--white); }
.mode-btn:hover { color: var(--white-dim); }

.world-random {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    max-width: 500px;
}
.world-random-card {
    width: 100%;
    min-height: 160px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 30px;
    transition: all 0.4s;
    cursor: pointer;
}
.world-random-card:hover {
    border-bottom-color: var(--border-active);
    background: var(--surface);
}
.random-hint {
    font-size: 0.7rem;
    color: var(--white-ghost);
    letter-spacing: 0.3em;
    text-transform: uppercase;
}
.world-random-card .world-name {
    font-size: 2.8rem;
    font-weight: 100;
    letter-spacing: 0.1em;
    line-height: 1.1;
    text-align: center;
}
.world-random-card .world-category {
    font-size: 0.6rem;
    color: var(--white-ghost);
    letter-spacing: 0.2em;
    margin-top: 10px;
    text-transform: uppercase;
}
.world-random-actions { display: flex; gap: 12px; justify-content: center; }

/* Choose mode */
.world-choose { width: 100%; max-width: 600px; }
.world-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0;
    max-height: 55vh;
    overflow-y: auto;
    border: 1px solid var(--border);
}
.world-item {
    padding: 14px 12px;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    transition: all 0.2s;
}
.world-item:hover { background: var(--white); color: var(--bg); }
.world-item.selected { background: var(--white); color: var(--bg); }
.world-item-name { font-size: 0.75rem; font-weight: 400; letter-spacing: 0.05em; }

/* === BUTTONS === */
.btn-main {
    padding: 14px 40px;
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.3em;
    border: 2px solid var(--white);
    background: transparent;
    color: var(--white);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}
.btn-main:hover { background: var(--white); color: var(--bg); }
.btn-main:disabled { opacity: 0.2; pointer-events: none; }

.btn-secondary {
    padding: 12px 24px;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 200;
    letter-spacing: 0.3em;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--white-ghost);
    cursor: pointer;
    transition: all 0.6s;
}
.btn-secondary:hover { border-color: var(--border-active); color: var(--white-dim); }

.btn-back {
    font-family: inherit;
    font-size: 0.7rem;
    color: var(--white-ghost);
    background: none;
    border: none;
    cursor: pointer;
    letter-spacing: 0.1em;
    transition: color 0.4s;
}
.btn-back:hover { color: var(--white); }

/* === PAGE 2: DRAW === */
.draw-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 30px;
    padding: 0 10px;
    gap: 12px;
    position: relative;
}
.draw-header .btn-back {
    position: absolute;
    top: 0;
    left: 10px;
}
.oc-name-row {
    width: 100%;
    display: flex;
    justify-content: center;
}
.oc-name-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--white);
    font-size: 20px;
    font-family: "Noto Serif SC", serif;
    font-weight: 400;
    text-align: center;
    padding: 8px 16px;
    width: 60%;
    max-width: 240px;
    outline: none;
    letter-spacing: 2px;
    transition: border-color 0.3s;
}
.oc-name-input:focus {
    border-bottom-color: var(--white);
}
.oc-name-input::placeholder {
    color: var(--white-ghost);
    font-weight: 300;
}
.current-world {
    font-size: 0.78rem;
    color: var(--white-dim);
    letter-spacing: 0.2em;
}
.workspace-trigger {
    position: absolute;
    top: -6px;
    right: 10px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--white-dim);
    font-family: inherit;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: border-color .25s ease, background .25s ease, color .25s ease, transform .25s ease;
}
.workspace-trigger:hover,
.workspace-trigger[aria-expanded="true"] {
    border-color: var(--border-active);
    background: var(--surface-hover);
    color: var(--white);
    transform: translateY(-1px);
}
.workspace-trigger-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
}
.workspace-trigger-count {
    font-size: 10px;
    white-space: nowrap;
    color: var(--white-ghost);
}
.workspace-trigger-count strong {
    color: var(--white);
    font-weight: 600;
}
.workspace-trigger-divider {
    width: 1px;
    height: 12px;
    background: var(--border);
}

.river {
    position: relative;
    max-width: 600px;
    width: 100%;
    padding: 20px 0;
    margin: 0 auto;
}
.river::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    width: 1px; height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.08) 10%, rgba(255,255,255,0.08) 90%, transparent);
    transform: translateX(-50%);
}

.river-node {
    position: relative;
    padding: 20px 0;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}
.node-geo {
    position: absolute;
    top: 50%; left: 50%;
    width: 18px; height: 18px;
    transform: translate(-50%, -50%);
    z-index: 3;
    opacity: 0.25;
    transition: all 0.6s;
    color: var(--white);
}
.node-geo svg { width: 100%; height: 100%; }
.river-node:hover .node-geo { opacity: 0.6; }
.river-node.drawn .node-geo { opacity: 0.9; }
.river-node.locked .node-geo { opacity: 1; color: rgba(180,160,100,0.9); }

.river-node:nth-child(odd) .node-content { margin-right: calc(50% + 24px); text-align: right; }
.river-node:nth-child(even) .node-content { margin-left: calc(50% + 24px); text-align: left; }

.node-content {
    padding: 16px 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(8px);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}
.river-node:hover .node-content { border-color: var(--border-active); background: var(--surface-hover); }
.river-node.locked .node-content { border-color: rgba(180,160,100,0.3); }

.node-fog {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--fog-bg, rgba(240,244,248,0.7));
    backdrop-filter: blur(3px);
    opacity: 1;
    transition: opacity 1s ease;
    z-index: 1;
    pointer-events: none;
}
.river-node.drawn .node-fog { opacity: 0; }

.node-label {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 0.7rem;
    font-style: italic;
    color: var(--white-ghost);
    letter-spacing: 0.2em;
    margin-bottom: 6px;
}
.node-title {
    font-size: 0.95rem;
    font-weight: 300;
    color: var(--white-dim);
    letter-spacing: 0.15em;
}
.node-result {
    font-size: 1rem;
    color: var(--white);
    line-height: 1.8;
    margin-top: 8px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.8s ease;
}
.river-node.drawn .node-result { opacity: 1; max-height: 80px; }

.node-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.4s;
}
.river-node.drawn .node-actions { opacity: 1; }

.node-btn {
    font-family: inherit;
    font-size: 0.72rem;
    color: var(--white-ghost);
    background: none;
    border: none;
    cursor: pointer;
    letter-spacing: 0.08em;
    transition: color 0.3s;
}
.node-btn:hover { color: var(--white); }
.node-btn.lock-btn.active { color: rgba(180,160,100,0.9); }

.draw-footer {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    padding: 40px 0 60px;
    flex-wrap: wrap;
}

/* === PAGE 3: SHARE === */
.page-share { padding-top: 30px; }
.share-header { width: 100%; max-width: 600px; margin-bottom: 24px; }

.share-card { width: 100%; max-width: 480px; margin-bottom: 30px; }
.share-card-inner {
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(8px);
    padding: 36px 28px;
}
.share-card-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 100;
    letter-spacing: 0.5em;
    margin-bottom: 4px;
}
.share-card-world {
    text-align: center;
    font-size: 0.65rem;
    color: var(--white-ghost);
    letter-spacing: 0.3em;
    margin-bottom: 24px;
    font-style: italic;
}
.share-card-list { list-style: none; }
.share-card-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}
.share-card-list li:last-child { border-bottom: none; }
.share-card-label {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 0.58rem;
    font-style: italic;
    color: var(--white-ghost);
    letter-spacing: 0.12em;
    flex-shrink: 0;
    width: 65px;
}
.share-card-value {
    font-size: 0.72rem;
    color: var(--white);
    text-align: right;
    line-height: 1.5;
}

.share-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* === RESPONSIVE === */
@media (max-width: 700px) {
    .logo { font-size: 2.5rem; }
    .river-node:nth-child(odd) .node-content,
    .river-node:nth-child(even) .node-content {
        margin: 0 0 0 calc(50% + 20px);
        text-align: left;
    }
    .share-actions { flex-direction: column; align-items: center; }
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* === THEME SWITCHER === */
.theme-switcher {
    position: fixed;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}
.theme-dot {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.35s ease;
    opacity: 0.6;
}
.theme-dot::after {
    content: attr(title);
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    white-space: nowrap;
    color: var(--white);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.theme-dot:hover::after { opacity: 1; }
.theme-dot:hover { opacity: 1; transform: scale(1.25); }
.theme-dot.active {
    opacity: 1;
    transform: scale(1.3);
    border-color: rgba(0,0,0,0.4);
    box-shadow: 0 0 10px rgba(0,0,0,0.15);
}
.theme-dot[data-theme="mist"] { background: #5a9ec8; }
.theme-dot[data-theme="ink"] { background: #aaaaaa; }
.theme-dot[data-theme="aurora"] { background: #50d890; }
.theme-dot[data-theme="dream"] { background: #a870e0; }
.theme-dot[data-theme="amber"] { background: #d8a050; }
.theme-dot[data-theme="cyber"] { background: #0a0a0a; border-color: rgba(255,255,255,0.5); }

/* === MODE SWITCHER === */
.mode-switcher {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 0 12px;
}
.mode-icon {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--white-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    transition: all 0.3s;
}
.mode-icon:hover {
    border-color: var(--border-active);
    background: var(--surface-hover);
    color: var(--white);
}
.mode-icon.active {
    border-color: var(--border-active);
    color: var(--white);
    background: var(--surface-hover);
    box-shadow: 0 0 8px var(--white-whisper);
}
.mode-icon svg { width: 100%; height: 100%; }
.mode-container { flex: 1; overflow-y: auto; padding: 0 16px; width: 100%; align-self: stretch; }

/* === WHEEL MODE === */
.wheel-mode { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 8px; }
.wheel-dim-tabs { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 100%; }
.wheel-dim-tab {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--white-dim);
    cursor: pointer;
    transition: all 0.2s;
}
.wheel-dim-tab.active { border-color: var(--border-active); color: var(--white); background: var(--surface-hover); }
.wheel-dim-tab.done { opacity: 0.5; }
.wheel-stage { position: relative; }
.wheel-canvas { display: block; }
.wheel-pointer {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 12px solid var(--white);
}
.wheel-result { text-align: center; min-height: 32px; }
.wheel-result-label { font-size: 11px; color: var(--white-ghost); margin-right: 8px; }
.wheel-result-value { font-size: 16px; color: var(--white); font-weight: 300; }
.wheel-actions { display: flex; gap: 8px; }

/* === CARD MODE === */
.card-mode-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 0;
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}
.flip-card {
    perspective: 600px;
    height: 66px;
    position: relative;
}
.flip-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
}
.flip-card-front { background: var(--surface); }
.flip-card-back {
    background: var(--surface-hover);
    transform: rotateY(180deg);
    border-color: var(--border-active);
}
.flip-card-geo { width: 20px; height: 20px; color: var(--white-ghost); }
.flip-card-label { font-size: 14px; color: var(--white); }
.flip-card-en { font-size: 10px; color: var(--white-ghost); font-style: italic; }
.flip-card-dim { font-size: 11px; color: var(--white-ghost); }
.flip-card-result { font-size: 15px; color: var(--white); font-weight: 300; text-align: center; }
.flip-card-actions {
    position: absolute;
    bottom: -24px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}
.flip-card.flipped .flip-card-actions { opacity: 1; }
.flip-card.locked .flip-card-inner { opacity: 0.6; }

/* === SLOT MODE === */
.slot-mode { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; max-width: 500px; width: 100%; margin: 0 auto; }
.slot-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.3s;
}
.slot-row.done { border-color: var(--border-active); }
.slot-row.locked { opacity: 0.5; }
.slot-label { min-width: 56px; text-align: right; }
.slot-dim-name { font-size: 14px; color: var(--white); display: block; }
.slot-dim-en { font-size: 10px; color: var(--white-ghost); font-style: italic; }
.slot-window {
    flex: 1;
    height: 36px;
    overflow: hidden;
    position: relative;
    border-radius: 4px;
    background: var(--surface);
}
.slot-reel { transition: transform 2.5s cubic-bezier(0.1, 0.7, 0.2, 1); }
.slot-item {
    height: 36px;
    line-height: 36px;
    text-align: center;
    font-size: 15px;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}
.slot-item.final { font-weight: 300; }
.slot-actions { display: flex; gap: 4px; }

/* === SCRATCH MODE === */
.scratch-mode-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 0;
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}
.scratch-card {
    position: relative;
    height: 64px;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.scratch-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--surface);
}
.scratch-dim { font-size: 12px; color: var(--white-ghost); }
.scratch-result { font-size: 15px; color: var(--white); font-weight: 300; }
.scratch-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    cursor: crosshair;
    border-radius: 8px;
}
.scratch-card.revealed .scratch-layer { display: none; }
.scratch-card-actions {
    position: absolute;
    bottom: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}
.scratch-card.revealed .scratch-card-actions { opacity: 1; }
.scratch-card.locked { opacity: 0.5; }

/* === PARTICLE MODE === */
.particle-mode {
    position: relative;
    width: 100%;
    height: 60vh;
    min-height: 380px;
    overflow: hidden;
}
.particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
    z-index: 5;
}
.particle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 10;
}
.particle-text.visible { opacity: 1; }
.pt-dim {
    font-size: 18px;
    color: var(--white);
    letter-spacing: 3px;
    opacity: 0.7;
}
.pt-value {
    font-size: 36px;
    font-weight: 300;
    color: var(--white);
    letter-spacing: 3px;
    font-family: "Noto Serif SC", serif;
}
.pt-swatch {
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--white-whisper);
    margin-bottom: 4px;
}
.pr-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--white-whisper);
    flex-shrink: 0;
}
.pr-color-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}
.pr-swatch-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.pr-swatch-dot:hover { transform: scale(1.15); }
.pr-hex {
    font-size: 11px;
    color: var(--white-dim);
    font-family: monospace;
    letter-spacing: 0.5px;
}
.pr-reroll {
    background: none;
    border: 1px solid var(--border);
    color: var(--white-dim);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.pr-reroll:hover { opacity: 0.7; }
.pr-lock {
    min-width: 48px;
    height: 26px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--white-ghost);
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .25s ease;
}
.pr-lock:hover { color: var(--white); border-color: var(--border-active); }
.pr-lock.active {
    background: var(--white);
    border-color: var(--white);
    color: var(--bg);
}
.particle-result-item.is-locked {
    background: linear-gradient(90deg, var(--surface-hover), transparent 72%);
}
.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.08);
}
.particle-hint {
    position: absolute;
    bottom: 220px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: var(--white-dim);
    letter-spacing: 2px;
    z-index: 10;
    pointer-events: none;
    animation: breathePulse 3s ease-in-out infinite;
}
@keyframes breathePulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}
.particle-progress {
    position: absolute;
    top: 80px;
    right: 20px;
    font-size: 11px;
    color: var(--white-ghost);
    z-index: 10;
    pointer-events: none;
}
.particle-result-list {
    width: 100%;
    max-width: 400px;
    margin: 16px auto 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: transparent;
}
.particle-result-list:empty {
    display: none;
}
.particle-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    width: 100%;
    border-bottom: 1px solid var(--border);
}
.particle-result-item:last-child { border-bottom: none; }
.pr-label {
    color: var(--white-dim);
    font-size: 12px;
    min-width: 40px;
    font-weight: 400;
    letter-spacing: 1px;
    flex-shrink: 0;
}
.pr-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--white);
    font-size: 15px;
    font-family: "Noto Serif SC", serif;
    font-weight: 400;
    flex: 1;
    min-width: 0;
    padding: 4px 0;
    outline: none;
    transition: border-color 0.3s;
}
.pr-input:hover {
    border-bottom-color: var(--border);
}
.pr-input:focus {
    border-bottom-color: var(--white-dim);
}
.pr-value { color: var(--white); }

/* === CYBER THEME OVERRIDES === */
[data-theme="cyber"] .particle-result-list {
    background: transparent;
}
[data-theme="cyber"] .particle-result-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 14px 16px;
}
[data-theme="cyber"] .particle-result-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
[data-theme="cyber"] .pr-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.4);
    min-width: 50px;
}
[data-theme="cyber"] .pr-input {
    font-size: 18px;
    font-weight: 200;
    letter-spacing: 1px;
    border-bottom-color: rgba(255, 255, 255, 0.08);
    font-family: "Cormorant Garamond", Georgia, serif;
    color: rgba(255, 255, 255, 0.9);
}
[data-theme="cyber"] .pr-hex { color: rgba(255,255,255,0.4); }
[data-theme="cyber"] .pr-reroll { border-color: rgba(255,255,255,0.15); color: rgba(255,255,255,0.4); }
[data-theme="cyber"] .color-dot { border-color: rgba(255,255,255,0.15); }
[data-theme="cyber"] .pt-value {
    font-size: 42px;
    font-weight: 100;
    letter-spacing: 6px;
    text-transform: uppercase;
}
[data-theme="cyber"] .pt-dim {
    font-size: 11px;
    letter-spacing: 5px;
    text-transform: uppercase;
    opacity: 0.5;
}
[data-theme="cyber"] .particle-hint {
    font-size: 10px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
}
[data-theme="cyber"] .node-content {
    border: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="cyber"] .mode-icon {
    border-color: rgba(255, 255, 255, 0.15);
}
[data-theme="cyber"] .mode-icon.active {
    border-color: rgba(255, 255, 255, 0.6);
}
[data-theme="cyber"] .slot-row {
    border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="cyber"] .slot-dim-name {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 300;
}
[data-theme="cyber"] .slot-item.final {
    font-size: 17px;
    font-weight: 200;
    letter-spacing: 1px;
}

/* === INSPIRATION WORKSPACE === */
body.workspace-open { overflow: hidden; }
.workspace-backdrop {
    position: fixed;
    inset: 0;
    z-index: 980;
    background: rgba(8, 12, 18, .34);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(1.5px);
    transition: opacity .32s ease;
}
.workspace-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}
.workspace-drawer {
    position: fixed;
    z-index: 990;
    top: 0;
    right: 0;
    width: min(410px, calc(100vw - 24px));
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    border-left: 1px solid var(--border-active);
    box-shadow: -24px 0 70px rgba(0, 0, 0, .16);
    backdrop-filter: blur(24px) saturate(115%);
    transform: translateX(104%);
    visibility: hidden;
    transition: transform .42s cubic-bezier(.22, 1, .36, 1), visibility .42s;
}
.workspace-drawer.open {
    transform: translateX(0);
    visibility: visible;
}
.workspace-drawer-handle { display: none; }
.workspace-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 30px 28px 22px;
    border-bottom: 1px solid var(--border);
}
.workspace-kicker {
    margin-bottom: 7px;
    color: var(--white-ghost);
    font-size: 9px;
    letter-spacing: .27em;
}
.workspace-header h2 {
    font-family: "Noto Serif SC", serif;
    font-size: 25px;
    font-weight: 500;
    letter-spacing: .06em;
}
.workspace-header > div > p:last-child {
    margin-top: 8px;
    color: var(--white-dim);
    font-size: 12px;
    line-height: 1.6;
}
.workspace-close {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--white-dim);
    font-size: 24px;
    font-weight: 200;
    cursor: pointer;
    transition: all .25s ease;
}
.workspace-close:hover { border-color: var(--border-active); color: var(--white); transform: rotate(8deg); }
.workspace-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
}
.workspace-tab {
    min-height: 54px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--white-ghost);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all .25s ease;
}
.workspace-tab span {
    display: inline-grid;
    min-width: 19px;
    height: 19px;
    margin-left: 6px;
    padding: 0 5px;
    place-items: center;
    border-radius: 999px;
    background: var(--surface);
    font-size: 10px;
}
.workspace-tab.active {
    border-bottom-color: var(--white);
    color: var(--white);
}
.workspace-panel {
    min-height: 0;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}
.workspace-panel.active { display: flex; }
.workspace-tip {
    margin: 18px 20px 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--white-dim);
    font-size: 11px;
    line-height: 1.65;
}
.workspace-filters {
    display: grid;
    grid-template-columns: 1fr 115px;
    gap: 8px;
    padding: 18px 20px 10px;
}
.workspace-search { grid-column: 1 / -1; }
.workspace-search input,
.workspace-filters select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--white);
    font-family: inherit;
    font-size: 12px;
    outline: none;
}
.workspace-search input { padding: 0 13px; }
.workspace-search input::placeholder { color: var(--white-ghost); }
.workspace-filters select { padding: 0 30px 0 10px; }
.workspace-search input:focus,
.workspace-filters select:focus { border-color: var(--border-active); }
.workspace-filter-chip {
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--white-ghost);
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
}
.workspace-filter-chip.active {
    border-color: var(--border-active);
    background: var(--surface-hover);
    color: var(--white);
}
.workspace-list {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 14px 20px 24px;
    overscroll-behavior: contain;
}
.workspace-card {
    position: relative;
    flex: 0 0 auto;
    padding: 15px 16px 13px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    transition: border-color .25s ease, background .25s ease, transform .25s ease;
}
.workspace-card:hover {
    border-color: var(--border-active);
    background: var(--surface-hover);
    transform: translateY(-1px);
}
.workspace-card-candidate::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    background: var(--white);
    opacity: .62;
}
.workspace-card-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.workspace-dimension {
    color: var(--white-dim);
    font-size: 10px;
    letter-spacing: .17em;
}
.workspace-time { color: var(--white-ghost); font-size: 10px; }
.workspace-value {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 10px;
    color: var(--white);
    font-family: "Noto Serif SC", serif;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.workspace-color {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    border: 1px solid var(--border-active);
    border-radius: 50%;
}
.workspace-origin {
    margin-top: 6px;
    color: var(--white-ghost);
    font-size: 10px;
    line-height: 1.5;
}
.workspace-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 13px;
}
.workspace-card-actions button {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border-active);
    border-radius: 7px;
    background: var(--white);
    color: var(--bg);
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
}
.workspace-card-actions button.quiet {
    background: transparent;
    color: var(--white-dim);
    border-color: var(--border);
}
.workspace-card-actions button:hover { opacity: .76; }
.workspace-card-actions button:disabled { opacity: .42; cursor: default; }
.workspace-empty {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 260px;
    padding: 34px 20px;
    text-align: center;
}
.workspace-empty > span {
    margin-bottom: 13px;
    color: var(--white-ghost);
    font-size: 24px;
}
.workspace-empty h3 { font-size: 14px; font-weight: 500; }
.workspace-empty p {
    max-width: 250px;
    margin-top: 8px;
    color: var(--white-ghost);
    font-size: 11px;
    line-height: 1.7;
}
.workspace-privacy {
    padding: 13px 20px max(13px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    color: var(--white-ghost);
    font-size: 9px;
    line-height: 1.5;
    text-align: center;
}

/* === EXPORT MODAL === */
.export-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.export-modal {
    background: var(--bg, #1a1a1a);
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    border-radius: 12px;
    padding: 32px 28px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    position: relative;
}
.export-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--white-dim, #aaa);
    font-size: 22px;
    cursor: pointer;
}
.export-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--white, #fff);
    margin-bottom: 12px;
}
.export-modal-text {
    font-size: 14px;
    color: var(--white-dim, #ccc);
    line-height: 1.6;
    margin-bottom: 20px;
}
.export-modal-text strong {
    color: var(--accent, #fff);
}
.export-modal-captcha {
    margin-bottom: 16px;
}
.captcha-hint {
    font-size: 13px;
    color: var(--white-ghost, #888);
    margin-bottom: 10px;
}
.captcha-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border, rgba(255,255,255,0.15));
    border-radius: 6px;
    background: transparent;
    color: var(--white, #fff);
    font-size: 15px;
    text-align: center;
    letter-spacing: 2px;
    outline: none;
}
.captcha-input:focus {
    border-color: var(--accent, #fff);
}
.captcha-error {
    color: #ff6b6b;
    font-size: 12px;
    margin-top: 6px;
}
.export-modal-confirm {
    width: 100%;
    margin-top: 8px;
}

.back-to-main {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    padding: 8px 14px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.15);
    transition: background .2s, transform .2s;
}
.back-to-main:hover {
    background: rgba(0,0,0,.8);
    transform: translateX(-2px);
}

@media (max-width: 700px) {
    .page {
        padding: max(62px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    }
    .theme-switcher {
        top: auto;
        right: 50%;
        bottom: max(8px, env(safe-area-inset-bottom));
        transform: translateX(50%);
        flex-direction: row;
        gap: 6px;
        padding: 4px 8px;
        border-radius: 24px;
        background: rgba(8, 8, 8, 0.72);
        backdrop-filter: blur(10px);
    }
    .theme-dot::after { display: none; }
    .back-to-main {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        top: max(8px, env(safe-area-inset-top));
        left: 8px;
    }
    .particle-mode {
        height: 52dvh;
        min-height: 320px;
    }
    .draw-header { gap: 10px; margin-bottom: 22px; }
    .workspace-trigger {
        position: static;
        align-self: flex-end;
        min-height: 40px;
        margin: -4px 0 1px;
    }
    .workspace-drawer {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: min(84dvh, 740px);
        border-top: 1px solid var(--border-active);
        border-left: 0;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -24px 70px rgba(0, 0, 0, .18);
        transform: translateY(104%);
    }
    .workspace-drawer.open { transform: translateY(0); }
    .workspace-drawer-handle {
        display: block;
        width: 42px;
        height: 4px;
        flex: 0 0 4px;
        margin: 9px auto 0;
        border-radius: 4px;
        background: var(--border-active);
    }
    .workspace-header { padding: 16px 20px 15px; }
    .workspace-header h2 { font-size: 21px; }
    .workspace-header > div > p:last-child { margin-top: 5px; }
    .workspace-tabs { padding: 0 12px; }
    .workspace-tab { min-height: 48px; }
    .workspace-tip { margin: 13px 14px 0; }
    .workspace-filters { padding: 13px 14px 8px; }
    .workspace-list { padding: 10px 14px 20px; }
    .particle-result-item { gap: 7px; padding-inline: 8px; }
    .pr-label { min-width: 34px; }
    .pr-lock { min-width: 44px; padding-inline: 7px; }
    .mode-container { padding: 0 4px; }
    .draw-footer { padding-bottom: 54px; }
}

/* === 2026-08 READABILITY & RESPONSIVE LAYOUT REFRESH === */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

:root, [data-theme="mist"] {
    --white-dim: rgba(30, 50, 70, 0.84);
    --white-ghost: rgba(40, 70, 100, 0.58);
    --border: rgba(60, 100, 140, 0.24);
    --border-active: rgba(50, 90, 140, 0.5);
    --surface: rgba(60, 100, 150, 0.09);
    --surface-hover: rgba(60, 100, 150, 0.15);
}
[data-theme="ink"] {
    --white-dim: rgba(20, 20, 20, 0.84);
    --white-ghost: rgba(30, 30, 30, 0.56);
    --border: rgba(0, 0, 0, 0.18);
    --border-active: rgba(0, 0, 0, 0.42);
    --surface: rgba(0, 0, 0, 0.055);
    --surface-hover: rgba(0, 0, 0, 0.09);
}
[data-theme="aurora"] {
    --white-dim: rgba(20, 60, 40, 0.84);
    --white-ghost: rgba(30, 80, 55, 0.58);
    --border: rgba(40, 140, 90, 0.22);
    --border-active: rgba(40, 150, 95, 0.46);
    --surface: rgba(40, 150, 90, 0.08);
    --surface-hover: rgba(40, 160, 100, 0.14);
}
[data-theme="dream"] {
    --white-dim: rgba(50, 30, 70, 0.84);
    --white-ghost: rgba(70, 40, 100, 0.58);
    --border: rgba(120, 80, 180, 0.2);
    --border-active: rgba(130, 80, 200, 0.42);
    --surface: rgba(120, 80, 180, 0.08);
    --surface-hover: rgba(130, 90, 190, 0.14);
}
[data-theme="amber"] {
    --white-dim: rgba(60, 40, 20, 0.84);
    --white-ghost: rgba(80, 55, 30, 0.58);
    --border: rgba(160, 120, 50, 0.22);
    --border-active: rgba(180, 130, 50, 0.44);
    --surface: rgba(170, 130, 50, 0.08);
    --surface-hover: rgba(180, 140, 60, 0.14);
}

body {
    font-weight: 400;
    line-height: 1.55;
}
.page {
    padding: clamp(76px, 8vh, 104px) clamp(20px, 4vw, 64px) 48px;
}
.page-world.active {
    justify-content: center;
}
.geo-accent {
    width: min(720px, 82vmin);
    height: min(720px, 82vmin);
    opacity: .82;
}
.world-header {
    max-width: 760px;
    margin-bottom: 30px;
    padding-top: 0;
}
.overline {
    margin-bottom: 12px;
    color: var(--white-ghost);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .28em;
}
.logo {
    font-size: clamp(6rem, 10vw, 8.5rem);
    line-height: .82;
}
.subtitle {
    margin-top: 22px;
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    font-weight: 400;
    letter-spacing: .28em;
}
.world-intro {
    max-width: 520px;
    margin: 18px auto 0;
    color: var(--white-dim);
    font-size: 15px;
    line-height: 1.8;
    letter-spacing: .04em;
}
.world-mode-switch {
    width: min(640px, 100%);
    max-width: none;
    gap: 5px;
    margin-bottom: 18px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg) 76%, transparent);
    backdrop-filter: blur(16px);
}
.mode-btn {
    min-height: 50px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--white-ghost);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .08em;
}
.mode-btn.active {
    border-color: var(--border);
    background: var(--surface-hover);
    box-shadow: 0 8px 24px var(--white-whisper);
}
.world-random {
    max-width: 640px;
    gap: 20px;
}
.world-random-card {
    min-height: 190px;
    padding: 30px 34px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    box-shadow: 0 22px 60px rgba(18, 35, 52, .06);
    backdrop-filter: blur(14px);
}
.random-hint {
    color: var(--white-dim);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: .16em;
}
.world-random-card .world-name {
    font-size: clamp(2.25rem, 5vw, 3.35rem);
    font-weight: 400;
    letter-spacing: .06em;
}
.world-random-card .world-category {
    color: var(--white-dim);
    font-size: 12px;
    font-weight: 500;
}
.world-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--bg) 76%, transparent);
}
.world-item {
    min-height: 54px;
    padding: 12px 14px;
    border-radius: 9px;
}
.world-item-name { font-size: 14px; }
.btn-main,
.btn-secondary {
    min-height: 50px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .12em;
}
.btn-main { padding: 0 30px; }
.btn-secondary { padding: 0 24px; }
.btn-back {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    color: var(--white-dim);
    font-size: 14px;
    font-weight: 500;
}
.back-to-main {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 14px;
}

.page-draw.active { align-items: stretch; }
.draw-header {
    max-width: 960px;
    margin: 0 auto 24px;
    gap: 14px;
}
.draw-header .btn-back { left: 0; }
.oc-name-input {
    width: min(420px, 70%);
    max-width: 420px;
    min-height: 50px;
    font-size: 24px;
}
.current-world {
    color: var(--white-dim);
    font-size: 14px;
    font-weight: 500;
}
.workspace-trigger {
    right: 0;
    min-height: 44px;
    gap: 9px;
    padding: 9px 14px;
}
.workspace-trigger-title { font-size: 14px; }
.workspace-trigger-count { font-size: 12px; color: var(--white-dim); }
.mode-switcher {
    width: min(760px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    padding: 0 0 22px;
}
.mode-icon {
    width: 100%;
    height: 56px;
    gap: 8px;
    padding: 9px 13px;
    border-radius: 12px;
}
.mode-icon svg {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}
.mode-icon-label {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.mode-container {
    width: min(900px, 100%);
    max-width: 900px;
    margin: 0 auto;
    padding: 0;
    overflow: visible;
}
.particle-mode {
    height: min(58vh, 560px);
    min-height: 430px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    box-shadow: 0 24px 72px rgba(18, 35, 52, .06);
}
.particle-hint { font-size: 15px; font-weight: 500; }
.particle-progress { font-size: 13px; }
.particle-result-list {
    max-width: 720px;
    margin-top: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}
.particle-result-item { gap: 12px; padding: 15px 18px; }
.pr-label { min-width: 54px; font-size: 13px; }
.pr-input { font-size: 17px; }
.pr-reroll {
    width: 34px;
    height: 34px;
    font-size: 15px;
}
.pr-lock {
    min-width: 64px;
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
}
.draw-footer {
    width: min(900px, 100%);
    margin: 0 auto;
    padding: 28px 0 60px;
}
.wheel-dim-tab { min-height: 34px; padding: 6px 11px; font-size: 13px; }
.wheel-result-label { font-size: 13px; }
.wheel-result-value { font-size: 18px; }
.card-mode-grid,
.scratch-mode-grid { max-width: 620px; gap: 14px; }
.flip-card { height: 78px; }
.flip-card-label { font-size: 16px; }
.flip-card-en,
.flip-card-dim { font-size: 12px; }
.flip-card-result { font-size: 17px; }
.slot-mode { max-width: 720px; gap: 10px; }
.slot-row { min-height: 60px; padding: 12px 16px; border-radius: 10px; }
.slot-dim-name { font-size: 15px; }
.slot-dim-en { font-size: 12px; }
.slot-window,
.slot-item { height: 42px; }
.slot-item { line-height: 42px; font-size: 17px; }
.scratch-card { height: 76px; }
.scratch-dim { font-size: 13px; }
.scratch-result { font-size: 17px; }
.node-label { font-size: 13px; }
.node-title { font-size: 16px; }
.node-result { font-size: 17px; }
.node-btn { min-height: 34px; font-size: 13px; }

.share-card { max-width: 620px; }
.share-card-inner { padding: 40px 36px; border-radius: 16px; }
.share-card-title { font-size: 28px; font-weight: 500; letter-spacing: .24em; }
.share-card-world { font-size: 13px; color: var(--white-dim); }
.share-card-list li { padding: 12px 0; gap: 18px; }
.share-card-label { width: 86px; font-size: 13px; color: var(--white-dim); }
.share-card-value { font-size: 16px; }

.workspace-drawer { width: min(460px, calc(100vw - 24px)); }
.workspace-kicker { font-size: 10px; }
.workspace-header > div > p:last-child { font-size: 14px; }
.workspace-tab { font-size: 14px; }
.workspace-tip { font-size: 13px; }
.workspace-search input,
.workspace-filters select { min-height: 44px; font-size: 14px; }
.workspace-filter-chip { min-height: 44px; font-size: 13px; }
.workspace-dimension,
.workspace-time { font-size: 12px; }
.workspace-value { font-size: 19px; }
.workspace-origin { font-size: 12px; }
.workspace-card-actions button { min-height: 42px; font-size: 13px; }
.workspace-empty h3 { font-size: 16px; }
.workspace-empty p { font-size: 13px; }
.workspace-privacy { font-size: 11px; }

@media (max-width: 700px) {
    .page {
        padding: max(72px, env(safe-area-inset-top)) 16px max(76px, env(safe-area-inset-bottom));
    }
    .page-world.active { justify-content: flex-start; }
    .geo-accent {
        top: 44%;
        width: min(470px, 112vw);
        height: min(470px, 112vw);
    }
    .world-header { margin-bottom: 22px; }
    .overline { font-size: 11px; letter-spacing: .2em; }
    .logo { font-size: 4.75rem; }
    .subtitle { margin-top: 15px; font-size: 17px; letter-spacing: .22em; }
    .world-intro {
        max-width: 330px;
        margin-top: 14px;
        font-size: 14px;
        line-height: 1.75;
    }
    .world-mode-switch { margin-bottom: 14px; }
    .mode-btn { min-height: 48px; padding: 0 8px; font-size: 14px; }
    .world-random { gap: 14px; }
    .world-random-card { min-height: 158px; padding: 24px 18px; border-radius: 15px; }
    .random-hint { font-size: 13px; letter-spacing: .1em; }
    .world-random-card .world-name { font-size: 2.25rem; }
    .world-random-actions { width: 100%; }
    .world-random-actions .btn-main { flex: 1; }
    .world-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 52dvh; }
    .world-item { min-height: 52px; }
    .theme-switcher { gap: 5px; padding: 5px 8px; }
    .theme-dot { width: 34px; height: 34px; }

    .page-draw { padding-inline: 14px; }
    .draw-header {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 12px;
        padding: 0;
        margin-bottom: 18px;
    }
    .draw-header .btn-back {
        position: static;
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }
    .workspace-trigger {
        position: static;
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        align-self: center;
        min-height: 44px;
        margin: 0;
        padding-inline: 11px;
    }
    .workspace-trigger-title { font-size: 13px; }
    .workspace-trigger-count { font-size: 11px; }
    .oc-name-row { grid-column: 1 / -1; grid-row: 2; }
    .oc-name-input { width: 100%; max-width: none; min-height: 48px; font-size: 22px; }
    .current-world {
        grid-column: 1 / -1;
        grid-row: 3;
        justify-self: center;
        font-size: 14px;
    }
    .mode-switcher { gap: 6px; padding-bottom: 16px; }
    .mode-icon {
        height: 60px;
        flex-direction: column;
        gap: 3px;
        padding: 6px 3px;
        border-radius: 10px;
    }
    .mode-icon svg { width: 22px; height: 22px; flex-basis: 22px; }
    .mode-icon-label { font-size: 11px; }
    .particle-mode {
        height: min(52dvh, 460px);
        min-height: 350px;
        border-radius: 16px;
    }
    .particle-hint { bottom: 180px; max-width: 90%; font-size: 14px; text-align: center; }
    .particle-progress { top: 64px; right: 14px; font-size: 12px; }
    .particle-result-list { border-radius: 13px; }
    .particle-result-item { gap: 8px; padding: 13px 12px; }
    .pr-label { min-width: 44px; font-size: 12px; }
    .pr-input { font-size: 16px; }
    .pr-reroll { width: 36px; height: 36px; }
    .pr-lock { min-width: 58px; height: 36px; padding-inline: 8px; font-size: 12px; }
    .draw-footer { gap: 9px; padding: 22px 0 18px; }
    .draw-footer .btn-main,
    .draw-footer .btn-secondary { flex: 1 1 120px; padding-inline: 14px; }

    .river { padding-inline: 2px; }
    .river::before { left: 15px; transform: none; }
    .river-node .node-geo { left: 15px; }
    .river-node:nth-child(odd) .node-content,
    .river-node:nth-child(even) .node-content {
        margin: 0 0 0 34px;
        text-align: left;
    }
    .node-content { padding: 15px 16px; }
    .card-mode-grid,
    .scratch-mode-grid { max-width: 100%; }
    .slot-row { padding: 10px; }
    .slot-label { min-width: 54px; }

    .share-card-inner { padding: 30px 20px; }
    .share-card-title { font-size: 24px; }
    .share-card-world { font-size: 12px; }
    .share-card-label { width: 72px; font-size: 12px; }
    .share-card-value { font-size: 15px; }
    .share-actions { width: 100%; }
    .share-actions .btn-main,
    .share-actions .btn-secondary { width: 100%; }

    .workspace-drawer { height: min(88dvh, 780px); }
    .workspace-header { padding: 17px 18px 15px; }
    .workspace-header h2 { font-size: 23px; }
    .workspace-header > div > p:last-child { font-size: 13px; }
    .workspace-tab { min-height: 52px; font-size: 14px; }
    .workspace-tip { margin: 13px 14px 0; padding: 12px 13px; font-size: 13px; }
    .workspace-filters { grid-template-columns: 1fr 128px; }
    .workspace-list { gap: 12px; padding-bottom: 24px; }
    .workspace-card { padding: 16px; }
    .workspace-card-actions { gap: 9px; }
    .workspace-card-actions button { min-height: 44px; flex: 1; padding-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    #bgCanvas { display: none; }
}
