:root {
    --bg: #0b0b0b;
    --panel: #151515;
    --panel-2: #1e1e1e;
    --line: #2c2c2c;
    --text: #f5f5f5;
    --muted: #a0a0a0;
    --accent: #39e0a0;
    --accent-2: #2dc48b;
    --danger: #ff6c6c;
    --font-family-primary: "Pretendard Variable", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: #050505;
    color: var(--text);
    font-family: var(--font-family-primary);
}

:lang(en) {
    font-family: "Aptos", "Segoe UI Variable", "Inter", "Helvetica Neue", sans-serif;
}

a { color: inherit; text-decoration: none; }

.app-shell {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    background: linear-gradient(180deg, #0b0b0b 0%, #101010 100%);
    border-left: 1px solid #1a1a1a;
    border-right: 1px solid #1a1a1a;
}

.desktop-shell {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 24px;
    background: #0b0b0b;
}

.home-shell {
    max-width: 1240px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: rgba(11, 11, 11, 0.92);
    backdrop-filter: blur(10px);
    z-index: 5;
}

.title { font-size: 22px; font-weight: 700; }
.subtitle { font-size: 12px; color: var(--muted); }
.back-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-height: 40px;
    margin: -2px 0 -2px -5px;
    padding: 6px 10px 6px 8px;
    border-radius: 12px;
    color: #f1f1f1;
    font-size: 19px;
    font-weight: 750;
    line-height: 1;
    transition: color .16s ease, background .16s ease;
}
.back-nav:hover,
.back-nav:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, .07);
    outline: none;
}
.back-nav-icon {
    flex: 0 0 auto;
    width: 11px;
    height: 11px;
    border-left: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    transform: rotate(45deg);
    border-radius: 1px;
}
.back-nav-label {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-title-group {
    flex: 1 1 auto;
    min-width: 0;
}
.icon-btn, .ghost-btn, .primary-btn {
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
}
.icon-btn, .ghost-btn { background: #212121; color: var(--text); }
.primary-btn { background: var(--accent); color: #02140d; font-weight: 700; }
.primary-btn.block, .ghost-btn.block { width: 100%; }

.page-body { padding: 18px 16px 96px; }
.section { margin-bottom: 28px; }
.section h2, .section h3 { margin: 0 0 8px; font-size: 20px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.pill-row, .tabs, .bottom-tabs, .chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill, .tab, .chip {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #171717;
    font-size: 13px;
    color: #d8d8d8;
}
.tab.active, .pill.active, .chip.active {
    border-color: var(--accent);
    color: #fff;
}

.segment-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 0;
    border-bottom: 0;
    box-shadow: inset 0 -2px #353535;
    scrollbar-width: none;
    scroll-padding-inline: 12px;
    overscroll-behavior-inline: contain;
}
.segment-tabs::-webkit-scrollbar {
    display: none;
}
.segment-tabs a {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    padding-bottom: 10px;
    border-bottom: 0;
    margin-bottom: 0;
    position: relative;
    z-index: 1;
}
.segment-tabs a::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 999px;
    background: transparent;
}
.segment-tabs a.active {
    color: var(--text);
}
.segment-tabs a.active::after {
    background: var(--accent);
}

.field, .textarea, .select, .message-input {
    width: 100%;
    background: #1d1d1d;
    color: var(--text);
    border: 1px solid #393939;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 14px;
}
.textarea { min-height: 130px; resize: vertical; }
.field-label {
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 15px;
}
.counter {
    color: #8b8b8b;
    font-size: 12px;
    text-align: right;
    margin-top: 6px;
}

.form-card, .panel-card, .message-card, .gallery-card, .story-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
}
.form-card, .panel-card { padding: 16px; }
.stack { display: grid; gap: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* Login */
.auth-page { min-height: 100dvh; background: #050505; }
.auth-shell {
    display: grid;
    place-items: center;
    max-width: 1120px;
    min-height: 100dvh;
}
.auth-layout {
    width: min(100%, 980px);
    min-height: 610px;
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(340px, .88fr);
    overflow: hidden;
    border: 1px solid #252525;
    border-radius: 30px;
    background: #101010;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .42);
}
.auth-visual {
    position: relative;
    min-width: 0;
    overflow: hidden;
    padding: 34px;
    background:
        radial-gradient(circle at 78% 70%, rgba(57, 224, 160, .18), transparent 32%),
        linear-gradient(145deg, #121c18 0%, #0a0d0c 54%, #080808 100%);
}
.auth-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
    background-size: 34px 34px;
    pointer-events: none;
}
.auth-brand-logo { position: relative; z-index: 2; width: 168px; height: auto; }
.auth-visual-copy { position: relative; z-index: 2; max-width: 390px; margin-top: 56px; }
.auth-eyebrow {
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .18em;
}
.auth-visual-copy h1 { margin: 12px 0 13px; font-size: clamp(28px, 3.2vw, 42px); line-height: 1.18; letter-spacing: -.04em; }
.auth-visual-copy p { margin: 0; color: #9da7a3; font-size: 14px; line-height: 1.6; }
.auth-character {
    position: absolute;
    z-index: 1;
    right: -46px;
    bottom: -92px;
    width: min(82%, 470px);
    height: auto;
    filter: drop-shadow(0 24px 30px rgba(0, 0, 0, .36));
    pointer-events: none;
    animation: auth-character-float 4.6s ease-in-out infinite;
}
.auth-panel { display: grid; align-content: center; padding: 48px 42px; background: #101010; }
.auth-panel-heading { margin-bottom: 28px; }
.auth-panel-heading::before {
    content: "";
    width: 32px;
    height: 3px;
    display: block;
    margin-bottom: 15px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 18px rgba(57,224,160,.26);
}
.auth-panel-heading h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.035em; }
.auth-panel-heading p { margin: 0; color: #8d8d8d; font-size: 13px; line-height: 1.5; }
.auth-form { gap: 18px; }
.auth-field-group { display: grid; }
.auth-form .field {
    min-height: 52px;
    border-color: #343434;
    background: #171717;
    color: #f5f5f5;
    caret-color: var(--accent);
    color-scheme: dark;
    font-family: var(--font-family-primary);
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.auth-form .field:hover { border-color: #484848; }
.auth-form .field:focus {
    border-color: rgba(57, 224, 160, .72);
    background: #171717;
    box-shadow: 0 0 0 3px rgba(57, 224, 160, .08);
}
.auth-form .field::placeholder { color: #696969; }
.auth-form .field:-webkit-autofill,
.auth-form .field:-webkit-autofill:hover,
.auth-form .field:-webkit-autofill:focus {
    -webkit-text-fill-color: #f5f5f5 !important;
    caret-color: var(--accent);
    -webkit-box-shadow: 0 0 0 1000px #171717 inset !important;
    box-shadow: 0 0 0 1000px #171717 inset !important;
    transition: background-color 9999s ease-out 0s;
}
.auth-status:empty { display: none; }
.auth-status { color: #ff9a9a; font-size: 13px; line-height: 1.45; }
.auth-submit { min-height: 52px; margin-top: 2px; font-family: var(--font-family-primary); font-size: 15px; }
.auth-footnote { margin: 22px 0 0; color: #666; font-size: 11px; text-align: center; }
@keyframes auth-character-float {
    0%, 100% { transform: translate3d(0, 0, 0) rotate(-.3deg); }
    50% { transform: translate3d(-2px, -8px, 0) rotate(.5deg); }
}
@media (prefers-reduced-motion: reduce) {
    .auth-character { animation: none; }
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.image-card {
    position: relative;
    overflow: hidden;
    min-height: 230px;
    border-radius: 18px;
    background: #181818;
    border: 1px solid var(--line);
}
.image-card img {
    width: 100%;
    height: 230px;
    object-fit: cover;
    display: block;
}
.image-card .caption {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(23, 23, 23, 0.8);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
}

.drop-card {
    min-height: 230px;
    border: 1px dashed #3f3f3f;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: var(--muted);
    background: #111;
}

.footer-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 10px;
    padding: 14px 16px 18px;
    background: linear-gradient(180deg, rgba(11,11,11,0) 0%, rgba(11,11,11,0.94) 35%);
}

.wizard-status {
    display: flex;
    justify-content: flex-start;
}

.chat-room-shell {
    --chat-message-font-size: 15px;
    --chat-avatar-size: 40px;
    --chat-message-column-gap: 10px;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-room-shell > .topbar { flex: 0 0 auto; }
.chat-room-shell > .page-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
.chat-room-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
}
.chat-feed {
    display: grid;
    gap: 24px;
}
.chat-system-notification {
    display: grid;
    align-self: center;
    width: min(64%, 420px);
    min-width: min(230px, 100%);
    color: #a3a3a3;
    text-align: center;
    font-size: 11px;
    line-height: 1.55;
    border-top: 1px dashed #555;
}
.chat-system-notification.system-entering {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .28s ease-out, transform .32s ease-out;
}
.chat-system-notification.system-entering.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.chat-system-notification__heading {
    padding: 8px 0 9px;
}
.chat-system-notification__title { white-space: nowrap; }
.chat-system-notification__body {
    white-space: pre-wrap;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.chat-system-notification[data-notification-kind="EPISODE_STARTED"] .chat-system-notification__heading,
.chat-system-notification[data-notification-kind="EPISODE_CLEARED"] .chat-system-notification__heading {
    border-bottom: 1px dashed #555;
}
.chat-system-notification[data-notification-kind="EPISODE_STARTED"] .chat-system-notification__body,
.chat-system-notification[data-notification-kind="EPISODE_CLEARED"] .chat-system-notification__body {
    padding-top: 26px;
}
.chat-system-notification[data-notification-kind="EPISODE_HINT"],
.chat-system-notification[data-notification-kind="ENDING_HINT"] {
    border-bottom: 1px dashed #555;
    padding-bottom: 12px;
}
.chat-system-notification[data-notification-kind="EPISODE_HINT"] .chat-system-notification__heading,
.chat-system-notification[data-notification-kind="ENDING_HINT"] .chat-system-notification__heading {
    padding: 8px 0 0;
}
@media (prefers-reduced-motion: reduce) {
    .chat-system-notification.system-entering {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
.chat-page-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 20px 14px 24px;
    scroll-padding-block: 20px 24px;
}
.chat-state-snapshot {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.chat-state-snapshot.state-snapshot-pending { display: none; }
.bubble-wrap {
    display: flex;
    align-items: flex-start;
    gap: var(--chat-message-column-gap);
    width: 100%;
    min-width: 0;
}
.bubble-wrap.user { justify-content: flex-end; }
.message-content {
    width: fit-content;
    max-width: min(
        calc(100% - var(--chat-avatar-size) - var(--chat-message-column-gap)),
        560px
    );
    min-width: 0;
    display: grid;
    justify-items: start;
    gap: 6px;
}
.bubble-wrap.user .message-content { justify-items: end; }
.message-stack {
    display: grid;
    gap: 10px;
    justify-items: start;
    min-width: 0;
    width: fit-content;
    max-width: 100%;
}
.bubble-wrap.user .message-stack { justify-items: end; }
.message-media-stack {
    display: grid;
    gap: 10px;
    width: fit-content;
    max-width: 100%;
    justify-items: start;
}
.bubble-wrap.user .message-media-stack { justify-items: end; }
.message-media-frame {
    display: block;
    width: min(320px, 72vw);
    max-width: 100%;
    max-height: 420px;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background: #171717;
    transform-origin: 50% 0;
}
.message-media-frame.image-entering {
    max-height: 0;
    opacity: 0;
    transform: translateY(10px) scale(.985);
    transition:
        max-height .34s cubic-bezier(.22, .8, .24, 1),
        opacity .24s ease-out,
        transform .34s cubic-bezier(.22, .8, .24, 1);
}
.message-media-frame.image-entering.is-visible {
    max-height: 420px;
    opacity: 1;
    transform: translateY(0) scale(1);
}
.message-media-frame .chat-image {
    width: 100%;
    max-width: none;
    border: 0;
    border-radius: inherit;
}
.bubble-wrap:not(.user) .message-media-frame {
    justify-self: start;
}
.message-speaker-name {
    max-width: 100%;
    padding: 1px 2px 0;
    color: #ededed;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.35;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bubble-wrap.user .message-speaker-name { text-align: right; }
.avatar {
    width: var(--chat-avatar-size);
    height: var(--chat-avatar-size);
    border-radius: 50%;
    background: #2c2c2c; display: grid; place-items: center; color: #d8d8d8; font-size: 12px;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 3px 12px rgba(0,0,0,.22);
    flex: 0 0 auto;
}
.bubble {
    width: fit-content;
    max-width: 100%;
    background: #222;
    border-radius: 8px 20px 20px 20px;
    padding: 13px 15px;
    border: 1px solid rgba(255,255,255,.035);
    font-size: var(--chat-message-font-size);
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.bubble.user {
    background: #2b2b2b;
    border-radius: 20px 8px 20px 20px;
}
.turn-bubble {
    width: fit-content;
    max-width: 100%;
    display: grid;
    gap: 12px;
}
.stream-content-part { display: contents; }
.turn-segment {
    min-width: 0;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.turn-action {
    color: #a9a9a9;
    font-style: italic;
}
.turn-scene { color: #d0d0d0; }
.turn-dialogue { color: #f4f4f4; }
.turn-bubble.user .turn-action { text-align: left; color: #b9b9b9; }
.chat-message.stream-pending { display: none; }
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    width: max-content;
    min-width: 58px;
    padding: 14px 18px;
}
.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(57, 224, 160, .35);
    animation: typing-dot 1.15s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: .16s; }
.typing-indicator span:nth-child(3) { animation-delay: .32s; }
@keyframes typing-dot {
    0%, 60%, 100% { transform: translateY(0); opacity: .35; }
    30% { transform: translateY(-5px); opacity: 1; }
}
.narration {
    width: 100%;
    background: transparent;
    padding: 2px 0;
    color: #c8c8c8;
    font-size: var(--chat-message-font-size);
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.action-narration {
    color: #a9a9a9;
    font-style: italic;
}
.user-action-narration { text-align: left; color: #b9b9b9; }
.scene-narration {
    color: #d0d0d0;
}
.intro-narration-message {
    display: grid;
    justify-self: center;
    gap: 10px;
    width: 100%;
    max-width: 620px;
    padding: 4px 24px 6px;
}
.intro-narration {
    width: 100%;
    color: #a3a3a3;
    font-size: var(--chat-message-font-size);
    line-height: 1.7;
    text-align: left;
    white-space: pre-wrap;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.intro-narration-message .message-media-frame {
    width: min(100%, 360px);
    margin-block: 4px 2px;
    margin-inline: auto;
}
.chat-image {
    display: block;
    width: min(320px, 72vw);
    max-height: 420px;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
}
@media (prefers-reduced-motion: reduce) {
    .message-media-frame.image-entering {
        max-height: 420px;
        opacity: 1;
        transform: none;
        transition: none;
    }
}
.chat-composer {
    position: relative;
    z-index: 4;
    background: rgba(11,11,11,0.95);
    border-top: 1px solid var(--line);
    padding: 11px 14px max(16px, env(safe-area-inset-bottom));
}
.chat-status { display: none; }
.chat-status.error { display: block; color: #ff9a9a; margin-bottom: 8px; }
.composer-row { display: flex; gap: 9px; align-items: center; }
.message-input-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.message-input-wrap .message-input {
    height: 48px;
    min-height: 48px;
    max-height: 140px;
    padding: 12px 15px;
    border-color: #343434;
    border-radius: 14px;
    background: #181818;
    resize: none;
    overflow-y: hidden;
    font-family: var(--font-family-primary);
    font-size: 14px;
    font-weight: 400;
    line-height: 22px;
    color-scheme: dark;
    caret-color: var(--accent);
}
.message-input-wrap .message-input::placeholder {
    color: #777;
    font-family: var(--font-family-primary);
    font-size: 14px;
    font-weight: 400;
    opacity: 1;
}
.message-input-wrap .message-input:focus {
    background: #1b1b1b;
    color: var(--text);
    border-color: rgba(57, 224, 160, .48);
    box-shadow: 0 0 0 3px rgba(57, 224, 160, .06);
    outline: none;
}
.message-input-wrap .message-input:-webkit-autofill,
.message-input-wrap .message-input:-webkit-autofill:hover,
.message-input-wrap .message-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--accent);
    box-shadow: 0 0 0 1000px #181818 inset;
    transition: background-color 9999s ease-out 0s;
}
.send-btn {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 0;
    background: var(--accent);
    color: #04150d;
    cursor: pointer;
    transition: background .16s ease, transform .16s ease;
}
.send-btn:hover,
.send-btn:focus-visible {
    background: #55e8af;
    outline: none;
    transform: translateY(-1px);
}
.send-icon {
    width: 17px;
    height: 16px;
    display: block;
    background: #063a28;
    clip-path: polygon(0 0, 100% 50%, 0 100%, 20% 50%);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.gallery-card img, .story-card img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
}
.gallery-card .body, .story-card .body { padding: 16px; }
.meta { color: var(--muted); font-size: 13px; }
.gallery-card-media { position: relative; min-height: 72px; }
.gallery-card-media .character-status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
}
.character-status-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px !important;
    font-weight: 800;
    white-space: nowrap;
}
.character-status-badge.complete {
    color: #75efbd !important;
    background: rgba(50, 215, 160, .15);
    border: 1px solid rgba(50, 215, 160, .38);
}
.character-status-badge.draft {
    color: #ffd27a !important;
    background: rgba(255, 183, 66, .14);
    border: 1px solid rgba(255, 183, 66, .35);
}
.character-status-badge.inactive {
    color: #c2c2c2 !important;
    background: rgba(150,150,150,.14);
    border: 1px solid rgba(180,180,180,.28);
}
.character-status-badge.review {
    color: #9cc8ff !important;
    background: rgba(90, 160, 255, .14);
    border: 1px solid rgba(90, 160, 255, .36);
}
.character-status-badge.rejected {
    color: #ff9a9a !important;
    background: rgba(255, 108, 108, .14);
    border: 1px solid rgba(255, 108, 108, .38);
}
.owned-work-card .gallery-card-media .character-status-badge { right: auto; left: 12px; }
.character-card-action { margin-top: 14px; text-align: center; }

.story-list {
    display: grid;
    gap: 18px;
}
.story-card {
    overflow: hidden;
}
.story-card .cover {
    position: relative;
}
.story-card .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.1) 25%, rgba(0,0,0,0.85) 100%);
}
.story-card .title-block {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
}
.story-preview {
    margin-top: 12px;
    background: #202020;
    border-radius: 14px;
    padding: 12px 14px;
}

.quick-links {
    display: grid;
    gap: 12px;
}
.quick-links a {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #131313;
}

.home-page {
    display: grid;
    gap: 28px;
}
.home-hero {
    background:
        radial-gradient(circle at top right, rgba(57, 224, 160, .12), transparent 28%),
        linear-gradient(180deg, #171717, #111111);
}
.home-topbar {
    align-items: center;
    gap: 16px;
}
.home-brand {
    display: flex;
    flex: 0 1 190px;
    min-width: 0;
}
.home-brand-logo {
    display: block;
    width: 100%;
    max-width: 190px;
    height: auto;
}
.home-topbar-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}
.home-topbar-actions > * {
    white-space: nowrap;
}
.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 12px;
}
.section-heading.compact {
    margin-bottom: 10px;
    align-items: center;
}
.section-heading h2, .section-heading h3 {
    margin: 0;
}
.section-kicker {
    color: var(--accent);
    font-size: 11px;
    letter-spacing: .18em;
    margin-bottom: 6px;
}
.home-section {
    display: grid;
    gap: 14px;
}
.section-more-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 1px 7px 10px;
    color: #a6a6a6;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -.01em;
    transition: color .16s ease, gap .16s ease;
}
.section-more-link:hover,
.section-more-link:focus-visible { color: #f4f4f4; gap: 13px; outline: none; }
.section-more-arrow {
    width: 8px;
    height: 8px;
    border-top: 1px solid currentColor;
    border-right: 1px solid currentColor;
    transform: rotate(45deg);
}
.horizontal-cards {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 280px);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
}
.mode-card {
    display: grid;
    border-radius: 22px;
    overflow: hidden;
    background: #161616;
    border: 1px solid #2a2a2a;
    scroll-snap-align: start;
    min-height: 320px;
}
.mode-card-cover {
    min-height: 220px;
    background: linear-gradient(135deg, #252525, #111111) center/cover no-repeat;
    position: relative;
}
.mode-card-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.05) 35%, rgba(0,0,0,.85) 100%);
}
.mode-card-body {
    padding: 16px;
    display: grid;
    gap: 6px;
}
.mode-card-title {
    font-size: 18px;
    font-weight: 800;
}
.mode-card-meta {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}
.content-empty-state {
    display: grid;
    gap: 7px;
    min-height: 112px;
    align-content: center;
    justify-items: center;
    padding: 18px 4px;
    color: var(--muted);
    text-align: center;
}
.content-empty-state strong {
    color: #ededed;
    font-size: 16px;
}
.content-empty-state p {
    margin: 0;
    color: #7f7f7f;
    font-size: 13px;
    line-height: 1.5;
}
.empty-state-art {
    display: block;
    width: min(48vw, 190px);
    height: auto;
    margin: 0 auto 3px;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 16px 30px rgba(0, 0, 0, .3));
}
.empty-state-art-content { width: min(50vw, 200px); }
.empty-state-art-search { width: min(48vw, 184px); }
.persona-empty-art { width: min(48vw, 190px); margin-bottom: 8px; }
.my-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.my-page-shell {
    max-width: 980px;
}
.my-topbar {
    gap: 18px;
}
.my-topbar-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
}
.my-topbar-actions > * {
    white-space: nowrap;
}
.my-page-body {
    gap: 32px;
}
.my-page-body .form-card {
    min-width: 0;
}
.my-page-body .mini-copy {
    min-width: 0;
}
.my-page-body .mini-copy strong,
.my-page-body .mini-copy span {
    overflow-wrap: anywhere;
}
.mini-list {
    display: grid;
    gap: 10px;
}
.mini-row {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border-radius: 16px;
    background: #1a1a1a;
    border: 1px solid #2d2d2d;
}
.mini-thumb {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2b2b2b, #161616) center/cover no-repeat;
}
.mini-copy {
    display: grid;
    gap: 4px;
}
.mini-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mini-title-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-copy .character-progress { color: #dcb866; }
.mini-copy strong {
    font-size: 14px;
}
.mini-copy span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}
.home-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
}
.home-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.72);
}
.home-modal-panel {
    position: relative;
    width: min(92vw, 520px);
    padding: 18px;
    border: 1px solid #303030;
    border-radius: 24px;
    background: linear-gradient(160deg, #191919, #101010);
    display: grid;
    gap: 16px;
    box-shadow: 0 20px 80px rgba(0,0,0,.55);
}
.home-modal-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.creation-card {
    overflow: hidden;
    border: 1px solid #303030;
    border-radius: 20px;
    background: #171717;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.creation-card:hover,
.creation-card:focus-visible {
    border-color: rgba(57, 224, 160, .5);
    outline: none;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .32);
}
.creation-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.creation-thumb {
    height: 176px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 42%, rgba(57, 224, 160, .11), transparent 54%),
        #101312;
}
.creation-thumb img {
    width: 92%;
    height: 92%;
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .34));
}
.creation-body {
    padding: 13px 14px 15px;
}
.creation-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 6px;
}
.creation-meta {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}
.detail-shell {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    background: #050505;
}
.detail-hero {
    position: relative;
}
.detail-hero-image {
    width: 100%;
    height: 440px;
    object-fit: cover;
    display: block;
}
.detail-hero-body {
    padding: 18px 12px 24px;
    background: #050505;
}
.detail-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.detail-name {
    margin: 0;
    font-size: 28px;
    font-weight: 900;
}
.detail-summary {
    color: #cfcfcf;
    margin: 8px 0 0;
    line-height: 1.6;
}
.detail-section {
    padding: 0 12px 20px;
}
.detail-panel {
    padding: 16px;
    border-radius: 20px;
    background: #161616;
    border: 1px solid #2a2a2a;
}
.detail-intro-panel { background: #080808; }
.detail-intro-feed {
    display: grid;
    gap: 18px;
    padding: 8px 0 2px;
}
.detail-intro-feed .bubble-wrap.user { flex-direction: row-reverse; }
.detail-intro-feed .intro-narration-message { padding-inline: 18px; }
.detail-intro-feed .chat-image { max-width: 100%; }
.detail-character-list {
    display: grid;
    gap: 10px;
}
.detail-character-row {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 16px;
    background: #1d1d1d;
    border: 1px solid #2d2d2d;
}
.detail-character-thumb {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #282828 center/cover no-repeat;
}
.detail-character-copy strong {
    display: block;
    margin-bottom: 4px;
}
.detail-character-copy span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}
.detail-character-copy { min-width: 0; }
.detail-character-description-toggle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}
.detail-character-description-toggle > summary {
    display: grid;
    gap: 6px;
    min-width: 0;
    cursor: pointer;
    list-style: none;
    border-radius: 8px;
}
.detail-character-description-toggle > summary::-webkit-details-marker { display: none; }
.detail-character-description-toggle > summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
.detail-character-description-preview {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.5 !important;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.detail-character-description-action {
    color: var(--accent) !important;
    font-size: 11px !important;
    font-weight: 750;
}
.detail-character-description-action::before { content: "더보기 ＋"; }
.detail-character-description-toggle[open] .detail-character-description-action::before { content: "접기 －"; }
.detail-character-description-toggle[open] .detail-character-description-preview { display: none; }
.detail-character-description-full {
    margin: 8px 0 0;
    color: #b0b0b0;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.detail-character-description-short {
    display: block;
    overflow-wrap: anywhere;
}
.detail-action-bar {
    position: sticky;
    bottom: 0;
    padding: 14px 12px 20px;
    background: linear-gradient(180deg, rgba(5,5,5,0) 0%, rgba(5,5,5,.95) 35%);
}

.wizard-hidden { display: none !important; }
.wizard-form { min-height: 100vh; }
.character-step-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 16px;
    display: grid;
    gap: 14px;
}
.character-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.character-image-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 12px;
    align-items: stretch;
}
.character-image-preview {
    min-height: 230px;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}
.file-trigger {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 54px;
}
.asset-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
}
.asset-preview {
    overflow: hidden;
    background-size: cover;
    background-position: center;
    min-height: 220px;
    text-align: center;
    padding: 18px;
}
.asset-preview.has-image {
    border-style: solid;
    color: transparent;
}
.modal-shell {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 30;
}
.modal-panel {
    width: 100%;
    max-width: 430px;
    max-height: 100vh;
    overflow: auto;
    background: #0b0b0b;
    border: 1px solid var(--line);
}
.loading-panel {
    min-height: 280px;
    border-radius: 18px;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    display: grid;
    place-items: center;
    color: var(--accent);
    font-size: 18px;
}
.result-image {
    width: 100%;
    border-radius: 18px;
    background: #111;
    border: 1px solid var(--line);
}

.required-mark { color: #ff6262; }
.scenario-setup-btn, .scenario-add-btn {
    width: 100%;
    min-height: 48px;
    border: 1px solid #484848;
    border-radius: 12px;
    background: #1b1b1b;
    color: #f4f4f4;
    font-weight: 700;
    cursor: pointer;
}
.scenario-add-btn {
    border: 0;
    background: #292929;
}
.scenario-section-heading { margin-top: 2px; }
.scenario-section-heading .hint, [data-step="3"] .hint { margin: 4px 0 0; }
.scenario-list { display: grid; gap: 10px; }
.scenario-list-card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #292929;
}
.scenario-list-title {
    overflow: hidden;
    color: #fff;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.scenario-list-meta { margin-top: 4px; color: #929292; font-size: 11px; }
.scenario-list-actions { display: flex; gap: 4px; }
.scenario-mini-btn {
    border: 0;
    padding: 7px;
    background: transparent;
    color: #aaa;
    cursor: pointer;
}
.scenario-editor-shell {
    position: fixed;
    inset: 0;
    min-width: 0;
    max-width: 100%;
    z-index: 50;
    background: rgba(0, 0, 0, .82);
}
.scenario-editor-panel,
.scenario-editor-topbar,
.scenario-editor-body,
.scenario-composer {
    min-width: 0;
    max-width: 100%;
}
.scenario-editor-panel {
    width: 100%;
    max-width: 430px;
    height: 100dvh;
    margin: 0 auto;
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    background: #090909;
    border-left: 1px solid #252525;
    border-right: 1px solid #252525;
}
.scenario-editor-topbar {
    width: 100%;
    min-height: 74px;
    padding: 14px 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    align-items: center;
    border-bottom: 1px solid #282828;
}
.scenario-editor-heading {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.scenario-editor-topbar strong {
    min-width: 0;
    overflow: hidden;
    font-size: 18px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.scenario-back-btn, .scenario-done-btn {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
}
.scenario-back-btn {
    display: grid;
    place-items: center;
    background: transparent;
}
.scenario-back-btn .back-nav-icon { width: 11px; height: 11px; }
.scenario-done-btn { justify-self: end; background: var(--accent); color: #063d29; font-size: 20px; font-weight: 900; }
.scenario-editor-body {
    width: 100%;
    overflow-y: auto;
    padding: 18px 12px 28px;
}
.scenario-meta-fields { margin-bottom: 18px; }
.textarea.compact { min-height: 88px; }
.scenario-chat-preview {
    min-height: 260px;
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 10px 0 40px;
}
.scenario-empty {
    place-self: center;
    max-width: 280px;
    color: #777;
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}
.scenario-preview-row { display: flex; gap: 8px; align-items: flex-start; }
.scenario-preview-row.user { justify-content: flex-end; }
.scenario-preview-row.narrator { display: block; width: 100%; text-align: center; }
.scenario-preview-row.narrator .scenario-preview-content {
    width: min(92%, 520px);
    max-width: none;
    margin-inline: auto;
    text-align: center;
}
.scenario-preview-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #2b2b2b center/cover no-repeat;
    display: grid;
    place-items: center;
    color: #ddd;
    font-size: 11px;
}
.scenario-preview-content { max-width: 76%; }
.scenario-preview-name { margin: 0 0 5px 2px; color: #aaa; font-size: 11px; }
.scenario-preview-bubble {
    padding: 11px 13px;
    border-radius: 16px;
    background: #232323;
    color: #eee;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
}
.scenario-preview-row.user .scenario-preview-bubble { background: #292929; }

.state-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.state-list {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.state-card {
    padding: 14px;
    border: 1px solid #3b3b3b;
    border-radius: 18px;
    background: #171717;
    display: grid;
    gap: 12px;
}

.state-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.state-card-title {
    font-size: 15px;
    font-weight: 800;
    color: #f5f5f5;
}

.state-card-subtitle {
    margin-top: 4px;
    color: #919191;
    font-size: 12px;
    line-height: 1.45;
}

.state-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.state-icon-preview {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: linear-gradient(180deg, #202020 0%, #151515 100%);
    border: 1px solid #313131;
    display: grid;
    place-items: center;
    color: var(--accent);
}

.state-icon-preview svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.state-icon-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.state-icon-hint {
    padding: 10px 12px;
    min-width: 72px;
    border-radius: 12px;
    background: #222;
    color: #d9d9d9;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
}

.state-range-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.state-range-box {
    display: grid;
    gap: 8px;
}

.state-range-box span {
    color: #a7a7a7;
    font-size: 12px;
}

.state-range-box input {
    width: 100%;
    min-height: 46px;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    background: #1b1b1b;
    color: #fff;
    padding: 12px 12px;
    font-size: 14px;
}

.state-desc {
    min-height: 96px;
}

.state-desc-tips {
    color: #8f8f8f;
    font-size: 12px;
    line-height: 1.55;
    display: grid;
    gap: 3px;
}

.state-icon-btn {
    width: 34px;
    height: 34px;
    border: 1px solid #404040;
    border-radius: 10px;
    background: #222;
    color: #d4d4d4;
    cursor: pointer;
}

.state-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.policy-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(57, 224, 160, 0.12);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.scenario-preview-row.narrator .scenario-preview-bubble {
    display: block;
    padding: 0;
    background: transparent;
    color: #858585;
    font-size: 12px;
    text-align: center;
    overflow-wrap: anywhere;
}
.scenario-preview-controls { display: flex; justify-content: flex-end; gap: 2px; margin-top: 3px; }
.scenario-preview-row.narrator .scenario-preview-controls { justify-content: center; }
.scenario-composer {
    width: 100%;
    overflow: hidden;
    padding: 10px 12px max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid #2b2b2b;
    background: rgba(12, 12, 12, .98);
}
.scenario-speakers { display: flex; gap: 7px; margin-bottom: 10px; overflow-x: auto; }
.speaker-chip {
    flex: 0 0 auto;
    border: 1px solid #363636;
    border-radius: 999px;
    padding: 7px 12px;
    background: #202020;
    color: #888;
    cursor: pointer;
}
.speaker-chip.active { border-color: #666; color: #fff; }
.scenario-composer textarea {
    width: 100%;
    min-height: 70px;
    max-height: 150px;
    padding: 12px;
    border: 0;
    outline: 0;
    resize: vertical;
    background: transparent;
    color: #eee;
    font: inherit;
}
.scenario-compose-actions { display: flex; align-items: center; gap: 8px; }
.token-insert-btn {
    border: 0;
    border-radius: 999px;
    padding: 7px 11px;
    background: #252525;
    color: #aaa;
    cursor: pointer;
}
.scenario-block-counter { margin-left: auto; color: #666; font-size: 10px; }
.scenario-send-btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 17px;
    cursor: pointer;
}
.policy-chip {
    display: inline-flex;
    margin-left: 5px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(57, 224, 160, .1);
    color: var(--accent);
    font-size: 10px;
    font-weight: 500;
}
.lorebook-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}
.lorebook-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.lorebook-entry-list {
    display: grid;
    gap: 12px;
}
.lorebook-list {
    display: grid;
    gap: 10px;
}
.lorebook-list-card {
    min-height: 66px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    border: 1px solid #2f2f2f;
    border-radius: 14px;
    background: #1c1c1c;
    overflow: hidden;
}
.lorebook-list-open {
    min-width: 0;
    display: grid;
    gap: 5px;
    padding: 16px;
    border: 0;
    background: transparent;
    color: #fff;
    text-align: left;
    cursor: pointer;
}
.lorebook-list-open strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
}
.lorebook-list-open span {
    color: #8f8f8f;
    font-size: 12px;
}
.lorebook-list-remove { margin-right: 8px; font-size: 18px; }
.lorebook-editor-panel { grid-template-rows: auto 1fr; }
.lorebook-editor-body { padding-bottom: 44px; }
.lorebook-detail-fields {
    margin-bottom: 22px;
    padding: 14px;
    border: 1px solid #2c2c2c;
    border-radius: 16px;
    background: #141414;
}
.lorebook-entry-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 18px;
    background: #181818;
    border: 1px solid #2d2d2d;
}
.lorebook-entry-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.lorebook-entry-title {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}
.lorebook-entry-toggle {
    flex: 1;
    padding: 8px 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.lorebook-entry-card:not(.expanded) {
    padding-top: 10px;
    padding-bottom: 10px;
}
.lorebook-field-hint {
    margin: -5px 0 0;
}
.lorebook-entry-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.lorebook-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #b7b7b7;
    font-size: 12px;
    user-select: none;
}
.lorebook-toggle input {
    accent-color: var(--accent);
}
.lorebook-empty-card {
    display: grid;
    gap: 6px;
    padding: 16px;
    border-radius: 18px;
    border: 1px dashed #343434;
    background: #141414;
    color: #a6a6a6;
}
.lorebook-empty-card strong {
    color: #f1f1f1;
    font-size: 14px;
}
.lorebook-keyword-trigger {
    min-height: 48px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    padding: 9px 11px;
    border: 1px solid #363636;
    border-radius: 13px;
    background: #111;
    cursor: pointer;
}
.lorebook-keyword-trigger:focus {
    outline: 1px solid var(--accent);
    border-color: var(--accent);
}
.lorebook-keyword-placeholder {
    color: #777;
    font-size: 13px;
}
.lorebook-keyword-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 7px 9px 7px 11px;
    border: 1px solid rgba(57, 224, 160, .55);
    border-radius: 999px;
    background: rgba(57, 224, 160, .12);
    color: var(--accent);
    font-size: 12px;
    line-height: 1;
}
.lorebook-keyword-chip > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lorebook-keyword-chip button {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(57, 224, 160, .18);
    color: var(--accent);
    font-size: 15px;
    line-height: 16px;
    cursor: pointer;
}
.lorebook-keyword-sheet-tags {
    min-height: 54px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid #333;
    border-radius: 14px;
    background: #171717;
}
.lorebook-keyword-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 8px;
}
.appearance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.appearance-card {
    position: relative;
    min-height: 230px;
    overflow: hidden;
    border-radius: 14px;
    background: #171717 center/cover no-repeat;
    border: 1px solid #252525;
}
.appearance-card::after {
    content: "";
    position: absolute;
    inset: 35% 0 0;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,.88));
    pointer-events: none;
}
.appearance-card-top {
    position: absolute;
    z-index: 2;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
}
.appearance-badge {
    border: 0;
    border-radius: 999px;
    padding: 5px 7px;
    background: rgba(30,30,30,.76);
    color: #aaa;
    font-size: 9px;
}
button.appearance-badge { cursor: pointer; }
.appearance-card-bottom {
    position: absolute;
    z-index: 2;
    left: 8px;
    right: 8px;
    bottom: 8px;
}
.appearance-label-button {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 11px;
    border: 0;
    border-radius: 12px;
    background: rgba(40,40,40,.86);
    color: #eee;
    text-align: left;
    cursor: pointer;
}
.appearance-label-button span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.appearance-add-card {
    min-height: 230px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    border: 1px dashed #373737;
    border-radius: 14px;
    color: #828282;
    font-size: 11px;
}
.appearance-add-card:only-child { grid-column: 1 / -1; min-height: 125px; }
.appearance-add-card.dragging { border-color: var(--accent); color: var(--accent); }
.appearance-empty-icon { font-size: 24px; color: #ddd; }
.appearance-upload-trigger { min-height: 44px; }
.reference-note {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: #161616;
    color: #aaa;
    font-size: 12px;
}
.reference-thumb {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: #222 center/cover no-repeat;
}
.bottom-sheet-shell {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}
.bottom-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.68);
}
.bottom-sheet-panel {
    position: relative;
    width: min(100%, 430px);
    max-height: 80dvh;
    overflow-y: auto;
    padding: 8px 16px max(18px, env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    background: #202020;
}
.bottom-sheet-handle {
    width: 38px;
    height: 4px;
    margin: 0 auto 18px;
    border-radius: 999px;
    background: #747474;
}
.bottom-sheet-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.appearance-tag-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.appearance-tag-chip {
    padding: 9px 12px;
    border: 1px solid #333;
    border-radius: 999px;
    background: #242424;
    color: #999;
    cursor: pointer;
}
.appearance-tag-chip.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(57,224,160,.08);
}
.appearance-custom-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-bottom: 8px;
}

/* 2026-08-20 client update: account personas, room entry, model and runtime controls */
body.modal-open { overflow: hidden; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .72);
}
.modal-panel { position: relative; }
.text-button {
    border: 0;
    padding: 6px;
    background: transparent;
    color: #aaa;
    cursor: pointer;
}
.danger-btn {
    min-height: 46px;
    border: 1px solid rgba(255, 98, 98, .5);
    border-radius: 12px;
    background: rgba(255, 98, 98, .08);
    color: #ff8c8c;
    font-weight: 700;
    cursor: pointer;
}
.error-text { color: #ff8c8c !important; }
.textarea.compact { min-height: 86px; }

.persona-page { min-height: 100dvh; }
.persona-page-intro {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 17px;
    border: 1px solid rgba(57, 224, 160, .13);
    border-radius: 19px;
    background: linear-gradient(135deg, rgba(57, 224, 160, .085), rgba(24, 24, 24, .82) 62%);
}
.persona-page-intro strong { color: #f0f0f0; font-size: 15px; }
.persona-page-intro p, .persona-empty p { margin: 5px 0 0; color: #8d9692; font-size: 12px; line-height: 1.55; }
.persona-intro-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(57, 224, 160, .22);
    border-radius: 15px;
    background: rgba(57, 224, 160, .09);
}
.persona-intro-icon::before,
.persona-intro-icon span {
    content: "";
    display: block;
    border: 1.7px solid var(--accent);
}
.persona-intro-icon::before { width: 10px; height: 10px; border-radius: 50%; }
.persona-intro-icon span { width: 20px; height: 10px; margin-top: -8px; border-radius: 12px 12px 5px 5px; }
.persona-count { min-height: 18px; padding-inline: 2px; color: #7f8985; font-size: 12px; }
.persona-empty { padding: 24px 10px 18px; text-align: center; }
.persona-empty strong { color: #d7d7d7; font-size: 14px; }
.persona-grid { display: grid; gap: 10px; }
.persona-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid #292929;
    border-radius: 19px;
    background: linear-gradient(145deg, #181818, #131313);
    transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.persona-card:hover { border-color: #3a3a3a; background: linear-gradient(145deg, #1b1b1b, #151515); transform: translateY(-1px); }
.persona-card-avatar, .persona-choice-avatar, .persona-profile-preview {
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: 0 0 auto;
    background: linear-gradient(135deg, #393939, #171717) center/cover no-repeat;
    color: var(--accent);
    font-size: 21px;
    font-weight: 800;
}
.persona-card-avatar { width: 58px; height: 58px; border: 1px solid rgba(255,255,255,.08); border-radius: 17px; }
.persona-card-avatar.large { width: 74px; height: 74px; border-radius: 20px; }
.persona-card-copy { min-width: 0; }
.persona-card-copy .persona-default-badge { display: inline-block; margin-right: 6px; padding: 2px 6px; border-radius: 8px; background: #1b5544; color: #32d8a2; font-size: 11px; font-style: normal; }
.persona-card-copy strong { display: block; margin-bottom: 5px; color: #f1f1f1; font-size: 15px; }
.persona-card-copy p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: #8e8e8e;
    font-size: 12px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.persona-card-edit {
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid #323232;
    border-radius: 11px;
    background: #202020;
    color: #cfcfcf;
    font-family: var(--font-family-primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.persona-card-edit:hover,
.persona-card-edit:focus-visible { border-color: rgba(57,224,160,.42); color: var(--accent); outline: none; }
.persona-add-button {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 9px;
    align-items: center;
    gap: 13px;
    min-height: 78px;
    padding: 13px 15px;
    border: 1px solid #292929;
    border-radius: 19px;
    background: #111;
    color: #ededed;
    font-family: var(--font-family-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.persona-add-button:hover,
.persona-add-button:focus-visible { border-color: rgba(57,224,160,.48); background: rgba(57,224,160,.055); outline: none; transform: translateY(-1px); }
.persona-add-button:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.persona-add-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(57,224,160,.12);
    color: var(--accent);
    font-size: 25px;
    font-weight: 350;
}
.persona-add-copy { display: grid; min-width: 0; gap: 4px; }
.persona-add-copy strong { font-size: 14px; }
.persona-add-copy small { overflow: hidden; color: #777; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.persona-add-arrow {
    width: 8px;
    height: 8px;
    border-top: 1px solid #737373;
    border-right: 1px solid #737373;
    transform: rotate(45deg);
}
.persona-editor-panel, .persona-room-panel {
    max-height: min(92dvh, 820px);
    border-radius: 22px 22px 0 0;
}
@media (min-width: 721px) {
    .persona-room-panel { width: min(760px, calc(100vw - 48px)); border-radius: 18px; }
    .persona-room-panel .page-body { max-height: min(68dvh, 560px); overflow: auto; }
}
.persona-editor-panel { border-color: #343434; background: #0e0e0e; box-shadow: 0 -24px 70px rgba(0,0,0,.5); }
.persona-profile-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid #292929;
    background: linear-gradient(145deg, #181818, #131313);
}
.persona-profile-picker.compact { padding: 10px; }
.persona-profile-preview { width: 86px; height: 86px; border-radius: 24px; }
.persona-profile-picker.compact .persona-profile-preview { width: 66px; height: 66px; border-radius: 18px; }

.persona-room-options { display: grid; gap: 9px; }
.persona-option-group { display: grid; gap: 8px; }
.persona-option-group + .persona-option-group { margin-top: 12px; }
.persona-option-group h3 { margin: 0; color: #b8b8b8; font-size: 12px; font-weight: 700; }
.persona-choice-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px;
    border: 1px solid #303030;
    border-radius: 16px;
    background: #181818;
    color: #eee;
    text-align: left;
    cursor: pointer;
}
.persona-choice-card:hover { border-color: #4e4e4e; background: #202020; }
.persona-choice-avatar { width: 54px; height: 54px; border-radius: 16px; }
.persona-choice-avatar.ephemeral { border: 1px dashed #686868; background: #202020; }
.persona-choice-copy { display: grid; min-width: 0; gap: 3px; }
.persona-choice-copy strong, .persona-choice-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.persona-choice-copy small { color: #999; }
.persona-source-badge {
    width: max-content;
    margin-top: 3px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(57, 224, 160, .1);
    color: var(--accent);
    font-size: 10px;
}
.persona-stage-shell .modal-backdrop { background: rgba(7, 10, 9, .84); }
.persona-stage-panel { width: min(760px, calc(100vw - 48px)); max-width: min(760px, calc(100vw - 48px)); max-height: min(88dvh, 650px); border-radius: 12px; background: #151817; }
.persona-stage-heading { display: flex; align-items: center; justify-content: center; min-height: 46px; border-bottom: 1px solid #242827; }
.persona-stage-heading h2 { margin: 0; font-size: 14px; color: #f1f1f1; }
.persona-stage-heading .icon-btn { position: absolute; right: 14px; }
.persona-stage-content { display: grid; grid-template-columns: minmax(0, 1fr) 225px; gap: 12px; padding: 18px 20px 14px; }
.persona-stage-content > .hint { grid-column: 1 / -1; min-height: 16px; margin: 0; text-align: center; }
.persona-stage-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-height: 288px; }
.persona-stage-card { position: relative; min-height: 288px; overflow: hidden; border-radius: 8px; background-color: #292e2b; background-position: center; background-size: cover; box-shadow: inset 0 -130px 90px rgba(0,0,0,.76); }
.persona-stage-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 38%, rgba(8,10,9,.86)); }
.persona-stage-card > * { position: relative; z-index: 1; }.persona-stage-card__select { position: absolute!important; inset: 0; display: flex; align-items: flex-end; width: 100%; border: 0; border-radius: 0; background: transparent; }
.persona-stage-card .persona-choice-avatar { display: none; }.persona-stage-card .persona-choice-copy { width: 100%; gap: 5px; }
.persona-stage-card .persona-choice-copy strong { font-size: 15px; }
.persona-stage-card .persona-choice-copy small { white-space: normal; line-height: 1.35; }
.persona-stage-card .persona-choice-edit { position: absolute; left: 11px; bottom: 11px; width: max-content; margin-top: 7px; border: 0; border-radius: 8px; background: rgba(22,24,23,.84); color: #eee; padding: 7px 10px; }.persona-stage-card__select .persona-choice-copy { padding-bottom: 48px; }
.persona-stage-dots { display: flex; grid-column: 1; justify-content: center; gap: 5px; }
.persona-stage-dots span { width: 5px; height: 5px; border-radius: 50%; background: #6b716e; }.persona-stage-dots .active { background: #f3f3f3; }
.persona-account-panel { grid-column: 2; grid-row: 2 / span 2; display: grid; align-content: start; gap: 8px; padding: 12px; border-radius: 8px; background: #2a2e2c; }
.persona-account-panel h3 { margin: 0 0 2px; font-size: 12px; }.persona-account-options { display: grid; gap: 7px; max-height: 230px; overflow: auto; }
.persona-account-options .persona-choice-card { gap: 7px; padding: 7px; border-radius: 8px; background: #313634; }.persona-account-options .persona-choice-avatar { width: 26px; height: 26px; border-radius: 50%; font-size: 11px; }.persona-account-options .persona-choice-copy { gap: 1px; }.persona-account-options .persona-choice-copy strong { font-size: 11px; }.persona-account-options .persona-choice-copy small { font-size: 10px; }.persona-account-options .persona-source-badge { display: none; }
.persona-account-add { border: 0; border-radius: 8px; background: #505351; color: #f2f2f2; padding: 10px; font-size: 11px; }.persona-account-add span { color: #bbb; }
@media (max-width: 720px) { .persona-stage-panel { width: 100%; border-radius: 18px 18px 0 0; }.persona-stage-content { grid-template-columns: 1fr; padding: 15px; }.persona-stage-options { grid-template-columns: 1fr; }.persona-account-panel { grid-column: 1; grid-row: auto; }.persona-stage-card { min-height: 180px; } }
.room-persona-current { margin: 12px 0; padding: 11px 12px; border: 1px solid rgba(57,224,160,.4); border-radius: 10px; color: #e8e8e8; font-size: 13px; }
.room-persona-accounts { display: grid; max-height: 260px; gap: 7px; overflow: auto; }
.room-persona-accounts .persona-choice-card { min-height: 44px; padding: 10px 12px; }
.panel__row-meta { overflow: hidden; margin-left: auto; color: #aaa; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.chat-room-topbar {
    position: relative;
    z-index: 10;
    overflow: visible;
    min-height: 72px;
    gap: 10px;
    padding: 12px 14px;
}
.chat-room-topbar .topbar-title-group {
    flex: 1 1 94px;
    min-width: 0;
}
.chat-room-topbar .back-nav {
    gap: 8px;
    padding-right: 5px;
    font-size: 18px;
}
.chat-topbar-actions {
    flex: 0 1 226px;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    overflow: visible;
}
.model-select-wrap {
    position: relative;
    flex: 1 1 142px;
    min-width: 0;
    max-width: 152px;
}
.model-select-button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #383838;
    border-radius: 14px;
    padding: 7px 9px;
    background: #171717;
    color: #eee;
    cursor: pointer;
}
.model-selection-modal {
    position: fixed;
    z-index: 80;
    align-items: center;
    padding: 16px;
}
.model-selection-modal .modal-backdrop {
    background: rgba(0, 0, 0, .8);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}
.model-selection-panel {
    width: min(720px, 100%);
    max-width: none;
    max-height: min(86dvh, 820px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px;
    border: 1px solid #3a3a3a;
    border-radius: 22px;
    background: #151515;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .65);
}
.model-selection-heading {
    position: sticky;
    top: -18px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: -18px -18px 0;
    padding: 18px;
    border-bottom: 1px solid #303030;
    background: rgba(21, 21, 21, .96);
}
.model-selection-heading strong { color: #f3f3f3; font-size: 17px; }
.model-selection-heading p { margin: 5px 0 0; color: #8b8b8b; font-size: 11px; }
.model-selection-status {
    min-height: 0;
    margin: 0;
    padding: 12px 2px 10px;
    font-size: 11px;
}
.model-selection-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.model-role-section {
    display: grid;
    gap: 9px;
    padding: 14px;
    border: 1px solid #303030;
    border-radius: 16px;
    background: #1b1b1b;
}
.model-role-heading {
    display: grid;
    gap: 2px;
}
.model-role-heading strong { color: #f1f1f1; font-size: 13px; }
.model-role-heading span { color: #858585; font-size: 10px; }
.model-role-select {
    width: 100%;
    min-height: 42px;
    border: 1px solid #3a3a3a;
    border-radius: 11px;
    padding: 9px 34px 9px 11px;
    background: #111;
    color: #f0f0f0;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.model-role-select:focus {
    border-color: var(--accent);
    outline: 2px solid rgba(57, 224, 160, .16);
    outline-offset: 1px;
}
.model-role-select:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 620px) {
    .model-selection-modal { align-items: flex-end; padding: 8px; }
    .model-selection-panel { max-height: 90dvh; border-radius: 20px; }
    .model-selection-sections { grid-template-columns: 1fr; }
}
#current-model-label {
    min-width: 0;
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.model-provider-mark {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #303030;
    color: var(--accent);
    font-size: 9px;
    font-weight: 800;
}
.chat-restart-button {
    flex: 0 0 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid #353535;
    border-radius: 14px;
    padding: 8px 10px;
    background: #202020;
    color: #f3f3f3;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}
.chat-restart-icon {
    color: var(--accent);
    font-family: Arial, sans-serif;
    font-size: 19px;
    font-weight: 500;
    line-height: 1;
}
.chat-restart-button:hover,
.chat-restart-button:focus-visible {
    border-color: rgba(57, 224, 160, .55);
    background: rgba(57, 224, 160, .08);
    outline: none;
}
.model-provider-mark.claude { background: #583628; color: #ffd2bd; }
.model-provider-mark.gpt { background: #174437; color: #9cf4d2; }
.model-provider-mark.xai { background: #303030; color: #f4f4f4; }
.chat-quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
}
.chat-action-button,
.chat-runtime-button {
    width: max-content;
    max-width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 5px 10px;
    font-family: var(--font-family-primary);
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}
.chat-action-button {
    border: 1px solid #303030;
    background: #1b1b1b;
    color: #858585;
}
.chat-runtime-button {
    border: 1px solid var(--accent);
    background: #101010;
    color: #a9a9a9;
}
.chat-action-button:hover,
.chat-action-button:focus-visible,
.chat-runtime-button:hover,
.chat-runtime-button:focus-visible {
    background: rgba(57, 224, 160, .06);
    color: #fff;
    outline: none;
}
.asterisk-action-icon {
    color: #8b8b8b;
    font-size: 19px;
    line-height: 14px;
}
.runtime-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.5px;
    padding: 2px 2px 3px;
    border-bottom: 1.25px solid currentColor;
    color: #8d8d8d;
}
.runtime-icon i {
    width: 2.5px;
    border: 1.25px solid currentColor;
    border-bottom: 0;
    border-radius: 2px 2px 0 0;
}
.runtime-icon i:nth-child(1) { height: 6px; }
.runtime-icon i:nth-child(2) { height: 9px; }
.runtime-icon i:nth-child(3) { height: 12px; }
.runtime-change-badge {
    min-width: auto;
    padding: 0;
    background: transparent;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}
.send-btn:disabled,
.chat-action-button:disabled,
.message-input:disabled {
    cursor: not-allowed;
}
.send-btn:disabled {
    opacity: .45;
    transform: none;
    box-shadow: none;
}
.message-input:disabled { color: #8f8f8f; }
.composer-row.turn-pending .message-input-wrap {
    border-color: rgba(57, 224, 160, .24);
}

#chat-runtime-modal .bottom-sheet-backdrop {
    background: rgba(0,0,0,.78);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    animation: runtime-backdrop-in .18s ease-out both;
}
#chat-runtime-modal {
    left: var(--rail-w);
    right: var(--panel-w);
}
#chat-runtime-modal .status-dashboard-panel {
    width: min(620px, calc(100vw - var(--rail-w) - var(--panel-w) - 48px));
    max-height: min(58dvh, 420px);
    margin-bottom: 100px;
    padding: 20px 34px 18px;
    border: 1px solid #3a3a3a;
    border-radius: 18px;
    background: #181a1a;
    box-shadow: 0 -18px 52px rgba(0, 0, 0, .32);
    transform-origin: bottom center;
    animation: runtime-sheet-in .28s cubic-bezier(.22, .82, .24, 1) both;
    scrollbar-width: none;
}
#chat-runtime-modal .status-dashboard-panel::-webkit-scrollbar { display: none; }
#chat-runtime-modal .bottom-sheet-heading {
    margin-bottom: 18px;
}
#chat-runtime-modal .dialog__title {
    font-size: 17px;
}
.status-dashboard-close {
    width: 32px;
    height: 32px;
    margin: -5px -6px 0 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #9a9a9a;
    font-size: 28px;
    font-weight: 200;
    line-height: 1;
    cursor: pointer;
}
.status-dashboard-close:hover,
.status-dashboard-close:focus-visible { color: #fff; background: #292b2b; outline: none; }
@keyframes runtime-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes runtime-sheet-in {
    from {
        opacity: .94;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@media (prefers-reduced-motion: reduce) {
    #chat-runtime-modal .bottom-sheet-backdrop,
    #chat-runtime-modal .status-dashboard-panel {
        animation-duration: 1ms;
    }
}
.runtime-context-grid {
    display: grid;
    gap: 2px;
    margin: 8px 0 20px;
}
.runtime-context-item {
    display: grid;
    grid-template-columns: 22px 42px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 4px 0;
}
.runtime-context-symbol {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    color: #a6a6a6;
}
.runtime-context-symbol svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.runtime-context-key { color: #888; font-size: 12px; }
.runtime-context-item strong {
    color: #f0f0f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
}
.runtime-context-item.runtime-context-situation {
    align-items: start;
    min-height: 48px;
}
.runtime-context-item.runtime-context-situation strong {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    text-overflow: clip;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}
.runtime-section { display: grid; gap: 18px; margin-top: 18px; }
.runtime-section h3 { margin: 0; font-size: 14px; }
.runtime-episode-title {
    display: flex;
    align-items: baseline;
    gap: 7px;
    font-weight: 500;
}
.runtime-episode-title span:first-child { color: var(--accent); }
.runtime-episode-title span:last-child { color: #aaa; }
.runtime-subject-block {
    display: grid;
    gap: 8px;
    padding: 0 0 2px;
}
.runtime-subject-title {
    color: #eee;
    font-size: 14px;
    font-weight: 600;
}
.runtime-state-row {
    display: grid;
    grid-template-columns: 18px 40px minmax(60px, 1fr) 32px;
    align-items: center;
    gap: 7px;
    font-size: 11px;
}
.runtime-state-value {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px;
    white-space: nowrap;
}
.runtime-state-value > strong { text-align: right; }
.runtime-state-delta {
    color: var(--accent);
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
}
.runtime-gauge { height: 7px; overflow: hidden; border-radius: 999px; background: #303030; }
.runtime-gauge > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.runtime-detail-row {
    display: grid;
    grid-template-columns: 18px 40px minmax(0, 1fr);
    align-items: start;
    gap: 7px;
    min-height: 22px;
    color: #ddd;
    font-size: 11px;
}
.runtime-detail-symbol,
.runtime-state-symbol {
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    color: #aaa;
}
.runtime-detail-symbol svg,
.runtime-state-symbol svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.runtime-state-symbol svg {
    fill: currentColor;
    stroke: none;
}
.runtime-state-row .runtime-detail-symbol svg { fill: currentColor; stroke-width: 1.2; }
.runtime-detail-label { color: #888; }
.runtime-detail-value { overflow-wrap: anywhere; line-height: 1.5; }
.runtime-detail-row.accent .runtime-detail-value { color: var(--accent); }

.creator-persona-list, .story-character-editor-list, .story-state-list { display: grid; gap: 10px; }
.creator-persona-card, .story-character-editor-card, .story-state-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid #303030;
    border-radius: 15px;
    background: #171717;
}
.creator-persona-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.creator-persona-profile-row { display: flex; align-items: center; gap: 10px; }
.story-user-persona-profile { padding: 11px; border: 1px solid #2d2d2d; border-radius: 13px; background: #111; }
.story-user-persona-avatar { flex: 0 0 58px; background-color: #242424; background-position: center; background-size: cover; color: var(--accent); }
.story-user-persona-profile-actions { min-width: 0; flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.story-user-persona-profile-actions > div { min-width: 0; }
.story-user-persona-profile-actions strong, .story-user-persona-profile-actions span { display: block; }
.story-user-persona-profile-actions strong { color: #eee; font-size: 12px; }
.story-user-persona-profile-actions span { margin-top: 4px; color: #777; font-size: 10px; line-height: 1.4; }
.story-user-persona-profile-actions .ghost-btn { flex: 0 0 auto; padding: 9px 11px; font-size: 11px; }
.state-range-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.state-range-box {
    display: grid;
    gap: 5px;
    padding: 8px;
    border-radius: 10px;
    background: #222;
    color: #999;
    font-size: 10px;
}
.state-range-box input {
    width: 100%;
    border: 0;
    background: transparent;
    color: #eee;
    font: inherit;
}
.story-state-editor { display: grid; gap: 10px; }
.story-character-editor-list { margin-top: 10px; }

/* MY hub */
.my-page-shell {
    max-width: 980px;
    min-height: 100dvh;
}
.my-page-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(5, 5, 5, .97);
    box-shadow: 0 1px 0 #252525;
    backdrop-filter: blur(16px);
}
.my-page-header .my-topbar,
.my-page-header .my-tabbar {
    position: static;
    background: transparent;
    backdrop-filter: none;
}
.my-tabbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 0 14px;
    border-bottom: 1px solid #252525;
    background: rgba(5, 5, 5, .94);
    backdrop-filter: blur(16px);
}
.my-tab {
    position: relative;
    width: 100%;
    min-width: 0;
    padding: 16px 4px 14px;
    border: 0;
    background: transparent;
    color: #777;
    font-family: var(--font-family-primary);
    font-size: 16px;
    font-weight: 750;
    cursor: pointer;
}
.my-tab::after {
    content: "";
    position: absolute;
    right: 12%;
    bottom: -1px;
    left: 12%;
    height: 2px;
    border-radius: 999px 999px 0 0;
    background: transparent;
}
.my-tab.active { color: #fff; }
.my-tab.active::after { background: var(--accent); }
.my-tab:focus-visible { outline: 2px solid rgba(57, 224, 160, .6); outline-offset: -3px; }
.my-tab-panel { min-width: 0; }
.my-logout-form { margin: 0; }
.my-logout-form .ghost-btn { height: 100%; }
.persona-management { gap: 14px; padding: 0; }
.persona-management-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}
.persona-management-heading h2 { margin: 0; font-size: 22px; }
.my-chat-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}
.my-chat-search {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid #414141;
    border-radius: 13px;
    background: #1b1b1b;
}
.my-chat-search:focus-within {
    border-color: rgba(57, 224, 160, .55);
    box-shadow: 0 0 0 3px rgba(57, 224, 160, .06);
}
.my-search-icon {
    position: relative;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border: 1.5px solid #858585;
    border-radius: 50%;
}
.my-search-icon::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 1.5px;
    right: -5px;
    bottom: -2px;
    border-radius: 999px;
    background: #858585;
    transform: rotate(45deg);
}
.my-chat-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #f2f2f2;
    font: inherit;
}
.my-chat-search input::placeholder { color: #777; }
.my-chat-sort {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 15px;
    border-radius: 13px;
    background: #202020;
    color: #aaa;
    font-size: 13px;
    white-space: nowrap;
}
.my-chat-list { display: grid; }
.my-chat-row {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr) auto 9px;
    align-items: center;
    gap: 14px;
    min-height: 94px;
    padding: 14px 10px;
    border-bottom: 1px solid #171717;
    border-radius: 14px;
    transition: background .16s ease;
}
.my-chat-row:hover,
.my-chat-row:focus-visible { background: #131313; outline: none; }
.my-chat-avatar {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 50%;
    background: linear-gradient(135deg, #2a2a2a, #151515) center/cover no-repeat;
    color: #aaa;
    font-size: 16px;
    font-weight: 750;
}
.my-chat-copy { min-width: 0; display: grid; gap: 7px; }
.my-chat-title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.my-chat-title-line strong {
    overflow: hidden;
    color: #f4f4f4;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.my-chat-mode {
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 999px;
    background: #242424;
    color: #bdbdbd;
    font-size: 10px;
    font-weight: 700;
}
.my-chat-mode.story { color: #bce0d2; background: rgba(57,224,160,.1); }
.my-chat-copy p {
    overflow: hidden;
    margin: 0;
    color: #898989;
    font-size: 13px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.my-chat-time { align-self: start; padding-top: 8px; color: #777; font-size: 11px; white-space: nowrap; }
.my-chat-chevron {
    width: 7px;
    height: 7px;
    border-top: 1px solid #6f6f6f;
    border-right: 1px solid #6f6f6f;
    transform: rotate(45deg);
}
.my-empty-state {
    min-height: 260px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 30px 18px;
    color: #777;
    text-align: center;
}
.my-empty-state strong { color: #e8e8e8; font-size: 17px; }
.my-empty-state p { max-width: 360px; margin: 0 0 8px; font-size: 13px; line-height: 1.55; }
.my-empty-icon {
    width: 52px;
    height: 42px;
    margin-bottom: 4px;
    border: 2px solid #484848;
    border-radius: 16px;
    position: relative;
}
.my-empty-icon::after {
    content: "";
    position: absolute;
    left: 9px;
    bottom: -7px;
    width: 12px;
    height: 12px;
    border-left: 2px solid #484848;
    border-bottom: 2px solid #484848;
    background: #050505;
    transform: skewY(-35deg);
}
.my-work-section + .my-work-section { margin-top: 38px; }
.my-work-carousel {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(250px, 286px);
    gap: 14px;
    overflow-x: auto;
    padding: 2px 2px 12px;
    scroll-snap-type: x proximity;
}

@media (min-width: 721px) and (hover: hover) and (pointer: fine) {
    [data-drag-scroll] {
        cursor: grab;
        scrollbar-width: thin;
        scrollbar-color: #303030 transparent;
    }
    [data-drag-scroll]::-webkit-scrollbar { height: 8px; }
    [data-drag-scroll]::-webkit-scrollbar-track { background: transparent; }
    [data-drag-scroll]::-webkit-scrollbar-thumb {
        border: 2px solid transparent;
        border-radius: 999px;
        background: #303030;
        background-clip: padding-box;
    }
    [data-drag-scroll]::-webkit-scrollbar-thumb:hover { background-color: #424242; }
    [data-drag-scroll].is-dragging {
        cursor: grabbing;
        scroll-snap-type: none;
        scroll-behavior: auto;
        user-select: none;
    }
    [data-drag-scroll].is-dragging * {
        cursor: grabbing !important;
        user-select: none;
    }
}
.my-work-card {
    position: relative;
    overflow: hidden;
    border: 1px solid #303030;
    border-radius: 20px;
    background: #151515;
    scroll-snap-align: start;
    transition: border-color .16s ease, transform .16s ease;
}
.my-work-card:hover,
.my-work-card:focus-visible { border-color: #4a4a4a; outline: none; transform: translateY(-2px); }
.my-work-card-link {
    display: block;
    height: 100%;
    color: inherit;
}
.owned-work-card { position: relative; }
.owned-work-card.menu-open { z-index: 5; border-color: #555; }
.owned-work-menu-trigger {
    position: absolute;
    top: 11px;
    right: 11px;
    z-index: 3;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 12px;
    background: rgba(10,10,10,.78);
    color: #f1f1f1;
    box-shadow: 0 8px 22px rgba(0,0,0,.28);
    backdrop-filter: blur(10px);
}
.owned-work-menu-trigger > span {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
}
.owned-work-menu-trigger:hover,
.owned-work-menu-trigger[aria-expanded="true"] { border-color: rgba(57,224,160,.65); background: rgba(20,24,22,.94); }
.owned-work-menu-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.owned-work-menu-trigger:disabled { cursor: wait; opacity: .6; }
.owned-work-menu {
    position: absolute;
    top: 55px;
    right: 11px;
    z-index: 4;
    width: 142px;
    overflow: hidden;
    padding: 5px;
    border: 1px solid #3d3d3d;
    border-radius: 14px;
    background: rgba(25,25,25,.98);
    box-shadow: 0 18px 46px rgba(0,0,0,.5);
}
.owned-work-menu[hidden] { display: none; }
.owned-work-menu button {
    width: 100%;
    min-height: 39px;
    padding: 9px 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #e8e8e8;
    font-family: var(--font-family-primary);
    font-size: 13px;
    font-weight: 650;
    text-align: left;
}
.owned-work-menu button:hover,
.owned-work-menu button:focus-visible { outline: none; background: #303030; color: #fff; }
.owned-work-menu button.danger { color: #ff9f9f; }
.owned-work-menu button.danger:hover,
.owned-work-menu button.danger:focus-visible { background: rgba(255,94,94,.12); color: #ffc1c1; }
.owned-work-menu button:disabled { cursor: wait; opacity: .55; }
.my-work-cover {
    height: 210px;
    background: linear-gradient(135deg, #292929, #121212) center/cover no-repeat;
}
.my-work-body { display: grid; gap: 8px; padding: 15px; }
.my-work-title-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.my-work-title-line strong { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.my-work-title-line span {
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(255, 190, 84, .12);
    color: #e9bd72;
    font-size: 10px;
}
.my-work-title-line span.inactive { background: rgba(160,160,160,.12); color: #b7b7b7; }
.my-work-body p {
    display: -webkit-box;
    min-height: 38px;
    overflow: hidden;
    margin: 0;
    color: #929292;
    font-size: 13px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.my-work-link { color: var(--accent); font-size: 12px; font-weight: 750; }
.my-work-empty-state { min-height: 270px; }
.owned-page-shell { max-width: 980px; min-height: 100dvh; }
.owned-page-topbar { gap: 18px; }
.owned-create-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}
.owned-page-body { padding-top: 18px; }
.owned-empty-state { min-height: 240px; }
.creator-card-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 8px;
    margin-top: 14px;
}
.creator-card-actions > * {
    min-width: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    font-family: var(--font-family-primary);
    font-weight: 750;
    white-space: nowrap;
}
.creator-complete-action { margin-top: 14px; text-align: center; }
.owned-work-action-status {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 80;
    max-width: min(420px, calc(100vw - 28px));
    padding: 12px 16px;
    border: 1px solid rgba(57,224,160,.4);
    border-radius: 13px;
    background: rgba(24,28,26,.96);
    color: #caffeb;
    box-shadow: 0 16px 40px rgba(0,0,0,.42);
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 10px);
    transition: opacity .16s ease, transform .16s ease;
}
.owned-work-action-status.visible { opacity: 1; transform: translate(-50%, 0); }
.owned-work-action-status.error { border-color: rgba(255,120,120,.45); color: #ffc1c1; }

/* Published content discovery */
.discovery-shell { max-width: 980px; min-height: 100dvh; }
.discovery-topbar { position: relative; z-index: 13; }
.discovery-tabs {
    position: sticky;
    top: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding-inline: 20px;
    border-bottom: 1px solid #252525;
    background: rgba(5, 5, 5, .94);
    backdrop-filter: blur(16px);
}
.discovery-tabs button {
    position: relative;
    min-height: 52px;
    border: 0;
    background: transparent;
    color: #777;
    font-family: var(--font-family-primary);
    font-size: 15px;
    font-weight: 750;
    cursor: pointer;
}
.discovery-tabs button::after {
    content: "";
    position: absolute;
    right: 16%;
    bottom: -1px;
    left: 16%;
    height: 2px;
    border-radius: 999px 999px 0 0;
    background: transparent;
}
.discovery-tabs button.active { color: #f5f5f5; }
.discovery-tabs button.active::after { background: var(--accent); }
.discovery-tabs button:focus-visible { outline: 2px solid rgba(57, 224, 160, .58); outline-offset: -4px; }
.discovery-body { gap: 18px; }
.discovery-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.discovery-search {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 15px;
    border: 1px solid #383838;
    border-radius: 15px;
    background: #181818;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.discovery-search:focus-within {
    border-color: rgba(57, 224, 160, .55);
    box-shadow: 0 0 0 3px rgba(57, 224, 160, .06);
}
.discovery-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #f2f2f2;
    font-family: var(--font-family-primary);
    font-size: 14px;
}
.discovery-search input::placeholder { color: #747474; }
.discovery-result-count { color: #777; font-size: 12px; white-space: nowrap; }
.discovery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.discovery-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #2c2c2c;
    border-radius: 20px;
    background: #151515;
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.discovery-card:hover {
    border-color: #444;
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .26);
}
.discovery-card-image {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: linear-gradient(145deg, #242424, #101010) center/cover no-repeat;
}
.discovery-card-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 54%, rgba(0, 0, 0, .48));
    pointer-events: none;
}
.discovery-type-label {
    position: absolute;
    z-index: 1;
    top: 12px;
    left: 12px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    background: rgba(12, 12, 12, .7);
    color: #ddd;
    font-size: 10px;
    font-weight: 750;
    backdrop-filter: blur(8px);
}
.discovery-card-body { display: grid; gap: 8px; padding: 15px; }
.discovery-card-body h2 {
    overflow: hidden;
    margin: 0;
    color: #f4f4f4;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.discovery-card-body p {
    display: -webkit-box;
    min-height: 39px;
    overflow: hidden;
    margin: 0;
    color: #929292;
    font-size: 13px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.discovery-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 4px;
}
.discovery-card-actions > * {
    min-width: 0;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 9px 10px;
    border-radius: 12px;
    font-family: var(--font-family-primary);
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .desktop-shell {
        padding: 0;
        background: #050505;
    }
    .home-topbar {
        padding: 12px 14px;
        gap: 8px;
    }
    .home-brand {
        flex-basis: min(36vw, 150px);
    }
    .home-brand-logo {
        max-width: 150px;
    }
    .home-topbar-actions {
        gap: 6px;
    }
    .home-topbar-actions .ghost-btn,
    .home-topbar-actions .primary-btn {
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 13px;
    }
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    .character-image-stage {
        grid-template-columns: 1fr;
    }
    .asset-picker {
        grid-template-columns: 1fr;
    }
    .persona-card { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 11px; padding: 12px; }
    .persona-card-avatar { width: 52px; height: 52px; border-radius: 15px; }
    .chat-topbar-actions { max-width: calc(100% - 82px); }
    .model-select-button { min-width: 88px; }
    #current-model-label { max-width: 62px; }
    .chat-restart-button { padding-inline: 9px; }
    .my-topbar {
        align-items: center;
        padding: 12px 14px;
    }
    .my-topbar .title {
        font-size: 23px;
    }
    .my-topbar-actions {
        gap: 6px;
    }
    .my-topbar-actions .ghost-btn,
    .my-topbar-actions .primary-btn {
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 13px;
    }
    .my-page-body {
        padding: 16px 14px 72px;
        gap: 0;
    }
    .my-page-body .section-heading h2 {
        font-size: 22px;
    }
    .my-page-body .form-card {
        padding: 14px;
        border-radius: 18px;
    }
    .my-page-body .section-heading.compact {
        align-items: center;
    }
    .my-page-body .section-heading.compact h3,
    .my-page-body .form-card > h3 {
        margin: 0;
        font-size: 18px;
    }
    .my-page-body .section-heading.compact .ghost-btn {
        padding: 9px 12px;
        font-size: 12px;
        white-space: nowrap;
    }
    .my-tabbar { gap: 0; padding-inline: 8px; }
    .my-tab { min-width: 62px; padding-block: 14px 12px; font-size: 15px; }
    .my-chat-toolbar { grid-template-columns: minmax(0, 1fr) auto; margin-bottom: 8px; }
    .my-chat-sort { padding-inline: 12px; }
    .my-chat-row {
        grid-template-columns: 54px minmax(0, 1fr) auto;
        gap: 11px;
        min-height: 84px;
        padding: 12px 2px;
        border-radius: 0;
    }
    .my-chat-avatar { width: 54px; height: 54px; }
    .my-chat-chevron { display: none; }
    .my-chat-time { padding-top: 5px; font-size: 10px; }
    .my-chat-title-line { gap: 6px; }
    .my-chat-title-line strong { font-size: 15px; }
    .my-chat-copy p { font-size: 12px; }
    .my-work-carousel { grid-auto-columns: minmax(230px, 78vw); margin-inline: -14px; padding-inline: 14px; }
    .my-work-cover { height: 190px; }
    .my-work-section + .my-work-section { margin-top: 32px; }
    .persona-management-heading { align-items: center; }
    .persona-management-heading h2 { font-size: 20px; }
    .persona-page-intro { grid-template-columns: 42px minmax(0, 1fr); gap: 12px; padding: 14px; border-radius: 17px; }
    .persona-intro-icon { width: 42px; height: 42px; border-radius: 13px; }
    .persona-add-button { border-radius: 17px; }
    .home-modal-panel { width: calc(100vw - 24px); padding: 14px; border-radius: 20px; }
    .creation-options { gap: 9px; }
    .creation-thumb { height: 138px; }
    .creation-body { padding: 11px 11px 13px; }
    .creation-title { font-size: 16px; }
    .creation-meta { font-size: 11px; }
    .discovery-topbar { padding: 12px 14px; }
    .discovery-create-button { padding: 10px 12px; font-size: 13px; }
    .discovery-tabs { padding-inline: 8px; }
    .discovery-body { padding: 14px 10px 72px; }
    .discovery-search-row { gap: 8px; margin-bottom: 16px; }
    .discovery-search { min-height: 44px; padding-inline: 13px; }
    .discovery-grid { gap: 9px; }
    .discovery-card { border-radius: 16px; }
    .discovery-card-image { aspect-ratio: 1 / 1; }
    .discovery-type-label { top: 8px; left: 8px; padding: 4px 6px; font-size: 9px; }
    .discovery-card-body { gap: 6px; padding: 11px; }
    .discovery-card-body h2 { font-size: 15px; }
    .discovery-card-body p { min-height: 35px; font-size: 11px; }
    .discovery-card-actions { gap: 6px; }
    .discovery-card-actions > * { min-height: 38px; padding: 8px 5px; border-radius: 10px; font-size: 11px; }
}

@media (max-width: 720px) {
    .auth-shell { padding: 12px; }
    .auth-layout {
        min-height: 0;
        grid-template-columns: minmax(0, 1fr);
        border-radius: 24px;
    }
    .auth-visual { min-height: 285px; padding: 24px; }
    .auth-brand-logo { width: 138px; }
    .auth-visual-copy { max-width: 220px; margin-top: 26px; }
    .auth-visual-copy h1 { margin-block: 9px; font-size: 27px; }
    .auth-visual-copy p { max-width: 205px; font-size: 12px; }
    .auth-character { right: -4px; bottom: -65px; width: 300px; }
    .auth-panel { position: relative; padding: 30px 24px 28px; border-top: 1px solid #202020; }
    .auth-panel-heading { margin-bottom: 24px; }
    .auth-panel-heading h2 { font-size: 27px; }
    .my-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 480px) {
    .auth-shell { padding: 0; }
    .auth-layout { min-height: 100dvh; border: 0; border-radius: 0; }
}

/* Story authoring v2 */
.authoring-topbar {
  min-height: 62px;
  padding-block: 10px;
  z-index: 30;
  background: rgba(8,8,8,.98);
}
.authoring-body { padding-bottom: 104px; }
.wizard-form, .authoring-body { min-width: 0; }
.authoring-step-tabs {
  position: sticky;
  top: 61px;
  z-index: 29;
  margin: 0 -16px 20px;
  padding: 0 16px;
  border-bottom: 1px solid #242424;
  background: rgba(8,8,8,.98);
  backdrop-filter: blur(14px);
  scroll-padding-inline: 16px;
  width: auto;
  max-width: none;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.authoring-step-tabs.is-dragging { cursor: grabbing; user-select: none; scroll-behavior: auto; }
.authoring-step-tabs a { flex: 0 0 auto; min-width: max-content; padding: 14px 4px 12px; }
.authoring-actions {
  position: fixed;
  right: auto;
  bottom: 0;
  left: 50%;
  z-index: 25;
  width: min(100%, 430px);
  box-sizing: border-box;
  transform: translateX(-50%);
  padding: 12px 16px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(10,10,10,.96);
  box-shadow: 0 -16px 34px rgba(0,0,0,.34);
  backdrop-filter: blur(16px);
}
.authoring-actions > button { min-width: 0; min-height: 46px; }
.story-authoring-form { min-height: calc(100dvh - 62px); }
.story-authoring-body { padding-bottom: 104px; }
.story-authoring-status:empty { display: none; }
.story-authoring-status { margin: -8px 0 14px; padding: 9px 12px; border: 1px solid rgba(57,222,169,.22); border-radius: 10px; background: rgba(11,18,16,.94); }
.story-step { gap: 18px; }
.story-step-intro > strong, .story-field-head strong { color: #f5f5f5; font-size: 17px; line-height: 1.35; }
.story-step-intro p, .story-field-head p, .story-field-help { margin: 5px 0 0; color: #858585; font-size: 12px; line-height: 1.55; }
.story-field { position: relative; display: grid; gap: 8px; }
.story-field > span:first-child { color: #e9e9e9; font-size: 13px; font-weight: 750; }
.story-field b { color: var(--accent); }
.story-field .counter { justify-self: end; margin-top: -4px; color: #686868; font-size: 10px; }
.story-label-row, .story-field-head, .story-repeat-head, .story-dialogue-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inline-ai-btn { border: 1px solid rgba(57,222,169,.35); border-radius: 999px; padding: 7px 10px; background: rgba(57,222,169,.08); color: var(--accent); font: inherit; font-size: 11px; font-weight: 750; }
.inline-ai-btn:disabled { opacity: .45; }
.story-long-text { min-height: 210px; }
.story-upload-card { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 12px; border: 1px solid #2b2b2b; border-radius: 17px; background: #121212; }
.story-upload-card.compact { margin-bottom: 2px; }
.story-upload-preview { grid-column: 1/-1; min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1px dashed #454545; border-radius: 13px; background-color: #0d0d0d; background-position: center; background-size: cover; color: #aaa; text-align: center; }
.story-upload-preview.square { min-height: 230px; aspect-ratio: 1/1; }
.story-upload-preview.has-image { border-style: solid; color: transparent; }
.story-upload-preview small { color: #666; font-size: 10px; }
.story-upload-icon { color: var(--accent); font-size: 28px; }
.story-character-editor-card.production, .story-repeat-card, .story-example-card, .story-dialogue-composer, .story-lore-entry { display: grid; gap: 13px; padding: 14px; border: 1px solid #2b2b2b; border-radius: 16px; background: #131313; }
.story-character-editor-card.production { gap: 17px; padding: 15px; }
/* 카드 안은 gap 17px로 균일하다. 상태창 설명과 상태 카드, 상태 카드의 추가 버튼과 다음 섹션
   제목(예시 대화)은 같은 섹션 안 요소들과 똑같은 간격으로 붙어 있어 구분이 잘 안 됐다. 두
   경계에만 여백을 더 준다. */
.story-character-editor-card.production .story-field-head + .story-state-list { margin-top: 10px; }
.story-character-editor-card.production .scenario-add-btn + .story-field-head { margin-top: 14px; }
.story-character-editor-card.production > .story-cover-stage + .story-field { margin-top: 10px; }
.story-character-editor-card.production > .story-character-description-field + .story-field-head { margin-top: 14px; }
.story-character-editor-card.production .story-field-head + .scenario-list { margin-top: 10px; }
.story-character-description-field { gap: 8px; }
.story-character-description-field .textarea { min-height: 190px; }
.story-character-description-status { min-height: 18px; }
.creator-persona-heading > div { display: flex; align-items: center; gap: 8px; }
.story-state-card.refined { gap: 12px; background: #181818; }
.story-icon-picker { display: grid; grid-template-columns: 48px 1fr; gap: 9px; align-items: center; }
.story-state-svg { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid #333; border-radius: 12px; background: #101010; }
.story-state-svg svg { width: 23px; height: 23px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.story-example-card { background: #181818; }
.story-dialogue-list { display: grid; gap: 9px; }
.story-dialogue-row { max-width: 86%; padding: 11px 13px; border: 1px solid #303030; border-radius: 14px; background: #1d1d1d; }
.story-dialogue-row.user { justify-self: end; background: #242424; }
.story-dialogue-row.narrator { max-width: 100%; justify-self: center; background: transparent; border-style: dashed; text-align: center; }
.story-dialogue-row p { margin: 6px 0 0; color: #ddd; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.story-dialogue-meta strong { color: #aaa; font-size: 11px; }
.story-repeat-list { display: grid; gap: 11px; }
.story-repeat-card { padding: 0; overflow: hidden; }
.story-repeat-head { padding: 12px; background: #181818; }
.story-collapse-btn { min-width: 0; flex: 1; display: flex; align-items: center; gap: 9px; border: 0; background: none; color: #eee; text-align: left; font: inherit; }
.story-collapse-btn strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.story-collapse-chevron { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #343434; border-radius: 50%; background: linear-gradient(145deg, #202020, #151515); color: #a7a7a7; box-shadow: inset 0 1px rgba(255,255,255,.04); transition: transform .2s ease, border-color .2s ease, color .2s ease, background .2s ease; }
.story-collapse-chevron svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.story-collapse-chevron.open { transform: rotate(180deg); border-color: rgba(57,222,169,.36); background: rgba(57,222,169,.08); color: var(--accent); }
.story-collapse-btn:hover .story-collapse-chevron, .story-collapse-btn:focus-visible .story-collapse-chevron { border-color: rgba(57,222,169,.5); color: var(--accent); }
.story-repeat-body { display: grid; gap: 14px; padding: 14px; border-top: 1px solid #292929; }
.story-ending-asset { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.story-ending-preview { grid-column: 1/-1; min-height: 210px; border-radius: 12px; background: #0d0d0d center/cover no-repeat; display: grid; place-items: center; color: #777; }
.story-grade-row { display: flex; gap: 7px; flex-wrap: wrap; }
.story-character-tabs { display: flex; gap: 7px; padding-bottom: 3px; overflow-x: auto; }
#story-intro-open-editor { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-inline: 15px; text-align: left; }
#story-intro-setup-label { color: var(--accent); font-size: 12px; }
.story-speaker-chip { display: inline-flex; align-items: center; gap: 7px; }
.story-speaker-avatar { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #303030 center/cover no-repeat; color: #ddd; font-size: 10px; }
#story-dialogue-speakers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(104px, 100%), 1fr));
    gap: 7px;
    max-height: 108px;
    padding: 2px 2px 7px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
#story-dialogue-speakers .story-speaker-chip {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
    overflow: hidden;
    white-space: nowrap;
}
.story-speaker-chip > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#story-dialogue-feedback { min-height: 18px; margin: 0; }
.story-appearance-grid { grid-template-columns: 1fr 1fr; align-items: start; }
.story-appearance-card { position: relative; display: block; min-height: 230px; padding: 0; overflow: hidden; border: 1px solid #292929; border-radius: 14px; background-color: #131313; background-position: center; background-size: cover; }
.story-episode-badge { color: #f3f3f3; }
.story-appearance-change { display: inline-flex; align-items: center; gap: 4px; color: #eee; }
.story-appearance-empty { min-height: 230px; text-align: center; }
.story-appearance-settings-panel { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.story-appearance-settings-panel .bottom-sheet-heading { align-items: flex-start; }
.story-appearance-settings-panel .bottom-sheet-heading p { margin: 5px 0 0; }
.story-sheet-close { width: 34px; height: 34px; border: 0; background: transparent; color: #bdbdbd; font-size: 22px; cursor: pointer; }
.story-episode-scope-options { margin-bottom: 22px; }
.story-appearance-emotion-title { margin-bottom: 12px; }
.story-lore-entry-list { display: grid; gap: 9px; }
.story-lore-entry { padding: 11px; background: #191919; }
.story-authoring-actions { gap: 8px; }
.story-authoring-actions > button { flex: 1; }
.detail-play-guide { margin-top: 12px; padding: 13px 14px; border: 1px solid #292929; border-radius: 13px; background: rgba(255,255,255,.025); }
.detail-play-guide > strong { color: var(--accent); font-size: 12px; }
.detail-play-guide .detail-summary { margin: 7px 0 0; white-space: pre-wrap; }

@media (max-width: 520px) {
  .authoring-step-tabs { margin-inline: -12px; padding-inline: 12px; }
  .story-authoring-body { padding-inline: 12px; }
  .story-scene-grid { grid-template-columns: 1fr; }
  .story-upload-preview { min-height: 220px; }
  .story-upload-preview.square { min-height: 210px; }
  .story-appearance-grid { gap: 8px; }
  .story-appearance-card { padding: 7px; }
}

/* Token statistics */
.token-stats-shell { max-width: 880px; min-height: 100dvh; }
.token-stats-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid #242424;
    background: rgba(5, 5, 5, .96);
    backdrop-filter: blur(16px);
}
.token-refresh-button { padding-inline: 14px; }
.role-usage-mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0 16px 12px;
}
.role-usage-mode-tabs button,
.token-breakdown-tabs button {
    min-height: 38px;
    border: 1px solid #303030;
    border-radius: 11px;
    background: #171717;
    color: #929292;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.role-usage-mode-tabs button.active,
.token-breakdown-tabs button.active {
    border-color: rgba(57, 224, 160, .38);
    background: rgba(57, 224, 160, .1);
    color: var(--accent);
}
.token-stats-body { display: grid; gap: 28px; padding-top: 16px; }
.token-stats-status {
    padding: 12px 14px;
    border: 1px solid #303030;
    border-radius: 12px;
    background: #171717;
    color: #aaa;
    font-size: 13px;
}
.token-stats-status.error { border-color: rgba(255, 100, 100, .4); color: #ff9e9e; }
.token-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 13px;
}
.token-section-heading > div { min-width: 0; }
.token-section-heading span { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.token-section-heading h1,
.token-section-heading h2 { margin: 3px 0 0; color: #f2f2f2; font-size: 20px; }
.token-section-heading.compact h2 { font-size: 17px; }
.token-section-heading small { color: #777; font-size: 11px; white-space: nowrap; }
.token-overview-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 10px; }
.token-primary-card,
.token-mini-grid article,
.token-mode-card,
.token-breakdown-row {
    border: 1px solid #2d2d2d;
    background: linear-gradient(145deg, #191919, #121212);
}
.token-primary-card { padding: 19px; border-radius: 17px; }
.token-primary-card > span { display: block; color: #979797; font-size: 12px; }
.token-primary-card > strong { display: block; margin-top: 5px; color: #fff; font-size: clamp(34px, 6vw, 48px); line-height: 1; letter-spacing: -.04em; }
.token-primary-card > small { color: #777; font-size: 11px; }
.token-cost-pair { display: flex; align-items: baseline; gap: 8px; margin-top: 16px; }
.token-cost-pair b { color: var(--accent); font-size: 14px; }
.token-cost-pair span { color: #777; font-size: 11px; }
.token-mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.token-mini-grid article { display: grid; align-content: center; min-height: 78px; padding: 12px; border-radius: 14px; }
.token-mini-grid span { color: #777; font-size: 10px; }
.token-mini-grid strong { margin-top: 4px; color: #e9e9e9; font-size: 20px; }
.token-detail-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 9px;
    overflow: hidden;
    border: 1px solid #292929;
    border-radius: 14px;
    background: #111;
}
.token-detail-strip div { min-width: 0; padding: 11px 12px; border-right: 1px solid #292929; }
.token-detail-strip div:last-child { border-right: 0; }
.token-detail-strip span,
.token-detail-strip strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token-detail-strip span { color: #717171; font-size: 9px; }
.token-detail-strip strong { margin-top: 3px; color: #d8d8d8; font-size: 13px; }
.token-mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.token-mode-card { min-width: 0; padding: 14px; border-radius: 15px; }
.token-mode-card > div { display: flex; justify-content: space-between; gap: 8px; }
.token-mode-card > div span { color: #ddd; font-size: 13px; font-weight: 750; }
.token-mode-card > div small { color: #707070; font-size: 10px; }
.token-mode-card > strong { display: block; margin-top: 12px; color: #fff; font-size: 26px; line-height: 1; }
.token-mode-card p { overflow: hidden; margin: 7px 0 0; color: #777; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.token-breakdown-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 9px; }
.token-breakdown-list { display: grid; gap: 7px; }
.token-breakdown-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px 112px;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 13px;
    border-radius: 13px;
}
.token-breakdown-copy { min-width: 0; }
.token-breakdown-copy strong,
.token-breakdown-copy span,
.token-breakdown-metric strong,
.token-breakdown-metric span,
.token-breakdown-cost strong,
.token-breakdown-cost span { display: block; }
.token-breakdown-copy strong { overflow: hidden; color: #e8e8e8; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.token-breakdown-copy span { margin-top: 4px; color: #717171; font-size: 9px; }
.token-breakdown-metric,
.token-breakdown-cost { min-width: 0; text-align: right; }
.token-breakdown-metric strong { color: var(--accent); font-size: 14px; }
.token-breakdown-cost strong { overflow: hidden; color: #d7d7d7; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.token-breakdown-metric span,
.token-breakdown-cost span { margin-top: 3px; color: #676767; font-size: 8px; }
.token-breakdown-empty { padding: 36px 16px; border: 1px dashed #303030; border-radius: 14px; color: #777; font-size: 12px; text-align: center; }
.token-rate-note { padding: 12px 2px 0; border-top: 1px solid #202020; color: #686868; font-size: 10px; line-height: 1.55; }

@media (max-width: 600px) {
    .token-stats-shell { padding: 0; }
    .token-stats-body { gap: 24px; padding-inline: 12px; }
    .token-overview-grid { grid-template-columns: minmax(0, 1fr); }
    .token-primary-card { padding: 17px; }
    .token-detail-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .token-detail-strip div:nth-child(2) { border-right: 0; }
    .token-detail-strip div:nth-child(-n+2) { border-bottom: 1px solid #292929; }
    .token-breakdown-row { grid-template-columns: minmax(0, 1fr) 68px 92px; gap: 8px; padding-inline: 11px; }
    .token-breakdown-cost strong { font-size: 10px; }
    .my-topbar-actions { gap: 5px; }
    .my-topbar-actions .ghost-btn { padding-inline: 10px; font-size: 11px; }
}

/* Detail intro experience */
.detail-shell {
    --chat-message-font-size: 15px;
    --chat-avatar-size: 40px;
    --chat-message-column-gap: 10px;
}
.detail-intro-panel {
    padding: 18px 14px;
    border-color: #262b28;
    background: #0c0f0d;
    box-shadow: inset 0 1px rgba(255, 255, 255, .025);
}
.detail-intro-heading span {
    display: block;
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .14em;
}
.detail-intro-heading h3 {
    margin: 0;
    color: #f1f5f3;
    font-size: 21px;
    letter-spacing: -.025em;
}
.detail-intro-heading p {
    margin: 7px 0 0;
    color: #7f8883;
    font-size: 12px;
    line-height: 1.55;
}
.detail-intro-feed {
    gap: 22px;
    margin-top: 3px;
    padding: 20px 12px;
    overflow: hidden;
    border: 1px solid #242925;
    border-radius: 18px;
    background: linear-gradient(rgba(255, 255, 255, .012), transparent), #090b0a;
}
.detail-intro-feed .chat-message,
.detail-intro-feed .bubble-wrap,
.detail-intro-feed .message-content,
.detail-intro-feed .message-stack { min-width: 0; }
.detail-intro-feed .bubble-wrap { align-items: flex-end; }
.detail-intro-feed .bubble-wrap.user { flex-direction: row; }
.detail-intro-feed .bubble-wrap.user .avatar { order: 2; }
.detail-intro-feed .bubble-wrap.user .message-content { order: 1; }
.detail-intro-feed .message-content {
    max-width: calc(100% - var(--chat-avatar-size) - var(--chat-message-column-gap));
}
.detail-intro-feed .avatar {
    background-color: #202522;
    border-color: rgba(57, 224, 160, .18);
}
.detail-intro-feed .message-speaker-name {
    color: #bdc5c0;
    font-size: 12px;
}
.detail-intro-feed .bubble {
    border-color: #2b312d;
    background: #191d1b;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .16);
}
.detail-intro-feed .bubble.user {
    border-color: rgba(57, 224, 160, .2);
    background: rgba(57, 224, 160, .1);
}
.detail-intro-feed .intro-narration-message {
    padding: 7px 6px;
}
.detail-intro-feed .intro-narration {
    padding-left: 11px;
    border-left: 2px solid rgba(57, 224, 160, .38);
    color: #919a95;
    font-size: 13px;
    line-height: 1.8;
}
.detail-intro-feed .chat-image {
    width: 100%;
    max-height: 480px;
}
.detail-intro-empty {
    display: grid;
    min-height: 130px;
    place-items: center;
    margin-top: 3px;
    border: 1px dashed #303632;
    border-radius: 16px;
    background: rgba(255, 255, 255, .015);
}

/* iOS는 16px 미만 입력 컨트롤에 포커스할 때 viewport를 자동 확대한다. */
@media (max-width: 720px), (hover: none) and (pointer: coarse) {
    body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    body textarea,
    body select {
        font-size: 16px !important;
    }
}

/* 역할·모델별 AI 사용량 통계 */
.role-usage-modes { display: grid; gap: 28px; }
.role-usage-summary { display: grid; gap: 10px; }
.role-usage-section-heading { align-items: end; }
.role-usage-section-heading > div:first-child small { display: block; margin-top: 4px; }
.role-usage-summary-controls { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: 8px; }
.role-usage-list-controls { display: grid; justify-items: end; gap: 8px; }
.role-usage-work-filter { display: grid; gap: 4px; color: #777; font-size: 9px; }
.role-usage-work-filter select { min-height: 32px; max-width: 220px; padding: 6px 28px 6px 9px; border: 1px solid #333; border-radius: 9px; background: #111; color: #ddd; }
.role-usage-average-basis { display: grid; grid-template-columns: repeat(2, minmax(68px, 1fr)); gap: 5px; }
.role-usage-average-basis button {
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid #303030;
    border-radius: 9px;
    background: #151515;
    color: #888;
    font: inherit;
    font-size: 10px;
    font-weight: 750;
    cursor: pointer;
}
.role-usage-average-basis button.active { border-color: rgba(57, 224, 160, .38); background: rgba(57, 224, 160, .1); color: var(--accent); }
.role-usage-date-filter { display: flex; align-items: end; justify-content: flex-end; gap: 8px; }
.role-usage-date-filter label { display: grid; gap: 4px; color: #777; font-size: 9px; }
.role-usage-date-filter input { min-height: 34px; padding: 6px 8px; border: 1px solid #333; border-radius: 9px; background: #111; color: #ddd; color-scheme: dark; }
.role-usage-date-filter > span { padding-bottom: 9px; color: #555; }
.role-usage-date-filter button { min-height: 34px; padding: 7px 13px; }
.role-usage-list-filters { display: grid; grid-template-columns: 130px 180px minmax(220px, 1fr) auto; align-items: end; gap: 8px; }
.role-usage-list-filters label { display: grid; gap: 4px; color: #777; font-size: 9px; }
.role-usage-list-filters select,
.role-usage-list-filters input { min-height: 34px; min-width: 0; padding: 6px 9px; border: 1px solid #333; border-radius: 9px; background: #111; color: #ddd; }
.role-usage-list-filters button { min-height: 34px; padding: 7px 13px; }
.role-usage-mode { display: grid; gap: 12px; }
.role-usage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.role-usage-card { padding: 14px; border: 1px solid #282828; border-radius: 15px; background: #171717; cursor: pointer; }
.role-usage-card.active { border-color: rgba(185, 255, 69, .62); box-shadow: 0 0 0 1px rgba(185, 255, 69, .12); }
.role-usage-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.role-usage-card-top strong { color: #f0f0f0; font-size: 14px; }
.role-usage-card-top select { min-width: 0; max-width: 58%; padding: 7px 28px 7px 9px; border: 1px solid #333; border-radius: 9px; background: #111; color: #bbb; font-size: 10px; }
.role-usage-card-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin-top: 13px; }
.role-usage-card-metrics div { min-width: 0; }
.role-usage-card-metrics span, .role-usage-card-metrics b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-usage-card-metrics span { color: #686868; font-size: 8px; }
.role-usage-card-metrics b { margin-top: 3px; color: #ddd; font-size: 11px; }
.role-usage-card > small { display: block; margin-top: 10px; color: #686868; font-size: 9px; }
.role-usage-chart { display: grid; gap: 12px; }
.role-usage-chart-controls { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: 8px; }
.role-usage-chart-controls > label { display: grid; gap: 4px; color: #777; font-size: 9px; }
.role-usage-chart-controls > label select { min-height: 34px; min-width: 150px; padding: 6px 28px 6px 9px; border: 1px solid #333; border-radius: 9px; background: #111; color: #ddd; }
.role-usage-chart-metrics { display: flex; flex-wrap: wrap; gap: 6px; }
.role-usage-chart-metrics button {
    min-height: 32px;
    padding: 6px 11px;
    border: 1px solid #303030;
    border-radius: 999px;
    background: #151515;
    color: #888;
    font: inherit;
    font-size: 10px;
    font-weight: 750;
    cursor: pointer;
}
.role-usage-chart-metrics button.active { border-color: rgba(57, 224, 160, .4); background: rgba(57, 224, 160, .1); color: var(--accent); }
.role-usage-chart-grid { display: grid; gap: 10px; }
.role-usage-chart-panel { min-width: 0; padding: 14px 14px 10px; overflow: hidden; border: 1px solid #282828; border-radius: 15px; background: linear-gradient(145deg, #181818, #111); }
.role-usage-chart-panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.role-usage-chart-panel > header strong { color: #ededed; font-size: 13px; }
.role-usage-chart-panel > header span { color: #777; font-size: 9px; }
.role-usage-chart-scroll { max-width: 100%; overflow-x: auto; scrollbar-color: #353535 transparent; }
.role-usage-chart-canvas { display: grid; grid-template-columns: 74px minmax(0, 1fr); width: 100%; }
.role-usage-chart-y-axis { display: flex; height: 200px; flex-direction: column; justify-content: space-between; padding: 0 10px 0 0; text-align: right; }
.role-usage-chart-y-axis span { color: #686868; font-size: 8px; line-height: 1; white-space: nowrap; }
.role-usage-chart-plot { position: relative; min-width: 0; padding: 0 12px; }
.role-usage-chart-grid-lines { position: absolute; inset: 0 12px auto; display: flex; height: 200px; flex-direction: column; justify-content: space-between; pointer-events: none; }
.role-usage-chart-grid-lines i { display: block; width: 100%; border-top: 1px dashed #303030; }
.role-usage-chart-bars { position: relative; display: grid; grid-template-columns: repeat(var(--model-count), minmax(80px, 1fr)); gap: 12px; }
.role-usage-chart-bars figure { display: grid; min-width: 0; grid-template-rows: 200px 44px; gap: 8px; margin: 0; }
.role-usage-chart-bar-slot { display: flex; height: 200px; align-items: flex-end; justify-content: center; }
.role-usage-chart-bar { position: relative; width: min(52px, 64%); height: var(--bar-height); min-height: 0; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, color-mix(in srgb, var(--bar-color), white 18%), var(--bar-color)); box-shadow: 0 0 18px color-mix(in srgb, var(--bar-color), transparent 82%); transition: height 180ms ease; }
.role-usage-chart-bar > span { position: absolute; bottom: calc(100% + 6px); left: 50%; color: #d7d7d7; font-size: 8px; font-weight: 750; white-space: nowrap; transform: translateX(-50%); }
.role-usage-chart-bars figcaption { display: -webkit-box; overflow: hidden; color: #929292; font-size: 9px; line-height: 1.35; text-align: center; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.role-usage-detail { display: grid; gap: 10px; }
.role-usage-selection { margin: -4px 0 0; color: #888; font-size: 10px; }
.role-usage-list { display: grid; gap: 8px; }
.role-usage-entry { padding: 14px; border: 1px solid #282828; border-radius: 14px; background: #151515; }
.role-usage-entry-header { display: flex; justify-content: space-between; gap: 12px; }
.role-usage-entry-header strong { overflow: hidden; color: #e9e9e9; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.role-usage-entry-header span { flex: none; color: var(--accent); font-size: 9px; }
.role-usage-entry p { overflow: hidden; margin: 9px 0 12px; color: #aaa; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.role-usage-entry-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding: 10px; border-radius: 10px; background: #101010; }
.role-usage-entry-metrics span, .role-usage-entry-metrics b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-usage-entry-metrics span { color: #666; font-size: 8px; }
.role-usage-entry-metrics b { margin-top: 3px; color: #d7d7d7; font-size: 10px; }
.role-usage-entry > small { display: block; margin-top: 9px; color: #606060; font-size: 8px; }
.role-usage-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 4px; }
.role-usage-pagination button { min-width: 62px; padding: 7px 10px; }
.role-usage-pagination button:disabled { cursor: default; opacity: .35; }
.role-usage-pagination span { color: #888; font-size: 10px; }

@media (max-width: 720px) {
    .role-usage-section-heading { display: grid; align-items: stretch; }
    .role-usage-summary-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
    .role-usage-chart-controls { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
    .role-usage-chart-controls > label select { width: 100%; }
    .role-usage-chart-controls .role-usage-date-filter { justify-content: stretch; }
    .role-usage-chart-panel { padding-inline: 10px; }
    .role-usage-list-controls { justify-items: stretch; }
    .role-usage-summary-controls .role-usage-date-filter { grid-column: 1 / -1; }
    .role-usage-work-filter select { width: 100%; max-width: none; }
    .role-usage-date-filter { display: grid; grid-template-columns: 1fr auto 1fr auto; }
    .role-usage-average-basis { justify-self: stretch; }
    .role-usage-list-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .role-usage-keyword-field,
    .role-usage-list-filters > button { grid-column: 1 / -1; }
    .role-usage-grid { grid-template-columns: minmax(0, 1fr); }
    .role-usage-card-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 9px; }
    .role-usage-entry-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
    .role-usage-entry-header { display: grid; gap: 4px; }
}

.character-play-guide { margin:12px 16px; padding:12px; border:1px solid #34463a; border-radius:12px; color:#bccac1; font-size:13px; }
.character-play-guide p { white-space:pre-wrap; }
.character-starter-replies { display:flex; flex-direction:column; align-items:flex-end; gap:8px; padding:16px; }
.character-starter-replies button { max-width:90%; white-space:pre-wrap; text-align:left; border:1px solid #39775f; border-radius:14px; padding:12px 16px; background:#17291f; color:#dcf9e9; cursor:pointer; }
.character-starter-replies button:disabled { opacity:.5; }

.work-report-dialog { width:min(405px, calc(100vw - 32px)); }
.work-report-reasons { display:grid; margin:12px -16px 10px; border-top:1px solid #303030; }
.work-report-reasons .checkrow { min-height:46px; padding:0 16px; border-bottom:1px solid #303030; }
.work-report-dialog .field-label { display:grid; gap:7px; }
.work-report-dialog .hint { display:block; text-align:right; }
.work-report-dialog .btn:disabled { cursor:default; opacity:.42; }
