@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Unbounded:wght@600;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #10120c;
  --surface: #171a11;
  --surface-2: #1d2115;
  --line: rgba(232, 243, 210, 0.12);
  --line-strong: rgba(232, 243, 210, 0.22);
  --text: #edf3df;
  --muted: #8c9480;
  --lime: #d8ff3e;
  --lime-dark: #26310d;
  --pink: #ff5c8a;
  --cyan: #5de2ff;
  --purple: #ad7bff;
  --radius: 22px;
  --host-safe-top: 0px;
  --host-safe-bottom: 0px;
  --host-viewport-height: 100vh;
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: var(--host-viewport-height);
  background:
    radial-gradient(circle at 90% -10%, rgba(216, 255, 62, 0.08), transparent 30rem),
    linear-gradient(180deg, #11140d, var(--bg));
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.app-shell { width: min(100%, 600px); min-height: var(--host-viewport-height); margin: 0 auto; padding-bottom: calc(96px + max(env(safe-area-inset-bottom), var(--host-safe-bottom))); }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + max(env(safe-area-inset-top), var(--host-safe-top))) 18px 14px;
  background: rgba(16, 18, 12, 0.88);
  border-bottom: 1px solid rgba(255,255,255,.04);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--lime); border-radius: 12px;
  color: var(--lime); font-size: 25px; transform: rotate(-18deg); box-shadow: inset 0 0 18px rgba(216,255,62,.08);
}
.brand > span:last-child { display: grid; line-height: 1; }
.brand b { font: 700 12px/1 "Unbounded", sans-serif; letter-spacing: .04em; }
.brand small { margin-top: 4px; color: var(--lime); font-size: 8px; letter-spacing: .3em; }
.topbar-actions { display: flex; align-items: center; gap: 6px; min-width: 0; }
.language-toggle, .sound-toggle { display: grid; flex: 0 0 36px; place-items: center; width: 36px; height: 34px; padding: 0; border: 1px solid rgba(216,255,62,.28); border-radius: 10px; background: var(--lime-dark); color: var(--lime); font-size: 9px; font-weight: 800; }
.sound-toggle { font-size: 16px; }
.sound-toggle.is-muted { border-color: var(--line); background: var(--surface); color: var(--muted); text-decoration: line-through; }
.connection-pill { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: #171a11; color: var(--muted); font-size: 10px; font-weight: 700; }
.connection-pill span:last-child { overflow: hidden; max-width: 105px; text-overflow: ellipsis; white-space: nowrap; }
.status-dot, .live-dot { width: 6px; height: 6px; border-radius: 99px; background: var(--lime); box-shadow: 0 0 10px var(--lime); }

main { padding: 12px 16px 0; }
.view { animation: view-in .28s ease both; }
.view[hidden] { display: none; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 25px 2px 24px; }
.compact-heading { margin-top: 12px; margin-bottom: 16px; }
.eyebrow { margin: 0 0 8px; color: var(--lime); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font: 700 clamp(28px, 8vw, 42px)/1.05 "Unbounded", sans-serif; letter-spacing: -.05em; }
h1 em { color: var(--lime); font-style: normal; }
.round-counter { display: grid; justify-items: end; color: var(--muted); white-space: nowrap; }
.round-counter span { color: var(--text); font: 600 22px/1 "Unbounded"; }
.round-counter small { margin-top: 5px; font-size: 8px; letter-spacing: .08em; }

.arena-card, .editor-card, .online-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 16px 50px rgba(0,0,0,.24); }
.arena-meta { display: flex; justify-content: space-between; padding: 12px 15px; border-bottom: 1px solid var(--line); color: var(--muted); font: 700 8px/1 "Unbounded"; letter-spacing: .1em; }
.arena-meta span:first-child { display: flex; align-items: center; gap: 7px; color: var(--text); }
.canvas-wrap { position: relative; margin: 12px; overflow: hidden; border: 1px solid rgba(216,255,62,.15); border-radius: 14px; background: #0b0e09; aspect-ratio: 1; }
#arenaCanvas { display: block; width: 100%; height: 100%; touch-action: none; }
.result-overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; background: rgba(8,10,6,.8); backdrop-filter: blur(5px); text-align: center; }
.result-overlay[hidden] { display: none; }
.result-overlay p { margin: 0 0 8px; color: var(--lime); font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.result-overlay h2 { margin: 0 0 18px; font: 700 28px "Unbounded"; }
.arena-footer { display: flex; align-items: center; justify-content: space-between; padding: 4px 14px 14px; }
.thinking-indicator { display: flex; align-items: center; gap: 10px; min-width: 0; }
.thinking-indicator > span:last-child { display: grid; min-width: 0; }
.thinking-indicator small { color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .15em; }
.thinking-indicator b { overflow: hidden; margin-top: 3px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.snake-sigil { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(216,255,62,.3); border-radius: 10px; background: var(--lime-dark); color: var(--lime); font: 700 10px "Unbounded"; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--lime); font-size: 20px; }

.battle-controls, .editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 11px 0; }
.primary-button, .secondary-button { min-height: 48px; border-radius: 14px; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.battle-controls .primary-button, .editor-actions .primary-button { display: flex; align-items: center; justify-content: center; gap: 7px; }
.primary-button { border: 1px solid var(--lime); background: var(--lime); color: #12150c; box-shadow: 0 8px 22px rgba(216,255,62,.09); }
.primary-button:disabled { opacity: .4; cursor: not-allowed; }
.primary-button.small { min-height: 40px; padding: 0 18px; }
.secondary-button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); }
.full { width: 100%; }
.speed-control { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 8px 15px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); font-size: 10px; font-weight: 700; }
.speed-control select, .brush-settings select { border: 0; border-radius: 8px; background: var(--surface-2); color: var(--lime); font-weight: 800; }
.speed-control select { padding: 7px 9px; }

.snake-roster { display: grid; gap: 7px; margin-top: 12px; }
.roster-row { display: grid; grid-template-columns: 7px 1fr auto auto; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(23,26,17,.65); }
.roster-color { width: 7px; height: 28px; border-radius: 9px; background: var(--snake-color); box-shadow: 0 0 12px color-mix(in srgb, var(--snake-color), transparent 50%); }
.roster-row b { font-size: 11px; }
.roster-row small { color: var(--muted); font-size: 8px; }
.roster-score { font: 600 13px "Unbounded"; }
.roster-bites { min-width: 34px; color: var(--muted); font-size: 9px; text-align: right; }

.logic-badge { display: grid; place-items: center; min-width: 72px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; color: var(--lime); font: 600 16px "Unbounded"; }
.logic-badge small { margin-top: 4px; color: var(--muted); font: 600 7px "Manrope"; letter-spacing: .08em; }
.field-label { display: grid; gap: 7px; }
.field-label > span { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.field-label input { width: 100%; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--text); }
.program-name-field { margin: 0 0 11px; }
.program-name-field input { height: 48px; padding: 0 14px; font: 700 13px "Unbounded"; }
.editor-card { padding: 15px; }
.editor-topline, .pattern-toolbar, .action-editor { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.editor-topline > div > span, .pattern-toolbar > div > span, .action-editor > div > span { display: block; color: var(--muted); font-size: 9px; }
.switch-label input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; display: block; width: 42px; height: 24px; border-radius: 99px; background: #31362a; transition: .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 99px; background: #79806e; transition: .2s; }
.switch-label input:checked + .switch { background: var(--lime-dark); box-shadow: inset 0 0 0 1px rgba(216,255,62,.3); }
.switch-label input:checked + .switch::after { left: 21px; background: var(--lime); }
.rule-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 16px -15px 15px; padding: 1px 15px 8px; scrollbar-width: none; }
.rule-tabs::-webkit-scrollbar { display: none; }
.rule-tab { position: relative; flex: 0 0 37px; height: 37px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted); font: 700 10px "Unbounded"; }
.rule-tab.has-logic::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 4px; height: 4px; border-radius: 99px; background: var(--lime); }
.rule-tab.is-active { border-color: var(--lime); background: var(--lime); color: #11140c; }
.rule-tab.is-active::after { background: #11140c; }
.rule-name-field { margin-bottom: 16px; }
.rule-name-field input { height: 42px; padding: 0 12px; font-size: 12px; font-weight: 700; }
.text-button { border: 0; background: transparent; color: var(--lime); font-size: 9px; font-weight: 800; }
.text-button.danger { display: block; width: 100%; margin-top: 12px; color: var(--pink); }

.pattern-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin: 13px auto 12px; width: min(100%, 378px); padding: 7px; border: 1px solid var(--line); border-radius: 15px; background: #10130c; }
.pattern-cell { position: relative; aspect-ratio: 1; min-width: 0; padding: 0; border: 1px solid rgba(255,255,255,.055); border-radius: 7px; background: #1c2116; color: var(--text); font-size: clamp(12px, 4.3vw, 19px); }
.pattern-cell.has-condition { border-color: color-mix(in srgb, var(--cell-color), transparent 35%); background: color-mix(in srgb, var(--cell-color), #15180f 86%); color: var(--cell-color); }
.pattern-cell[data-group="orA"]::after, .pattern-cell[data-group="orB"]::after { content: attr(data-group-label); position: absolute; right: 2px; bottom: 1px; font-size: 6px; font-weight: 800; }
.pattern-cell.is-negated::before { content: "×"; position: absolute; top: 0; left: 2px; color: var(--pink); font-size: 8px; font-weight: 800; }
.pattern-head { border-color: rgba(216,255,62,.65); background: var(--lime); color: #11140c; font-size: 18px; box-shadow: 0 0 15px rgba(216,255,62,.18); }
.brush-settings { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin: 10px 0 13px; }
.brush-settings label { display: grid; gap: 6px; color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .1em; }
.brush-settings select { width: 100%; min-height: 36px; padding: 0 9px; color: var(--text); font-size: 9px; }
.negate-label { display: flex !important; align-items: center; min-height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; }
.negate-label input { accent-color: var(--pink); }
.palette { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 18px; }
.palette-button { display: grid; place-items: center; gap: 3px; min-height: 54px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--tool-color); font-size: 17px; }
.palette-button small { color: var(--muted); font-size: 6px; font-weight: 800; }
.palette-button.is-active { border-color: var(--tool-color); background: color-mix(in srgb, var(--tool-color), var(--surface-2) 90%); }
.action-editor { align-items: flex-start; padding-top: 15px; border-top: 1px solid var(--line); }
.action-options { display: grid; grid-template-columns: repeat(4, 45px); gap: 5px; }
.action-options button { display: grid; place-items: center; height: 52px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 20px; }
.action-options button small { font-size: 5px; font-weight: 800; }
.action-options button.is-active { border-color: var(--lime); background: var(--lime); color: #11140c; }
.hint-card { display: flex; gap: 13px; margin: 13px 0; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(216,255,62,.035); }
.hint-card > span, .card-number { display: grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; border: 1px solid rgba(216,255,62,.35); border-radius: 9px; color: var(--lime); font: 600 9px "Unbounded"; }
.hint-card b { font-size: 10px; }
.hint-card p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

.academy-badge { display: grid; place-items: center; min-width: 70px; height: 56px; border: 1px solid rgba(216,255,62,.3); border-radius: 16px; color: var(--lime); font: 600 11px "Unbounded"; }
.course-progress-card { margin-bottom: 10px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 16px 50px rgba(0,0,0,.24); }
.course-progress-card > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.course-progress-card span { color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .14em; }
.course-progress-card b { color: var(--lime); font-size: 10px; }
.course-progress-track { height: 7px; margin: 12px 0 3px; overflow: hidden; border-radius: 99px; background: #0d100a; }
.course-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--lime); box-shadow: 0 0 12px var(--lime); transition: width .25s ease; }
.course-progress-card .text-button { display: block; margin: 10px 0 0 auto; color: var(--muted); }
.lesson-list { display: grid; gap: 8px; }
.lesson-card { position: relative; display: grid; grid-template-columns: 36px 1fr 24px; gap: 11px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.lesson-number { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(216,255,62,.28); border-radius: 10px; color: var(--lime); font: 600 9px "Unbounded"; }
.lesson-card b { display: block; padding-top: 2px; font-size: 11px; }
.lesson-card p { margin: 5px 0 11px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.lesson-card button { min-height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); color: var(--lime); font-size: 8px; font-weight: 800; }
.lesson-check { display: none; place-items: center; width: 24px; height: 24px; border-radius: 99px; background: var(--lime); color: #11140c; font-size: 12px; font-style: normal; font-weight: 900; }
.lesson-card.is-complete { border-color: rgba(216,255,62,.25); background: rgba(216,255,62,.04); }
.lesson-card.is-complete .lesson-check { display: grid; }
.lesson-card.is-complete button { color: var(--muted); }

.cauldron-badge { display: grid; place-items: center; width: 58px; height: 58px; border: 1px solid rgba(93,226,255,.35); border-radius: 99px; color: var(--cyan); font: 600 28px "Unbounded"; box-shadow: inset 0 0 25px rgba(93,226,255,.06), 0 0 25px rgba(93,226,255,.04); }
.commons-intro { margin: -10px 2px 17px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.commons-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.commons-stats > span, .commons-fighter-metrics > span { display: grid; gap: 5px; min-width: 0; padding: 10px 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.commons-stats small, .commons-fighter-metrics small { color: var(--muted); font-size: 6px; font-weight: 800; letter-spacing: .08em; }
.commons-stats b, .commons-fighter-metrics b { overflow: hidden; font: 600 12px "Unbounded"; text-overflow: ellipsis; }
.commons-arena-card { overflow: hidden; border: 1px solid rgba(93,226,255,.2); border-radius: var(--radius); background: var(--surface); box-shadow: 0 16px 50px rgba(0,0,0,.24); }
.commons-arena-meta { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font: 700 7px "Unbounded"; letter-spacing: .08em; }
.commons-arena-meta > span:first-child { display: flex; align-items: center; gap: 7px; color: var(--text); }
.commons-canvas-wrap { position: relative; margin: 11px; overflow: hidden; border: 1px solid rgba(93,226,255,.14); border-radius: 14px; background: #080b08; aspect-ratio: 1; }
#commonsCanvas { display: block; width: 100%; height: 100%; }
.commons-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; padding: 28px; background: radial-gradient(circle, rgba(93,226,255,.08), transparent 62%); text-align: center; }
.commons-empty[hidden] { display: none; }
.commons-empty > span { color: var(--cyan); font: 600 45px "Unbounded"; }
.commons-empty p { max-width: 270px; margin: 12px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.commons-active-rule { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 14px 14px; }
.commons-active-rule > span { display: grid; min-width: 0; }
.commons-active-rule small { color: var(--muted); font-size: 6px; font-weight: 800; letter-spacing: .14em; }
.commons-active-rule b { overflow: hidden; margin-top: 3px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.commons-active-rule > i { display: grid; flex: 0 0 34px; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(93,226,255,.3); border-radius: 10px; color: var(--cyan); font: 600 8px "Unbounded"; font-style: normal; }
.commons-controls { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 10px 0; }
.commons-status { margin: 0 8px 12px; color: var(--muted); font-size: 7px; font-weight: 700; line-height: 1.45; text-align: center; }
.commons-status.is-live { color: var(--cyan); }
.commons-status.is-error { color: var(--pink); }
.commons-fighter-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.live-brain-card { margin-bottom: 12px; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.live-brain-card > div:first-child b { font-size: 12px; }
.live-brain-card > div:first-child p { margin: 5px 0 13px; color: var(--muted); font-size: 8px; line-height: 1.5; }
.commons-rules { display: grid; gap: 6px; margin-bottom: 12px; }
.commons-rule { display: grid; grid-template-columns: 29px 1fr auto; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.commons-rule.is-active-now { border-color: rgba(93,226,255,.45); box-shadow: inset 0 0 18px rgba(93,226,255,.04); }
.commons-rule > span:first-child { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 8px; color: var(--cyan); font: 600 7px "Unbounded"; }
.commons-rule > div { display: grid; min-width: 0; }
.commons-rule b { overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.commons-rule small { margin-top: 2px; color: var(--muted); font-size: 6px; }
.commons-rule select { max-width: 91px; min-height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #11140d; color: var(--lime); font-size: 7px; font-weight: 800; }

.signal-badge { display: grid; place-items: center; width: 58px; height: 58px; border: 1px solid rgba(216,255,62,.3); border-radius: 99px; color: var(--lime); font-size: 25px; box-shadow: inset 0 0 24px rgba(216,255,62,.05); }
.arena-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.arena-mode-card { display: grid; align-content: start; min-height: 148px; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.arena-mode-card.is-ready { border-color: rgba(216,255,62,.3); background: linear-gradient(145deg, rgba(216,255,62,.07), var(--surface) 60%); }
.arena-mode-card > span { color: var(--lime); font-size: 6px; font-weight: 800; letter-spacing: .13em; }
.arena-mode-card b { margin-top: 11px; font: 600 12px "Unbounded"; }
.arena-mode-card p { margin: 7px 0 12px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.arena-mode-card small { margin-top: auto; color: var(--lime); font-size: 6px; font-weight: 800; letter-spacing: .08em; }
.arena-mode-card:not(.is-ready) small { color: var(--purple); }
.event-planner-card { margin-bottom: 10px; padding: 15px; border: 1px solid rgba(173,123,255,.25); border-radius: 18px; background: linear-gradient(145deg, rgba(173,123,255,.055), var(--surface) 55%); }
.event-planner-card > div:first-child b { font-size: 12px; }
.event-planner-card > div:first-child p { margin: 5px 0 13px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.event-planner-card label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; background: #10130c; }
.event-planner-card label span, .event-metrics small { color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.event-planner-card select { border: 0; background: transparent; color: var(--lime); font: 600 11px "Unbounded"; }
.event-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.event-metrics > span { display: grid; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; }
.event-metrics b { font: 600 13px "Unbounded"; }
.organizer-note { margin: 11px 0 0; color: var(--purple); font-size: 7px; font-weight: 800; line-height: 1.4; text-align: center; }
.online-card { margin-bottom: 10px; padding: 16px; }
.online-card-title { display: flex; gap: 12px; margin-bottom: 16px; }
.room-browser-heading { align-items: flex-start; }
.room-browser-heading > div { flex: 1; }
.refresh-rooms { flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--lime); font-size: 17px; }
.online-card-title b { display: block; font-size: 12px; }
.online-card-title p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.public-rooms { display: grid; gap: 7px; }
.rooms-empty { margin: 0; padding: 17px 12px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 9px; line-height: 1.5; text-align: center; }
.public-room { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #10130c; }
.public-room-info { min-width: 0; }
.public-room-info b { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.public-room-meta { display: flex; align-items: center; gap: 7px; margin-top: 5px; color: var(--muted); font-size: 7px; font-weight: 700; }
.public-room-meta i { width: 5px; height: 5px; border-radius: 99px; background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.public-room button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); color: var(--lime); font-size: 8px; font-weight: 800; }
.or-divider { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: var(--muted); font-size: 8px; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.join-row input { min-width: 0; height: 48px; border: 1px solid var(--line); border-radius: 13px; background: #10130c; color: var(--lime); font: 600 16px "Unbounded"; letter-spacing: .25em; text-align: center; text-transform: uppercase; }
.join-row .secondary-button { padding: 0 18px; }
.error-message { margin: 12px 0 0; color: var(--pink); font-size: 9px; text-align: center; }
.pending-card { display: grid; justify-items: center; padding: 26px 18px; text-align: center; }
.pending-card[hidden] { display: none; }
.pending-orbit { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 14px; border: 1px solid rgba(216,255,62,.35); border-radius: 99px; color: var(--lime); font-size: 30px; animation: pending-spin 1.7s linear infinite; }
@keyframes pending-spin { to { transform: rotate(360deg); } }
.pending-card h2 { margin: 0 0 8px; font: 600 17px/1.25 "Unbounded"; }
.pending-card > p:not(.eyebrow) { max-width: 290px; margin: 0 0 15px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.pending-card > p b { color: var(--lime); font-family: "Unbounded"; letter-spacing: .08em; }
.lobby-code-block { display: grid; justify-items: center; padding: 5px 0 15px; }
.lobby-code-block > span { color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .18em; }
.lobby-code-block button { border: 0; background: none; }
.lobby-code-block b { display: block; color: var(--lime); font: 600 30px "Unbounded"; letter-spacing: .12em; }
.lobby-code-block small { color: var(--muted); font-size: 7px; }
.join-request-panel { margin-bottom: 13px; padding: 11px; border: 1px solid rgba(216,255,62,.25); border-radius: 12px; background: rgba(216,255,62,.035); }
.join-request-panel[hidden] { display: none; }
.request-panel-title { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--lime); font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.request-panel-title small { color: var(--muted); font-size: 7px; letter-spacing: 0; }
.join-requests { display: grid; gap: 6px; }
.join-request { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 6px; padding: 8px 9px; border-radius: 10px; background: var(--surface-2); }
.join-request b { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.join-request button { min-width: 34px; height: 32px; border-radius: 9px; font-size: 14px; }
.approve-request { border: 1px solid var(--lime); background: var(--lime); color: #11140c; }
.reject-request { border: 1px solid var(--line); background: transparent; color: var(--pink); }
.lobby-players { display: grid; gap: 6px; margin-bottom: 14px; }
.lobby-player { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; font-size: 10px; }
.lobby-player i { width: 8px; height: 8px; border-radius: 99px; background: var(--player-color); box-shadow: 0 0 10px var(--player-color); }
.lobby-player small { margin-left: auto; color: var(--muted); font-size: 7px; }
.copy-feedback { margin: 9px 0 0; color: var(--lime); font-size: 9px; text-align: center; }
.network-note { display: flex; gap: 11px; padding: 14px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.network-note i { flex: 0 0 6px; height: 6px; margin-top: 4px; border-radius: 99px; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.network-note p { margin: 0; }
.network-note b { color: var(--text); }

.welcome-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); background: rgba(7,9,5,.88); backdrop-filter: blur(14px); }
.welcome-overlay[hidden] { display: none; }
.welcome-card { width: min(100%, 430px); max-height: 100%; overflow-y: auto; padding: 22px; border: 1px solid rgba(216,255,62,.27); border-radius: 24px; background: radial-gradient(circle at 90% 0, rgba(216,255,62,.1), transparent 40%), var(--surface); box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.welcome-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.welcome-card h2 { margin: 0; font: 700 26px/1.1 "Unbounded"; letter-spacing: -.04em; }
.welcome-card > p:not(.eyebrow) { margin: 13px 0 17px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.welcome-card ol { display: grid; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; counter-reset: welcome-step; }
.welcome-card li { counter-increment: welcome-step; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; font-size: 10px; font-weight: 700; }
.welcome-card li::before { content: "0" counter(welcome-step); color: var(--lime); font: 600 8px "Unbounded"; }
.welcome-card > .text-button { display: block; margin: 15px auto 0; color: var(--muted); }

.bottom-nav {
  position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); width: min(100%, 600px); margin: auto;
  padding: 7px 12px calc(8px + max(env(safe-area-inset-bottom), var(--host-safe-bottom))); border-top: 1px solid var(--line); background: rgba(18,21,13,.94); backdrop-filter: blur(22px);
}
.bottom-nav button { display: grid; place-items: center; gap: 3px; min-height: 52px; border: 0; border-radius: 13px; background: transparent; color: #6f7765; }
.bottom-nav button span { font-size: 20px; line-height: 1; }
.bottom-nav button small { font-size: 6px; font-weight: 800; letter-spacing: .05em; }
.bottom-nav button.is-active { background: rgba(216,255,62,.07); color: var(--lime); }

@media (min-width: 700px) {
  body { padding: 20px 0; }
  .app-shell { min-height: calc(100vh - 40px); border: 1px solid rgba(255,255,255,.055); border-radius: 28px; box-shadow: 0 30px 100px rgba(0,0,0,.4); }
  .topbar { border-radius: 28px 28px 0 0; }
  .bottom-nav { bottom: 20px; border: 1px solid var(--line); border-radius: 0 0 28px 28px; }
}

@media (max-width: 390px) {
  .action-editor { display: grid; }
  .action-options { grid-template-columns: repeat(4, 1fr); width: 100%; }
  .palette { grid-template-columns: repeat(3, 1fr); }
  .section-heading { align-items: center; }
  h1 { font-size: 27px; }
  .brand > span:last-child { display: none; }
  .connection-pill span:last-child { max-width: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
