:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f4f0ff;
    background: #0c0912;
    font-synthesis: none;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% -10%, rgba(129, 87, 255, 0.24), transparent 42%),
        linear-gradient(180deg, #100b18 0%, #08070d 100%);
}

button { font: inherit; }

.app-shell {
    width: min(100%, 720px);
    margin: 0 auto;
    padding: max(18px, env(safe-area-inset-top)) 16px max(36px, env(safe-area-inset-bottom));
}

.topbar, .section-heading, .scoreboard, .composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topbar { margin-bottom: 16px; }

h1 {
    margin: 4px 0 0;
    max-width: 560px;
    font-size: clamp(1.45rem, 6vw, 2.35rem);
    line-height: 1.04;
    letter-spacing: -0.04em;
}

h2 {
    margin: 4px 0 0;
    font-size: 1.08rem;
    line-height: 1.35;
    word-break: break-word;
}

.eyebrow, .label {
    color: #a994e8;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.card {
    margin: 12px 0;
    padding: 16px;
    border: 1px solid rgba(188, 162, 255, 0.16);
    border-radius: 18px;
    background: rgba(22, 17, 32, 0.88);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(18px);
}

.scoreboard strong {
    display: block;
    margin-top: 2px;
    font-size: 2rem;
}

.scoreboard .round { text-align: center; }
.scoreboard .right { text-align: right; }

.muted {
    color: #9a92a8;
    font-size: 0.88rem;
}

.status-pill, .focus {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(100, 73, 171, 0.24);
    color: #d8caff;
    font-size: 0.78rem;
    font-weight: 750;
}

.glyph-tray {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.glyph-button, .reaction-button, .ghost-button, .cast-button {
    border: 0;
    border-radius: 12px;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.glyph-button {
    min-height: 48px;
    padding: 8px 6px;
    border: 1px solid rgba(195, 174, 255, 0.16);
    background: #21182f;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.035em;
}

.glyph-button:active { transform: scale(0.97); }

.glyph-button[data-family="essence"] { background: #2b1728; }
.glyph-button[data-family="action"] { background: #17243a; }
.glyph-button[data-family="target"] { background: #20251b; }
.glyph-button[data-family="modifier"] { background: #2a2115; }

.diagnostic {
    margin-top: 10px;
    min-height: 22px;
    color: #ffba76;
    font-size: 0.84rem;
}

.diagnostic.valid { color: #80e6b2; }

.composer-actions { margin-top: 12px; justify-content: flex-end; }

.ghost-button {
    padding: 9px 12px;
    background: rgba(255,255,255,0.06);
    color: #d9d2e5;
}

.reaction-tray {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 10px 0 14px;
}

.reaction-button {
    min-height: 44px;
    padding: 8px;
    background: rgba(255,255,255,0.055);
    border: 1px solid transparent;
    font-size: 0.8rem;
    font-weight: 800;
}

.reaction-button.selected {
    border-color: #a887ff;
    background: rgba(120, 82, 221, 0.22);
}

.cast-button {
    width: 100%;
    min-height: 54px;
    background: linear-gradient(135deg, #744eff, #ad63ff);
    color: white;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.cast-button:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

.combat-log {
    margin: 10px 0 0;
    padding-left: 22px;
    color: #d8d1e1;
    font-size: 0.88rem;
    line-height: 1.45;
}

.combat-log li + li { margin-top: 7px; }

.hidden { display: none; }

@media (min-width: 620px) {
    .glyph-tray { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .reaction-tray { grid-template-columns: repeat(4, 1fr); }
}

.versions {
    margin: 22px 0 0;
    text-align: center;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.install-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 12px 0 0;
    padding: 12px 14px;
    border: 1px solid rgba(169, 148, 232, 0.35);
    border-radius: 14px;
    background: rgba(129, 87, 255, 0.12);
    color: #d8d1e1;
    font-size: 0.88rem;
    line-height: 1.4;
}

.install-actions { display: flex; gap: 8px; }

.install-button {
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #744eff, #ad63ff);
    color: white;
    font-weight: 800;
}
