html, body.james-body {
    height: 100%;
    overflow: hidden;
}

.james-main {
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
}

.james-glow {
    position: fixed;
    width: 42rem;
    height: 42rem;
    left: 50%;
    top: 46%;
    background: radial-gradient(circle, rgba(197, 204, 212, 0.2) 0%, transparent 68%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: james-breathe 8s ease-in-out infinite;
}

.james-settings-btn {
    position: fixed;
    top: 1.1rem;
    right: 1.1rem;
    z-index: 4;
    width: 2.85rem;
    height: 2.85rem;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 999px;
    display: grid;
    place-items: center;
    opacity: 0.55;
}

.james-settings-btn svg {
    width: 22px;
    height: 22px;
}

.james-settings-btn:hover,
.james-settings-btn[aria-expanded="true"] {
    opacity: 1;
    color: var(--accent);
    background: rgba(197, 204, 212, 0.08);
}

.james-settings {
    position: fixed;
    top: 4.15rem;
    right: 1.1rem;
    z-index: 4;
    width: min(26rem, calc(100vw - 1.6rem));
    max-height: calc(100dvh - 5.2rem);
    overflow: auto;
    padding: 1.15rem 1.2rem 1rem;
    background: rgba(11, 13, 16, 0.92);
    border: 1px solid var(--line);
    border-radius: 1rem;
    backdrop-filter: blur(12px);
}

.james-settings-kicker {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.james-settings-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    color: var(--ink);
    font: inherit;
    font-size: 1.08rem;
    line-height: 1.35;
    padding: 0.62rem 0;
    cursor: pointer;
}

.james-settings-item:hover { color: var(--accent); }

.james-settings-item[aria-pressed="true"] {
    color: var(--accent);
}

.james-speech {
    margin: 0.7rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.james-settings-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 0.7rem 0 0.4rem;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.james-settings-select {
    width: 100%;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    font: inherit;
    font-size: 1.02rem;
    line-height: 1.35;
    padding: 0.55rem 0.6rem;
}

.james-settings-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 2rem;
    background: transparent;
    cursor: pointer;
}

.james-settings-range::-webkit-slider-runnable-track {
    height: 0.55rem;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        var(--accent) 0,
        var(--accent) var(--pct, 50%),
        var(--line) var(--pct, 50%),
        var(--line) 100%
    );
}

.james-settings-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: -0.35rem;
    border-radius: 999px;
    background: var(--accent);
    border: 0;
    cursor: pointer;
}

.james-settings-range::-moz-range-track {
    height: 0.55rem;
    border-radius: 999px;
    background: var(--line);
}

.james-settings-range::-moz-range-progress {
    height: 0.55rem;
    border-radius: 999px;
    background: var(--accent);
}

.james-settings-range::-moz-range-thumb {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: var(--accent);
    border: 0;
    cursor: pointer;
}

.james-speech .james-settings-item {
    margin-top: 0.45rem;
    font-size: 1.02rem;
}

.james-status {
    margin: 0.75rem 0 0;
    font-size: 0.84rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.james-status.is-ok { color: var(--accent); }
.james-status.is-down { color: #c47a74; }

.james-stage {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    justify-items: center;
    padding: 1.35rem 1.15rem 1.6rem;
    box-sizing: border-box;
}

.james-wordmark {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(1.55rem, 3.4vw, 2.15rem);
    letter-spacing: 0.08em;
    margin: 0.15rem 0 0;
    background-image: var(--metal);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: james-sheen 7s ease-in-out infinite;
}

.james-presence {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    width: min(36rem, 100%);
}

.james-avatar {
    width: min(22rem, 72vw);
    height: auto;
    display: block;
    mix-blend-mode: lighten;
    filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.35));
    transition: transform 0.6s ease, filter 0.6s ease;
}

.james-stage.is-listening .james-avatar,
.james-stage.is-speaking .james-avatar {
    transform: scale(1.03);
    filter: drop-shadow(0 18px 48px rgba(197, 204, 212, 0.28));
}

.james-line {
    margin: 0;
    max-width: 28rem;
    text-align: center;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.5;
}

.james-clarify {
    width: 100%;
    text-align: center;
}

.james-clarify-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.james-btn {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--line);
    font: inherit;
    font-size: 0.82rem;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    border-radius: 999px;
}

.james-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.james-composer {
    width: min(28rem, 100%);
}

.james-dock {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.32rem 0.38rem 0.32rem 1.05rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
}

.james-dock input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.98rem;
    outline: none;
    padding: 0.55rem 0;
}

.james-dock input::placeholder { color: var(--muted); }

.james-send {
    box-sizing: border-box;
    flex: 0 0 2.5rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.james-send svg {
    display: block;
    flex: 0 0 auto;
}

.james-send:disabled { opacity: 0.4; cursor: default; }

.james-mic {
    box-sizing: border-box;
    width: 3.6rem;
    height: 3.6rem;
    margin: 0.85rem 0 0.4rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.james-mic[hidden] {
    display: none !important;
}

.james-mic svg {
    display: block;
    flex: 0 0 auto;
}

.james-mic[aria-pressed="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 6px rgba(197, 204, 212, 0.12);
}

.james-stage.is-voice .james-composer { display: none; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.james-stage.is-from-home .james-presence,
.james-stage.is-from-home .james-composer,
.james-stage.is-from-home .james-mic {
    opacity: 0;
}

.james-stage.is-from-home.is-ready .james-presence,
.james-stage.is-from-home.is-ready .james-composer,
.james-stage.is-from-home.is-ready .james-mic {
    opacity: 1;
    transition: opacity 0.8s ease;
}

@keyframes james-sheen {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes james-breathe {
    0%, 100% { opacity: 0.55; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
}

.modalLoading {
    display: none !important;
}

@media (prefers-color-scheme: light) {
    .james-avatar { mix-blend-mode: normal; }
    .james-settings {
        background: rgba(231, 235, 240, 0.94);
    }
}

@media (prefers-reduced-motion: reduce) {
    .james-glow, .james-wordmark, .james-avatar {
        animation: none !important;
        transition: none !important;
    }
    .james-stage.is-from-home .james-presence,
    .james-stage.is-from-home .james-composer,
    .james-stage.is-from-home .james-mic {
        opacity: 1;
    }
}
