:root {
  --canvas: #09060d;
  --canvas-soft: #160e1f;
  --panel: #21152c;
  --panel-deep: #110a18;
  --line: #463254;
  --line-light: #654775;
  --ink: #f8f2fb;
  --muted: #d8cce0;
  --faint: #ad94ba;
  --accent: #a855f7;
  --accent-strong: #9333ea;
  --accent-soft: #d8b4fe;
  --success: #86efac;
  --timer-warning: #86efac;
  --danger: #fb7185;
  --shadow: 0 20px 55px rgb(0 0 0 / 52%);
}

.discord-auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 70% 10%, rgb(124 58 237 / 24%), transparent 34rem), #090711;
}

.discord-auth-card {
  width: min(440px, 100%);
  padding: 32px;
  text-align: center;
  background: linear-gradient(150deg, #1b1728, #0d0c15);
  border: 1px solid rgb(169 121 255 / 38%);
  border-radius: 26px 14px 26px 14px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 48%);
}

.discord-auth-card img { border-radius: 20px; }
.discord-auth-card .eyebrow { display: block; margin-top: 20px; }
.discord-auth-card h1 { margin: 10px 0; }
.discord-auth-card p { margin: 0 0 22px; color: #aaa3ba; }

/* Prep shared-planning workspace */
.prep-shell [hidden] { display: none !important; }
.prep-shell { width: min(1120px, calc(100% - 28px)); margin: 0 auto; padding: 145px 0 104px; }
.prep-heading { align-items: flex-end; margin-bottom: 18px; }
.prep-heading h1 { margin-bottom: 5px; }
.prep-back-link { flex: 0 0 auto; text-decoration: none; }
.prep-entry { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.prep-entry-card { display: flex; min-height: 260px; flex-direction: column; }
.prep-entry-card p { color: var(--muted); line-height: 1.55; }
.prep-entry-card .wide { margin-top: auto; }
.prep-create,.prep-review,.prep-thanks,.prep-results { max-width: 900px; margin: 0 auto; }
.prep-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.prep-wide { grid-column: 1 / -1; }
.prep-choice-group { min-width: 0; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 15px; }
.prep-choice-group legend { padding: 0 7px; color: var(--faint); font: 700 .59rem Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.prep-day-choices,.prep-format-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.prep-format-choices { grid-template-columns: 1fr; }
.prep-day-choices label,.prep-format-choices label { display: flex; min-height: 44px; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; background: rgb(255 255 255 / 2.5%); border: 1px solid var(--line); border-radius: 11px; }
.prep-day-choices input,.prep-format-choices input { position: static; width: 18px; height: 18px; flex: 0 0 auto; margin: 0; opacity: 1; pointer-events: auto; accent-color: var(--mint); }
.prep-day-choices span,.prep-format-choices span { display: block; min-height: 0; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 0; font-size: .7rem; }
.prep-day-choices label:has(input:checked),.prep-format-choices label:has(input:checked) { border-color: rgb(95 240 197 / 50%); background: rgb(95 240 197 / 7%); }
.prep-day-choices input:checked + span,.prep-format-choices input:checked + span { color: var(--ink); background: transparent; border: 0; font-weight: 750; }
.prep-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.prep-review-grid div { padding: 13px; background: rgb(255 255 255 / 3%); border: 1px solid var(--line); border-radius: 13px; }
.prep-review-grid span,.prep-form-header > div:last-child span { display: block; color: var(--faint); font: 700 .56rem Consolas, monospace; letter-spacing: .09em; text-transform: uppercase; }
.prep-review-grid strong { display: block; margin-top: 6px; color: var(--ink); font-size: .78rem; }
.prep-note { color: var(--muted); font-size: .7rem; }
.prep-form-header,.prep-organizer-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.prep-form-header h2,.prep-organizer-header h2 { margin: 3px 0; }
.prep-form-header > div:last-child { min-width: 160px; text-align: right; }
.prep-stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 0 0 14px; }
.prep-stepper span { padding: 10px 5px; color: var(--faint); border-bottom: 2px solid var(--line); font: 700 .58rem Consolas, monospace; text-align: center; text-transform: uppercase; }
.prep-stepper span.active { color: var(--mint); border-color: var(--mint); }
.prep-member-step { max-width: 900px; margin: 0 auto; }
.prep-availability,.prep-resource-list,.prep-assignment-days,.prep-responses { display: grid; gap: 12px; margin: 17px 0; }
.prep-day-card,.prep-resource-card,.prep-assignment-day,.prep-response-card { padding: 14px; background: rgb(255 255 255 / 2.5%); border: 1px solid var(--line); border-radius: 15px; }
.prep-day-enable { display: flex; align-items: center; gap: 10px; }
.prep-day-enable input { width: 19px; height: 19px; accent-color: var(--mint); }
.prep-day-enable span { display: grid; gap: 2px; }
.prep-day-enable small { color: var(--faint); font-size: .62rem; }
.prep-ranges { display: grid; gap: 8px; margin: 12px 0; }
.prep-range-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 8px; }
.prep-range-row .button { min-height: 42px; }
.prep-duration-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.prep-duration-fields label span { display: block; margin-bottom: 5px; color: var(--faint); font-size: .57rem; }
.prep-item-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.prep-item-grid-single { grid-template-columns: minmax(0, 1fr); }
.prep-split-panel { margin-top: 14px; }
.prep-split-panel > h3 { color: var(--mint); }
.prep-success-mark { display: grid; width: 52px; height: 52px; place-items: center; margin-bottom: 13px; color: #071410; background: var(--mint); border-radius: 50%; font-size: 1.5rem; font-weight: 900; }
.prep-thanks p,.prep-results p,.prep-schedule-panel > p { color: var(--muted); line-height: 1.55; }
.prep-organizer { display: grid; gap: 14px; }
.prep-organizer-header { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; margin: 0; padding: 14px 16px; }
.prep-organizer-header > div:first-child p { margin: 5px 0 0; }
.prep-organizer-header .session-code-block { grid-template-areas: "label button" "code button"; grid-template-columns: auto auto; min-width: 0; gap: 3px 10px; padding: 8px 9px 8px 12px; border-radius: 12px; justify-items: start; }
.prep-organizer-header .session-code-block > span { grid-area: label; font-size: .56rem; }
.prep-organizer-header .session-code-block > strong { grid-area: code; font-size: 1.08rem; line-height: 1; }
.prep-organizer-header .session-code-block > button { grid-area: button; min-height: 36px; align-self: center; padding: 0 9px; font-size: .58rem; }
.prep-schedule-panel { margin: 0; }
.prep-assignment-day h3 { margin: 0 0 10px; color: var(--gold); }
.prep-day-subnav { display: flex; min-width: 0; margin: 18px 0 0; overflow-x: auto; background: rgb(10 8 17 / 72%); border: 1px solid var(--line); border-radius: 14px 14px 0 0; scrollbar-width: none; }
.prep-day-subnav::-webkit-scrollbar { display: none; }
.prep-day-tab { position: relative; min-width: max-content; min-height: 49px; padding: 0 20px; color: var(--muted); background: transparent; border: 0; font: 750 .72rem "Segoe UI", system-ui, sans-serif; }
.prep-day-tab::after { position: absolute; right: 17px; bottom: 0; left: 17px; height: 2px; background: transparent; border-radius: 2px 2px 0 0; content: ""; }
.prep-day-tab.active { color: var(--mint); background: linear-gradient(180deg, rgb(95 240 197 / 7%), transparent); }
.prep-day-tab.active::after { background: var(--mint); box-shadow: 0 0 12px rgb(95 240 197 / 55%); }
.prep-day-table-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.prep-day-table-heading h3 { margin: 4px 0 0; font-size: 1.28rem; }
.prep-day-table-heading > span { color: var(--faint); font: 700 .6rem Consolas, monospace; text-transform: uppercase; }
.prep-timeslot-table-wrap { max-height: 540px; overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
.prep-timeslot-table { width: 100%; min-width: 470px; border-collapse: collapse; }
.prep-timeslot-table--research { min-width: 600px; }
.prep-timeslot-table--construction { min-width: 720px; }
.prep-timeslot-table thead { position: sticky; top: 0; z-index: 2; }
.prep-timeslot-table th,.prep-timeslot-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.prep-timeslot-table thead th { color: var(--faint); background: #15101f; font: 750 .58rem Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.prep-timeslot-table tbody th { width: 150px; color: var(--ink); font: 750 .69rem Consolas, monospace; white-space: nowrap; }
.prep-timeslot-table tbody tr:last-child th,.prep-timeslot-table tbody tr:last-child td { border-bottom: 0; }
.prep-timeslot-table tbody tr:hover { background: rgb(95 240 197 / 3.5%); }
.prep-slot-number { color: var(--faint); font: 700 .62rem Consolas, monospace; }
.prep-slot-members { display: flex; flex-wrap: wrap; gap: 5px; }
.prep-slot-members span { padding: 4px 7px; color: var(--mint); background: rgb(95 240 197 / 8%); border: 1px solid rgb(95 240 197 / 20%); border-radius: 7px; font-size: .62rem; }
.prep-slot-items { display: flex; flex-wrap: wrap; gap: 5px; }
.prep-slot-items span { min-width: 34px; padding: 4px 7px; color: var(--gold); background: rgb(246 198 107 / 7%); border: 1px solid rgb(246 198 107 / 18%); border-radius: 7px; font: 700 .62rem Consolas, monospace; text-align: center; }
.prep-slot-empty { color: var(--faint); font-size: .62rem; }
.prep-manual-editor { margin-top: 18px; padding: 16px; background: rgb(255 255 255 / 2.5%); border: 1px solid var(--line); border-radius: 14px; }
.prep-manual-editor > div:first-child h3 { margin: 4px 0 12px; }
.prep-assignment-row { display: grid; grid-template-columns: minmax(120px, .65fr) minmax(170px, 1fr); align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.prep-assignment-row span { display: grid; gap: 3px; }
.prep-assignment-row small { color: var(--faint); font-size: .62rem; }
.prep-response-card > div:first-child { display: grid; gap: 3px; }
.prep-response-card > div:first-child small { color: var(--mint); }
.prep-response-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 12px 0; }
.prep-response-card dl div { padding: 8px; background: rgb(255 255 255 / 3%); border-radius: 9px; }
.prep-response-card dt { color: var(--faint); font-size: .54rem; text-transform: uppercase; }
.prep-response-card dd { margin: 4px 0 0; color: var(--ink); font-size: .67rem; }
.prep-response-card p { margin: 0; color: var(--muted); font-size: .63rem; line-height: 1.5; }
.prep-response-table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
.prep-response-table { width: 100%; min-width: 1160px; border-collapse: collapse; }
.prep-response-table thead { position: sticky; top: 0; z-index: 2; }
.prep-response-table th,.prep-response-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prep-response-table thead th { color: var(--faint); background: #15101f; font: 750 .58rem Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.prep-response-table tbody th { min-width: 150px; color: var(--ink); }
.prep-response-table tbody th strong { display: block; font-size: .7rem; }
.prep-response-table tbody th small { display: block; margin-top: 4px; color: var(--mint); font-size: .54rem; text-transform: uppercase; }
.prep-response-table tbody td { color: var(--ink); font-size: .65rem; white-space: nowrap; }
.prep-response-table tbody tr:last-child th,.prep-response-table tbody tr:last-child td { border-bottom: 0; }
.prep-response-table tbody tr:hover { background: rgb(95 240 197 / 3.5%); }
.prep-response-availability { display: grid; min-width: 220px; gap: 5px; white-space: normal; }
.prep-response-availability span { display: grid; grid-template-columns: 58px minmax(0,1fr); gap: 7px; color: var(--muted); }
.prep-response-availability strong { color: var(--mint); font-size: .6rem; }
.prep-result-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.prep-result-row strong { color: var(--mint); }

@media (max-width: 680px) {
  .prep-shell { width: min(100% - 20px, 1120px); padding-top: 137px; }
  .prep-heading,.prep-form-header { align-items: flex-start; flex-direction: column; }
  .prep-organizer-header { grid-template-columns: minmax(0,1fr); align-items: center; padding: 12px; }
  .prep-organizer-header .session-code-block { width: 100%; align-self: center; }
  .prep-organizer-header .session-code-block > strong { font-size: .84rem; letter-spacing: .06em; }
  .prep-entry,.prep-form-grid,.prep-review-grid { grid-template-columns: 1fr; }
  .prep-wide { grid-column: auto; }
  .prep-entry-card { min-height: 215px; }
  .prep-form-header > div:last-child { text-align: left; }
  .prep-stepper span { font-size: .5rem; }
  .prep-range-row { grid-template-columns: 1fr 1fr; }
  .prep-range-row .button { grid-column: 1 / -1; }
  .prep-duration-fields { grid-template-columns: repeat(3, 1fr); }
  .prep-item-grid,.prep-assignment-row { grid-template-columns: 1fr; }
  .prep-response-card dl { grid-template-columns: repeat(2, 1fr); }
}

body[data-page="prep"] .ralliance-shared-header { position: fixed; top: 0; right: 0; left: 0; z-index: 70; }
.prep-module-nav { position: fixed; top: max(68px,calc(49px + env(safe-area-inset-top))); right: 0; left: 0; z-index: 69; display: grid; grid-template-columns: auto minmax(0,1fr); min-height: 53px; padding: 0 clamp(14px,3vw,30px); background: rgb(13 10 22 / 96%); border-bottom: 1px solid var(--line); box-shadow: 0 10px 30px rgb(0 0 0 / 22%); backdrop-filter: blur(18px); }
.prep-module-nav .module-context { display: flex; align-items: center; gap: 8px; padding-right: 20px; color: var(--muted); border-right: 1px solid var(--line); font: 800 10px Consolas,monospace; letter-spacing: .08em; white-space: nowrap; }
.prep-module-nav .module-context-dot { display: block; width: 6px; height: 6px; flex: 0 0 6px; background: #5ff0c5; border-radius: 50%; box-shadow: 0 0 10px #5ff0c5; }
.prep-module-nav .module-context strong { color: var(--gold); }
.prep-module-nav .module-tabs { display: flex; min-width: 0; padding-left: 10px; overflow-x: auto; scrollbar-width: none; }
.prep-module-nav .module-tabs::-webkit-scrollbar { display: none; }
.prep-module-nav .nav-btn { position: relative; display: grid; min-width: max-content; min-height: 53px; padding: 0 17px; place-items: center; color: var(--muted); background: transparent; border: 0; border-radius: 10px 10px 0 0; font: 750 12px "Segoe UI",system-ui,sans-serif; letter-spacing: 0; text-decoration: none; text-transform: none; }
.prep-module-nav .nav-btn::after { position: absolute; right: 16px; bottom: 0; left: 16px; height: 2px; background: transparent; border-radius: 2px 2px 0 0; content: ""; }
.prep-module-nav .nav-btn:hover { color: var(--ink); background: rgb(255 255 255 / 2.5%); }
.prep-module-nav .nav-btn.active { color: var(--mint); background: linear-gradient(180deg,rgb(95 240 197 / 7%),transparent); }
.prep-module-nav .nav-btn.active::after { background: var(--mint); box-shadow: 0 0 12px rgb(95 240 197 / 55%); }
@media (max-width: 520px) {
  .prep-module-nav { display: grid; grid-template-columns: 18px minmax(0,1fr); padding: 0 4px; }
  .prep-module-nav .module-context { display: flex; padding: 0; border: 0; justify-content: center; }
  .prep-module-nav .module-context-dot { width: 8px; height: 8px; flex: 0 0 8px; background: #5ff0c5; box-shadow: 0 0 12px #5ff0c5; }
  .prep-module-nav .module-context strong,.prep-module-nav .module-context span { display: none; }
  .prep-module-nav .module-tabs { padding-left: 0; }
  .prep-module-nav .nav-btn { min-height: 49px; padding: 0 14px; font-size: 11px; }
}

/* Shared Firebase sessions */
.accent-live { border-color: rgba(99, 255, 198, 0.5); background: linear-gradient(145deg, #10151a, #130b1b); }
.accent-live::before { background: linear-gradient(135deg, #63ffc6, #a855f7); }
.session-shell { padding-bottom: 116px; }
.session-heading { margin-bottom: 22px; }
.session-auth { max-width: 620px; margin: 0 auto; text-align: center; }
.session-auth h2, .session-entry-card h2, .session-host-controls h2 { margin: 8px 0 10px; }
.session-auth p, .session-host-controls p { color: var(--muted); }
.session-entry { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.session-entry[hidden] { display: none !important; }
.session-entry-card { display: flex; flex-direction: column; gap: 15px; }
.session-entry-card > .button:last-child { margin-top: auto; text-align: center; }
.session-app-intro { margin: 0; color: var(--muted); }
.session-app-features { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.session-app-features li { position: relative; padding-left: 22px; color: var(--text); font-weight: 700; line-height: 1.4; }
.session-app-features li::before { position: absolute; top: .05em; left: 0; color: var(--success); content: "✓"; }
.session-apple-note { margin: 0; padding: 12px 14px; color: var(--muted); background: rgb(124 58 237 / 8%); border: 1px solid rgb(169 121 255 / 20%); border-radius: 12px; font-size: .78rem; line-height: 1.5; }
.session-apple-note a { color: var(--success); font-weight: 800; }
.session-entry-card label, .session-self-card label, .session-host-controls label { display: grid; gap: 8px; color: var(--muted); font-weight: 700; }
.session-entry-card input, .session-self-card input, .session-host-controls input, .session-host-controls select, .session-member select, .session-member input {
  width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #100b16; color: var(--ink); font: inherit;
}
.session-code-input { text-transform: uppercase; letter-spacing: 0.18em; font-weight: 900; }
.session-message { min-height: 24px; margin: 14px 0; color: var(--success); text-align: center; font-weight: 800; }
.session-message.error { color: #fb7185; }
.session-message.warning { color: #fb923c; }
.session-room-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.session-room-header h2 { margin: 5px 0; }
.session-room-header p { margin: 0; color: var(--muted); }
.session-code-block { min-width: 190px; display: grid; justify-items: center; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #100b16; }
.session-code-block span { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.13em; }
.session-code-block strong { max-width: 100%; color: var(--success); font-size: clamp(.84rem, 3vw, 1.15rem); letter-spacing: .06em; overflow-wrap: anywhere; text-align: center; }
.session-layout { display: grid; grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.35fr); gap: 20px; align-items: start; }
.session-host-controls, .session-members-panel { grid-column: 2; }
.session-self-card { grid-row: 1 / span 2; }
.session-profile-row, .session-member-main { display: flex; align-items: center; gap: 12px; }
.session-profile-row { margin: 16px 0; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #100b16; }
.session-profile-row div, .session-member-main div { display: grid; gap: 3px; }
.session-profile-row small, .session-member-main small { color: var(--muted); }
.session-clock-status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  margin: -6px 0 13px;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 800;
}
.session-clock-status::before {
  width: 8px;
  height: 8px;
  content: "";
  background: var(--faint);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(173 148 186 / 10%);
}
.session-clock-status.synced { color: var(--success); }
.session-clock-status.synced::before { background: var(--success); box-shadow: 0 0 0 4px rgb(134 239 172 / 12%); }
.session-live-pill { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-weight: 900; font-size: 0.75rem; text-transform: uppercase; }
.session-live-pill.active { color: #07120e; border-color: var(--success); background: var(--success); }
.session-personal-countdown { display: grid; justify-items: center; gap: 7px; margin-top: 18px; padding: 22px 12px; border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at center, rgba(168,85,247,0.17), transparent 68%), #0e0913; text-align: center; }
.session-personal-countdown span, .session-personal-countdown small { color: var(--muted); }
.session-personal-countdown strong { color: var(--success); font-size: clamp(2rem, 6vw, 3.2rem); font-variant-numeric: tabular-nums; }
.session-personal-countdown strong.send-now { color: #86efac; text-shadow: 0 0 22px rgba(134,239,172,0.65); }
.session-control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.session-mode-control { margin-top: 16px; }
.session-tool-panel { display: grid; gap: 12px; margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #100b16; }
.session-tool-panel[hidden] { display: none !important; }
.session-tool-panel h3 { margin: 0; color: var(--accent-soft); }
.session-tool-panel p { margin: 0; }
.session-lock-row, .session-enemy-landing { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.session-lock-row strong, .session-enemy-landing strong { color: var(--success); font-variant-numeric: tabular-nums; }
.session-multi-delays { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.session-multi-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.session-members { display: grid; gap: 10px; margin-top: 14px; }
.session-member { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #100b16; }
.session-member .account-avatar, .session-profile-row .account-avatar { flex: 0 0 auto; overflow: hidden; }
.session-member .account-avatar img, .session-profile-row .account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.session-member-assignment { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 190px; }
.session-member-assignment select { min-height: 42px; }
.session-member-assignment input { width: 62px; min-height: 42px; padding: 0 8px; }
.session-member-assignment strong { color: var(--accent-soft); font-size: 0.82rem; }
.session-member-admin { display: flex; gap: 6px; }
.session-member-admin button { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 0.78rem; font-weight: 900; }
.session-member-admin button[data-session-ban] { border-color: #fb7185; color: #fb7185; }
.session-room-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.danger-session { min-height: 46px; padding: 0 18px; border: 1px solid #fb7185; border-radius: 12px; background: rgba(251,113,133,0.1); color: #fb7185; font: inherit; font-weight: 900; }

@media (max-width: 760px) {
  .session-entry, .session-layout { grid-template-columns: minmax(0, 1fr); }
  .session-self-card { grid-row: auto; }
  .session-host-controls, .session-members-panel { grid-column: auto; }
  .session-room-header { align-items: stretch; flex-direction: column; }
  .session-code-block { min-width: 0; }
  .session-control-grid { grid-template-columns: minmax(0, 1fr); }
  .session-multi-delays { grid-template-columns: minmax(0, 1fr); }
  .session-member { align-items: stretch; flex-direction: column; }
  .session-member-assignment { min-width: 0; width: 100%; justify-content: stretch; }
  .session-member-assignment select { flex: 1; }
  .session-member-admin { width: 100%; }
  .session-member-admin button { flex: 1; }
  .session-room-actions { flex-direction: column; }
}

html[data-theme="orange"] {
  --canvas: #11151b;
  --canvas-soft: #222831;
  --panel: #2d333c;
  --panel-deep: #171b21;
  --line: #535b66;
  --line-light: #727b87;
  --accent: #f96d00;
  --accent-strong: #ff8126;
  --accent-soft: #ffb275;
}
html[data-theme="orange"] body { background: radial-gradient(circle at 15% 0%, rgb(249 109 0 / 22%), transparent 28rem), radial-gradient(circle at 85% 100%, rgb(249 109 0 / 10%), transparent 30rem), var(--canvas); }
html.high-contrast { --ink: #ffffff; --muted: #f5eefa; --faint: #d9c8e2; --line: #8b6e9a; --line-light: #b18fc2; }

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgb(88 28 135 / 36%), transparent 28rem),
    radial-gradient(circle at 85% 100%, rgb(168 85 247 / 12%), transparent 30rem),
    var(--canvas);
  font-family: Arial, sans-serif;
}

body[data-page="home"] { scrollbar-width: none; }
body[data-page="home"]::-webkit-scrollbar { display: none; width: 0; height: 0; }

.app-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  padding: 22px;
  background: rgb(5 3 8 / 78%);
  backdrop-filter: blur(8px);
  place-items: center;
}
.app-confirm-dialog {
  width: min(390px, 100%);
  padding: 24px;
  background: linear-gradient(155deg, #21152c, #100917);
  border: 1px solid rgb(168 85 247 / 58%);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 68%), 0 0 34px rgb(168 85 247 / 14%);
}
.app-confirm-dialog p {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
}
.app-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.app-confirm-danger {
  color: #fff;
  background: linear-gradient(135deg, #be123c, #881337);
  border: 1px solid #fb7185;
}
.app-confirm-danger:focus-visible,
.app-confirm-danger:hover { background: linear-gradient(135deg, #e11d48, #9f1239); }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.site-header {
  width: min(1440px, calc(100% - 48px));
  min-height: 79px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  border-bottom: 1px solid var(--line);
}

.brand {
  flex: 0 0 auto;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  color: var(--canvas);
  background: var(--accent);
  border-radius: 8px 2px 8px 2px;
  font-family: "Playfair Display", serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.nav { display: flex; align-self: stretch; align-items: center; gap: 5px; }

.nav a {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease;
}

.nav a:hover, .nav a.active { color: var(--ink); border-color: var(--accent); }

.home-shell, .app-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }

.home-shell { padding: clamp(70px, 11vw, 160px) 0 50px; }

.hero { max-width: 830px; }
.eyebrow, .panel-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 840px;
  margin-bottom: 20px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.75rem, 6vw, 5.6rem);
  font-weight: 600;
  letter-spacing: -0.052em;
  line-height: 0.98;
}

h1 em { color: var(--accent-soft); font-weight: 600; }
.hero-copy { max-width: 570px; color: var(--muted); font-size: 1.02rem; line-height: 1.75; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: clamp(54px, 8vw, 98px);
}

.apk-tool-grid {
  grid-template-columns: repeat(2, 1fr);
}
.home-shell > .apk-tool-grid { margin-top: 0; }

.tool-card {
  position: relative;
  display: flex;
  min-height: 285px;
  padding: 27px 28px 25px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  color: var(--ink);
  background: linear-gradient(145deg, #2b1938, #130b1b);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease;
}

.tool-card::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 82px;
  height: 82px;
  content: "";
  opacity: 0.75;
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}
.tool-card:hover { transform: translateY(-5px); border-color: var(--line-light); }
.accent-orange::after { background: var(--accent); }
.accent-blue::after { background: var(--accent-strong); }
.accent-green::after { background: var(--accent-soft); }
.card-number { color: var(--faint); font: 0.72rem "DM Mono", monospace; letter-spacing: 0.12em; }
.icon { display: block; margin: 35px 0 14px; color: var(--accent); font-size: 1.8rem; line-height: 1; }
.accent-blue .icon { color: var(--accent-strong); }.accent-green .icon { color: var(--accent-soft); }
.tool-card h2, .panel-heading h2, .workspace-heading h2, .section-title { margin-bottom: 8px; font-size: 1.08rem; letter-spacing: -0.025em; }
.tool-card p { margin: 0; max-width: 270px; color: var(--muted); font-size: 0.83rem; line-height: 1.65; }
.card-link { margin-top: 28px; color: var(--ink); font-size: 0.75rem; font-weight: 800; }
.card-link span { color: var(--accent); font-size: 1rem; vertical-align: -1px; }
.home-note { margin-top: 30px; color: var(--faint); font-size: 0.74rem; }

.app-shell { padding: 53px 0 60px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.page-heading h1 { margin-bottom: 8px; font-size: clamp(2.35rem, 4vw, 3.65rem); }
.page-heading > div:first-child > p:last-child { margin: 0; color: var(--muted); font-size: 0.88rem; }
.utc-clock { min-width: 170px; padding: 12px 0 12px 20px; border-left: 1px solid var(--line-light); }
.utc-clock span, .impact-card span, .lock-card span { display: block; color: var(--faint); font-size: 0.66rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.utc-clock strong, .impact-card strong, .lock-card strong { display: block; margin-top: 5px; font-family: "DM Mono", monospace; font-size: 1rem; font-weight: 500; }

.app-layout { display: grid; grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.85fr); align-items: stretch; gap: 17px; }
.multi-layout { display: grid; grid-template-columns: minmax(260px, 0.74fr) minmax(0, 2fr); align-items: start; gap: 17px; }
.reinforcement-layout { display: grid; grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.85fr) minmax(220px, 0.72fr); align-items: start; gap: 17px; }
.panel, .multi-workspace, .rally-card { min-width: 0; background: linear-gradient(145deg, rgb(43 25 56 / 98%), rgb(17 10 24 / 98%)); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.panel { padding: 24px; }
.panel-heading, .workspace-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
.panel-heading h2, .workspace-heading h2 { margin: 0; }
.panel-kicker { margin-bottom: 7px; color: var(--faint); font-size: 0.61rem; }
.count { display: grid; min-width: 26px; height: 26px; padding: 0 7px; place-items: center; color: var(--accent-soft); background: rgb(168 85 247 / 14%); border: 1px solid rgb(168 85 247 / 32%); border-radius: 50%; font: 0.7rem "DM Mono", monospace; }

.listbox, input, select {
  width: 100%;
  color: var(--ink);
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: none;
}
.listbox { padding: 6px; font-size: 0.8rem; }
.listbox option { padding: 8px 9px; border-radius: 2px; }
.listbox option:checked { color: var(--canvas); background: var(--accent-strong) linear-gradient(0deg, var(--accent-strong), var(--accent-strong)); }
input, select:not(.listbox) { min-height: 38px; padding: 8px 10px; font-size: 0.8rem; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(168 85 247 / 22%); }
.input-hint { margin: 8px 0 14px; color: var(--faint); font-size: 0.68rem; line-height: 1.4; }
.preset-form { margin-top: 24px; padding-top: 21px; border-top: 1px solid var(--line); }
.preset-form h3 { margin-bottom: 15px; font-size: 0.82rem; }
.enemy-library { margin: 0; padding: 24px; border-top: 0; }
.enemy-library .compact-heading { margin-bottom: 13px; }
.enemy-library > .button { margin-top: 10px; }
.enemy-preset-form { margin-top: 19px; padding-top: 18px; border-top: 1px solid var(--line); }
label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
label input { display: block; margin-top: 6px; }

.button-row, .schedule-actions { display: flex; align-items: center; gap: 8px; }
.button {
  min-height: 37px;
  padding: 9px 12px;
  color: var(--canvas);
  background: var(--accent-strong);
  border: 1px solid var(--accent-strong);
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.015em;
  transition: filter 160ms ease, transform 160ms ease;
}
.button:hover, .icon-button:hover { filter: brightness(1.1); transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }
.button-primary { color: var(--canvas); background: var(--accent); border-color: var(--accent); }
.button-secondary { color: var(--ink); background: var(--line); border-color: var(--line-light); }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--line-light); }
.wide { width: 100%; }
.icon-button { display: grid; width: 37px; min-width: 37px; height: 37px; padding: 0; place-items: center; color: var(--muted); background: transparent; border: 1px solid var(--line-light); border-radius: 3px; font-size: 1.17rem; line-height: 1; }
.danger:hover { color: #fff; border-color: var(--danger); background: var(--danger); }

.rally-heading { align-items: center; }.compact-field { display: flex; align-items: center; gap: 9px; }.compact-field label { margin: 0; white-space: nowrap; }.unit-input { position: relative; width: 96px; }.unit-input input { padding-right: 30px; text-align: center; }.unit-input span { position: absolute; top: 11px; right: 9px; color: var(--faint); font: 0.64rem "DM Mono", monospace; pointer-events: none; }
.impact-card { margin: 14px 0 18px; padding: 20px 22px; background: linear-gradient(100deg, rgb(168 85 247 / 18%), rgb(168 85 247 / 5%)); border: 1px solid rgb(168 85 247 / 34%); border-radius: 3px; }.impact-card strong { color: var(--accent-soft); font-size: clamp(1.35rem, 2.4vw, 1.85rem); }.impact-card small { display: block; margin-top: 6px; color: var(--faint); font-size: 0.68rem; }.impact-card.classic { background: linear-gradient(100deg, rgb(43 25 56 / 86%), rgb(17 10 24 / 62%)); border-color: rgb(168 85 247 / 28%); }.impact-card.classic strong { color: var(--accent-soft); }
.schedule-actions { justify-content: flex-end; margin-bottom: 18px; }.schedule-actions .button-primary { margin-right: auto; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 3px; }
table { width: 100%; border-collapse: collapse; font-size: 0.78rem; } th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; } th { color: var(--faint); background: rgb(34 40 49 / 70%); font-size: 0.61rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; } td { color: var(--muted); } td:first-child { color: var(--ink); font-weight: 700; } td:nth-child(2), td:nth-child(3), td:nth-child(4), td:nth-child(5) { font-family: "DM Mono", monospace; font-size: 0.73rem; } th.send-time, td.send-time, th.current-utc, td.current-utc, th.countdown, td.countdown { text-align: right; } th.send-time, td.send-time { color: var(--accent-soft); } td.current-utc { color: var(--faint); } td.countdown { color: var(--ink); } tbody tr.send-now { background: color-mix(in srgb, var(--timer-warning) 12%, transparent); } tbody tr.send-now td.send-time, tbody tr.send-now td.current-utc, tbody tr.send-now td.countdown { color: var(--timer-warning); font-weight: 700; } tbody tr:last-child td { border-bottom: 0; }.empty-row td { padding: 34px 12px; color: var(--faint); text-align: center; font-family: Manrope, sans-serif; font-size: 0.74rem; font-weight: 400; }.table-remove { padding: 2px 0 2px 10px; float: right; color: var(--faint); background: none; border: 0; font-size: 1rem; line-height: 1; }.table-remove:hover { color: var(--danger); }

.status-message { min-height: 22px; margin: 12px 2px 0; color: var(--accent); font-size: 0.75rem; font-weight: 700; }.status-message.error { color: var(--danger); }.status-message.warning { color: var(--accent-strong); }

.assign-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px; align-items: center; margin-top: 13px; }.assign-row label { margin: 0; }.assign-row select { min-width: 0; }
.multi-workspace { padding: 24px; }.workspace-heading { align-items: center; }.workspace-heading .schedule-actions { margin: 0; }.rally-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }.rally-card { min-width: 0; padding: 16px; }.rally-card h3 { margin: 0; font-size: 0.88rem; }.rally-card .card-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-bottom: 13px; }.delay-control { display: flex; align-items: center; gap: 5px; color: var(--faint); font-size: 0.62rem; font-weight: 700; }.delay-control input { width: 50px; min-height: 29px; padding: 4px; text-align: center; font-size: 0.7rem; }.rally-card ul { min-height: 153px; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }.rally-card li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.7rem; }.rally-card li strong { display: block; overflow: hidden; color: var(--ink); font-size: 0.74rem; text-overflow: ellipsis; white-space: nowrap; }.rally-card .call { color: var(--accent); font: 0.63rem "DM Mono", monospace; white-space: nowrap; }.rally-card .remove-player { color: var(--faint); background: transparent; border: 0; font-size: 0.84rem; }.rally-card .remove-player:hover { color: var(--danger); }.rally-card .empty-card { display: grid; height: 153px; place-items: center; color: var(--faint); font-size: 0.68rem; text-align: center; }.rally-card .impact-line { margin-top: 12px; color: var(--faint); font-size: 0.64rem; }.rally-card .impact-line strong { display: block; margin-top: 3px; color: var(--accent-strong); font: 0.69rem "DM Mono", monospace; }

.reinforcement-panel .panel-heading { margin-bottom: 14px; }.lock-card { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px; background: var(--panel-deep); border: 1px solid var(--line); border-radius: 3px; }.lock-card strong { color: var(--accent); font-size: 0.87rem; }.enemy-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; margin: 18px 0; }.enemy-inputs label { margin: 0; }.section-title { margin: 0; }.table-current-time { margin-left: auto; padding: 0 15px; border-right: 1px solid var(--line); color: var(--faint); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }.table-current-time strong { display: block; margin-top: 4px; color: var(--accent-soft); font: 0.76rem "DM Mono", monospace; letter-spacing: 0; text-transform: none; }.reinforcement-panel .schedule-actions .button-secondary { margin-left: 0; }
.how-to-use { margin-top: 18px; background: rgb(34 40 49 / 45%); border: 1px solid var(--line); border-radius: 3px; }.how-to-use summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; color: var(--ink); cursor: pointer; font-size: 0.78rem; font-weight: 800; list-style: none; }.how-to-use summary::-webkit-details-marker { display: none; }.how-to-use summary::after { color: var(--accent); content: "+"; font-size: 1.1rem; }.how-to-use[open] summary::after { content: "–"; }.how-to-use summary small { margin-left: auto; color: var(--faint); font-size: 0.64rem; font-weight: 600; }.how-to-use-content { padding: 0 16px 16px; border-top: 1px solid var(--line); }.how-to-steps { display: grid; gap: 10px; margin: 15px 0 0; padding-left: 20px; color: var(--muted); font-size: 0.75rem; line-height: 1.45; }.how-to-steps strong { color: var(--ink); }

th { background: rgb(17 10 24 / 82%); }
.how-to-use { background: rgb(17 10 24 / 64%); }

.collapse-toggle {
  min-height: 30px;
  margin-left: auto;
  padding: 5px 10px;
  color: var(--accent-soft);
  background: rgb(168 85 247 / 12%);
  border: 1px solid rgb(168 85 247 / 34%);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.collapse-toggle:hover { background: rgb(168 85 247 / 22%); }
.collapsible-area.is-collapsed > :not(.panel-heading):not(.workspace-heading) { display: none; }
.collapsible-area.is-collapsed > .panel-heading,
.collapsible-area.is-collapsed > .workspace-heading { margin-bottom: 0; }

.launch-screen {
  display: grid;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgb(126 34 206 / 45%), transparent 21rem),
    linear-gradient(150deg, #09060d, #1d0d29 58%, #09060d);
  place-items: center;
}

.launch-content { padding: 32px; text-align: center; animation: launch-rise 700ms ease-out both; }
.ralliance-launch { position: relative; width: 100%; height: 100%; padding: 0; overflow: hidden; }
.ralliance-launch-art { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.launch-app-icon {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto 28px;
  object-fit: cover;
  border-radius: 28px;
  box-shadow: 0 18px 58px rgb(168 85 247 / 52%);
}
.launch-content h1 { margin: 0; font-size: clamp(2.9rem, 13vw, 5rem); line-height: 0.92; }
@keyframes launch-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

.site-header { display: none; }
body:not(.launch-screen) { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.home-shell { padding-top: clamp(34px, 7vw, 70px); }

.apk-tool-grid {
  gap: clamp(22px, 4vw, 38px);
  padding: clamp(28px, 5vw, 58px);
  background:
    radial-gradient(circle at 15% 20%, rgb(168 85 247 / 68%), transparent 14rem),
    radial-gradient(circle at 85% 80%, rgb(109 40 217 / 72%), transparent 16rem),
    linear-gradient(145deg, #4c1d95, #7c3aed 48%, #2e1065);
  border: 1px solid rgb(216 180 254 / 24%);
  border-radius: 28px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 16%), 0 28px 70px rgb(76 29 149 / 42%);
}

.apk-tool-grid .tool-card {
  min-height: 205px;
  align-items: center;
  padding: 26px 22px;
  justify-content: center;
  color: #63ffc6;
  background: linear-gradient(150deg, #19191d, #09090b);
  border: 1px solid rgb(99 255 198 / 10%);
  border-radius: 22px;
  box-shadow: 0 22px 38px rgb(10 4 18 / 50%);
  text-align: center;
}
.apk-tool-grid .tool-card:nth-child(1) { transform: rotate(-2.2deg); }
.apk-tool-grid .tool-card:nth-child(2) { transform: rotate(1.5deg); }
.apk-tool-grid .tool-card:nth-child(3) { transform: rotate(-1.2deg); }
.apk-tool-grid .tool-card:hover { border-color: rgb(99 255 198 / 38%); transform: translateY(-5px) rotate(0); }
.apk-tool-grid .tool-card::after { display: none; }
.apk-tool-grid .card-number { position: absolute; top: 18px; left: 20px; color: rgb(99 255 198 / 42%); }
.apk-tool-grid .icon { margin: 0 0 16px; color: #63ffc6; font-size: 1.65rem; font-weight: 900; text-shadow: 0 0 18px rgb(99 255 198 / 32%); }
.apk-tool-grid .accent-blue .icon,
.apk-tool-grid .accent-green .icon { color: #63ffc6; }
.apk-tool-grid .tool-card h2 { margin: 0; color: #63ffc6; font-size: 1rem; }
.apk-tool-grid .tool-card p { max-width: 230px; margin-top: 11px; color: #b6ddce; font-size: 0.72rem; line-height: 1.45; }
.apk-tool-grid .card-link { margin-top: 18px; color: #63ffc6; font-size: 0.68rem; }

.phone-navigation {
  position: fixed;
  right: 14px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: 66px;
  padding: 7px;
  background: rgb(15 9 20 / 96%);
  border: 1px solid rgb(168 85 247 / 28%);
  border-radius: 22px;
  box-shadow: 0 16px 44px rgb(0 0 0 / 58%);
  backdrop-filter: blur(18px);
}
.phone-navigation.tools-only-navigation { grid-template-columns: repeat(3, 1fr); }
.phone-nav-item {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  flex-direction: column;
  color: var(--faint);
  background: transparent;
  border: 0;
  border-radius: 16px;
  font-size: 0.59rem;
  font-weight: 800;
  text-decoration: none;
}
.phone-nav-item.active,
.phone-nav-item:hover { color: #63ffc6; background: rgb(99 255 198 / 9%); }
.phone-nav-icon { font-size: 1.2rem; line-height: 1; }
.phone-nav-icon svg { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ralliance-shared-header .preview-home-brand { color: var(--ink); }
.ralliance-shared-header .preview-home-brand > strong { font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; font-size: 1rem; }

.app-toast {
  position: fixed;
  bottom: calc(92px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 60;
  padding: 10px 15px;
  color: #63ffc6;
  background: #151018;
  border: 1px solid rgb(99 255 198 / 24%);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 0.72rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
  white-space: nowrap;
}
.app-toast.show { opacity: 1; transform: translate(-50%, 0); }

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  padding: 18px 18px calc(88px + env(safe-area-inset-bottom));
  place-items: end center;
  background: rgb(4 2 7 / 76%);
  backdrop-filter: blur(8px);
}
.settings-overlay[hidden] { display: none; }
.settings-page {
  position: relative;
  display: block;
  width: min(920px, calc(100% - 24px));
  min-height: calc(100dvh - 90px - env(safe-area-inset-bottom));
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 0 calc(88px + env(safe-area-inset-bottom));
}
.settings-page .settings-sheet { width: 100%; max-height: none; overflow: visible; }
.settings-page .settings-header { position: relative; }
.settings-page .settings-close { display: none; }
.account-page { min-height: 100dvh; background: radial-gradient(circle at 72% -8%, rgb(124 58 237 / 22%), transparent 36rem), #09060d; }
.account-welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  padding: 22px;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 24%, rgb(126 34 206 / 58%), transparent 19rem),
    rgb(7 4 11 / 94%);
  place-items: center;
  backdrop-filter: blur(14px);
}
.account-welcome {
  width: min(430px, 100%);
  padding: 30px;
  color: var(--ink);
  background: linear-gradient(155deg, #251632, #100917 72%);
  border: 1px solid rgb(168 85 247 / 46%);
  border-radius: 26px;
  box-shadow: 0 30px 90px rgb(0 0 0 / 75%);
  text-align: center;
}
.account-welcome-icon { width: 82px; height: 82px; margin-bottom: 20px; object-fit: cover; border-radius: 21px; box-shadow: 0 14px 38px rgb(168 85 247 / 42%); }
.account-eyebrow { color: #63ffc6; font-size: 0.58rem; font-weight: 900; letter-spacing: 0.17em; }
.account-welcome h2 { margin: 9px 0 12px; font-size: 1.55rem; line-height: 1.15; }
.account-welcome > p { margin: 0 auto 21px; color: var(--muted); font-size: 0.75rem; line-height: 1.55; }
.account-google-button { width: 100%; min-height: 48px; color: #202124; background: #fff; border-color: #dadce0; }
.account-google-button:hover { color: #202124; background: #f7f8f8; border-color: #fff; }
.account-google-button > span { display: inline-grid; width: 22px; height: 22px; margin-right: 8px; color: #4285f4; border: 1px solid #dadce0; border-radius: 50%; font-family: Arial, sans-serif; font-size: 0.76rem; place-items: center; }
.account-offline-button { width: 100%; min-height: 44px; margin-top: 9px; }
.account-welcome .account-welcome-status { min-height: 20px; margin: 13px 0 0; color: var(--success); }
.account-welcome .account-welcome-status.error { color: var(--danger); }
.first-setup-open { overflow: hidden; }
.first-setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 8%, rgb(126 34 206 / 48%), transparent 23rem),
    radial-gradient(circle at 88% 92%, rgb(99 255 198 / 12%), transparent 22rem),
    rgb(7 4 11 / 97%);
  place-items: center;
  backdrop-filter: blur(15px);
}
.first-setup {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(610px, 100%);
  max-height: calc(100dvh - max(28px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  overflow: hidden;
  color: var(--ink);
  background: linear-gradient(155deg, rgb(39 23 53 / 99%), rgb(15 8 22 / 99%) 72%);
  border: 1px solid rgb(168 85 247 / 48%);
  border-radius: 27px;
  box-shadow: 0 32px 100px rgb(0 0 0 / 78%), 0 0 44px rgb(168 85 247 / 13%);
}
.first-setup-header {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: rgb(24 14 34 / 96%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.first-setup-brand { display: flex; min-width: 0; align-items: center; gap: 11px; }
.first-setup-brand img { width: 42px; height: 42px; border-radius: 12px; box-shadow: 0 8px 24px rgb(168 85 247 / 36%); }
.first-setup-brand div { display: grid; min-width: 0; gap: 2px; }
.first-setup-brand span, .first-setup-kicker { color: #63ffc6; font-size: 0.56rem; font-weight: 900; letter-spacing: 0.17em; }
.first-setup-brand strong { overflow: hidden; font-size: 0.92rem; text-overflow: ellipsis; white-space: nowrap; }
.first-setup-progress { flex: 0 0 auto; padding: 7px 10px; color: var(--accent-soft); background: rgb(168 85 247 / 12%); border: 1px solid rgb(168 85 247 / 28%); border-radius: 999px; font-size: 0.68rem; font-weight: 900; }
.first-setup-body { min-height: 0; padding: 27px 27px 18px; overflow: hidden auto; overscroll-behavior: contain; }
.first-setup-step[hidden] { display: none; }
.first-setup-step > h2 { margin: 7px 0 9px; font-size: clamp(1.55rem, 5vw, 2.05rem); line-height: 1.1; }
.first-setup-step > p { max-width: 500px; margin: 0 0 20px; color: var(--muted); font-size: 0.83rem; line-height: 1.55; }
.first-setup-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.first-setup-choice {
  display: grid;
  min-width: 0;
  padding: 14px;
  gap: 4px;
  color: var(--muted);
  background: rgb(10 6 15 / 74%);
  border: 1px solid var(--line);
  border-radius: 17px;
  cursor: pointer;
}
.first-setup-choice:has(input:checked) { color: var(--ink); border-color: #63ffc6; box-shadow: inset 0 0 0 1px rgb(99 255 198 / 17%); }
.first-setup-choice > input, .first-setup-segments input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.first-setup-choice > strong { margin-top: 7px; font-size: 0.9rem; }
.first-setup-choice > small { color: var(--faint); font-size: 0.66rem; }
.first-setup-layout-preview { display: grid; height: 91px; padding: 8px; gap: 6px; background: #09060d; border: 1px solid rgb(255 255 255 / 8%); border-radius: 11px; }
.first-setup-layout-preview.grid { grid-template-columns: 1fr 1fr; }
.first-setup-layout-preview.list { grid-template-columns: 1fr; }
.first-setup-layout-preview i { display: block; background: linear-gradient(135deg, rgb(168 85 247 / 43%), rgb(99 255 198 / 12%)); border: 1px solid rgb(168 85 247 / 34%); border-radius: 6px; }
.first-setup-choice:has(input:checked) .first-setup-layout-preview i { border-color: rgb(99 255 198 / 55%); }
.first-setup-fieldset { min-width: 0; margin: 18px 0 0; padding: 0; border: 0; }
.first-setup-fieldset legend, .first-setup-select > span { margin-bottom: 8px; color: var(--muted); font-size: 0.7rem; font-weight: 900; }
.first-setup-segments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 5px; background: #0b0710; border: 1px solid var(--line); border-radius: 14px; }
.first-setup-segments label { min-width: 0; cursor: pointer; }
.first-setup-segments span { display: grid; min-height: 42px; padding: 0 5px; color: var(--muted); border: 1px solid transparent; border-radius: 9px; font-size: 0.76rem; font-weight: 900; place-items: center; }
.first-setup-segments input:checked + span { color: #07120e; background: #63ffc6; border-color: #8effd6; }
.first-setup-segments .setup-text-small { font-size: 0.66rem; }
.first-setup-segments .setup-text-medium { font-size: 0.78rem; }
.first-setup-segments .setup-text-large { font-size: 0.92rem; }
.first-setup-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; background: rgb(10 6 15 / 72%); border: 1px solid var(--line); border-radius: 15px; cursor: pointer; }
.first-setup-toggle > span { display: grid; gap: 4px; }
.first-setup-toggle strong { font-size: 0.82rem; }
.first-setup-toggle small { color: var(--faint); font-size: 0.65rem; line-height: 1.35; }
.first-setup-toggle > input { position: absolute; opacity: 0; }
.first-setup-toggle > i { position: relative; flex: 0 0 auto; width: 45px; height: 25px; background: #30223a; border: 1px solid var(--line-light); border-radius: 999px; transition: 150ms ease; }
.first-setup-toggle > i::after { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; content: ""; background: var(--muted); border-radius: 50%; transition: 150ms ease; }
.first-setup-toggle > input:checked + i { background: rgb(99 255 198 / 27%); border-color: #63ffc6; }
.first-setup-toggle > input:checked + i::after { background: #63ffc6; transform: translateX(20px); }
.first-floating-options { transition: opacity 150ms ease; }
.first-floating-options.disabled { opacity: 0.35; pointer-events: none; }
.first-setup-select { display: grid; margin: 15px 0; }
.first-setup-select select { width: 100%; min-height: 47px; padding: 0 12px; color: var(--ink); background: #0b0710; border: 1px solid var(--line); border-radius: 12px; }
.first-setup-toggle.compact { padding: 12px 14px; }
.first-floating-preview { position: relative; height: 105px; margin-top: 16px; overflow: hidden; background: radial-gradient(circle, rgb(168 85 247 / 12%), transparent 65%), #09060d; border: 1px dashed var(--line-light); border-radius: 16px; transition: opacity 150ms ease; }
.first-floating-preview.disabled { opacity: 0.3; }
.first-floating-preview > div { position: absolute; top: 50%; left: 50%; display: grid; width: 105px; min-height: 67px; padding: 8px; background: linear-gradient(145deg, #211630, #0e0915); border: 1px solid #a855f7; border-radius: 16px 7px 16px 7px; box-shadow: 0 10px 25px rgb(0 0 0 / 55%); place-items: center; transform: translate(-50%, -50%); }
.first-floating-preview > div small { color: var(--accent-soft); font-size: 0.48rem; font-weight: 900; letter-spacing: 0.08em; }
.first-floating-preview > div strong { display: grid; min-height: 35px; color: #63ffc6; font: 900 1.1rem monospace; place-items: center; }
.first-floating-preview[data-size="small"] > div { scale: 0.82; }
.first-floating-preview[data-size="large"] > div { scale: 1.13; }
.first-floating-preview[data-position$="left"] > div { left: 21%; }
.first-floating-preview[data-position$="right"] > div { left: 79%; }
.first-floating-preview[data-position^="top"] > div { top: 38%; }
.first-floating-preview[data-position^="bottom"] > div { top: 62%; }
.first-setup-paths { display: grid; gap: 11px; }
.first-setup-path { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 13px 15px; color: var(--ink); background: rgb(10 6 15 / 74%); border: 1px solid var(--line); border-radius: 17px; text-align: left; }
.first-setup-path:hover, .first-setup-path:focus-visible { border-color: #63ffc6; }
.first-setup-path > span { display: grid; width: 42px; height: 42px; color: #07120e; background: #63ffc6; border-radius: 12px; font-weight: 900; place-items: center; }
.first-setup-path.shared > span { color: #4285f4; background: #fff; }
.first-setup-path > div { display: grid; gap: 4px; }
.first-setup-path strong { font-size: 0.88rem; }
.first-setup-path small { color: var(--faint); font-size: 0.67rem; line-height: 1.35; }
.first-setup-path > b { color: var(--accent-soft); font-size: 1.2rem; }
.first-setup-name-panel[hidden], [data-first-setup-path-panel][hidden] { display: none; }
.first-setup-name-panel > h2 { margin: 7px 0 9px; font-size: clamp(1.55rem, 5vw, 2.05rem); line-height: 1.1; }
.first-setup-name-panel > p { max-width: 500px; margin: 0 0 20px; color: var(--muted); font-size: 0.83rem; line-height: 1.55; }
.first-setup-name-field { display: grid; gap: 8px; }
.first-setup-name-field > span { color: var(--muted); font-size: 0.7rem; font-weight: 900; }
.first-setup-name-field > input { width: 100%; min-height: 49px; padding: 0 13px; color: var(--ink); background: #0b0710; border: 1px solid var(--line); border-radius: 12px; font: inherit; }
.first-setup-name-field > input:focus { border-color: #63ffc6; outline: 2px solid rgb(99 255 198 / 15%); }
.first-setup-name-actions { display: flex; gap: 9px; margin-top: 14px; }
.first-setup-name-actions .button { flex: 1; }
.first-setup-status { min-height: 20px; margin: 13px 0 4px !important; color: var(--success) !important; text-align: center; }
.first-setup-status.error { color: var(--danger) !important; }
.first-setup-footnote { display: block; color: var(--faint); font-size: 0.63rem; text-align: center; }
.first-setup-actions { z-index: 2; display: flex; justify-content: flex-end; gap: 9px; padding: 15px 22px; background: rgb(24 14 34 / 96%); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
.first-setup-actions .button { min-width: 112px; }
.settings-sheet {
  width: min(720px, 100%);
  max-height: min(760px, calc(100dvh - 118px - env(safe-area-inset-bottom)));
  overflow: hidden auto;
  color: var(--ink);
  background: linear-gradient(155deg, #21152c, #100917);
  border: 1px solid rgb(168 85 247 / 42%);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgb(0 0 0 / 72%);
}
.settings-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  background: rgb(22 14 31 / 96%);
  border-bottom: 1px solid var(--line);
}
.settings-header span { color: #63ffc6; font-size: 0.57rem; font-weight: 900; letter-spacing: 0.18em; }
.settings-header h2 { margin: 4px 0 0; font-size: 1.45rem; }
.settings-close {
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--muted);
  background: rgb(255 255 255 / 5%);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.35rem;
}
.settings-content { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 16px; }
.settings-group { padding: 17px; background: rgb(9 6 13 / 58%); border: 1px solid var(--line); border-radius: 17px; }
.settings-group.settings-wide { grid-column: 1 / -1; }
.settings-group h3 { margin: 0 0 15px; color: var(--accent-soft); font-size: 0.8rem; letter-spacing: 0.04em; }
.account-profile { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 13px 15px; align-items: center; }
.account-profile[hidden],
[data-account-signed-out][hidden] { display: none !important; }
.account-avatar { display: grid; width: 64px; height: 64px; overflow: hidden; color: #09060d; background: linear-gradient(145deg, #63ffc6, #a855f7); border: 2px solid rgb(99 255 198 / 42%); border-radius: 50%; font-size: 1.05rem; font-weight: 900; place-items: center; }
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-profile-copy { display: grid; min-width: 0; gap: 2px; }
.account-profile-copy strong { overflow: hidden; color: var(--ink); font-size: 0.92rem; text-overflow: ellipsis; white-space: nowrap; }
.account-profile-copy small { overflow: hidden; color: var(--muted); font-size: 0.66rem; text-overflow: ellipsis; white-space: nowrap; }
.account-profile-copy span { color: #63ffc6; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.profile-identity-row { display: flex; grid-column: 1 / -1; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid rgb(101 71 117 / 45%); }
.profile-identity-row span { color: var(--faint); font-size: 0.66rem; font-weight: 800; }
.profile-identity-row strong { color: var(--success); font-size: 0.78rem; }
.account-name-control { grid-column: 1 / -1; width: 100%; }
.account-actions { grid-column: 1 / -1; }
.account-existing-note { display: block; margin-top: 10px; color: var(--faint); font-size: 0.62rem; line-height: 1.45; }
.account-discord-button { width: 100%; min-height: 48px; margin-top: 10px; color: #fff; background: #5865f2; border-color: #5865f2; }
.account-discord-button:hover { color: #fff; background: #4752c4; border-color: #8891ff; }
.account-discord-button > span { display: inline-grid; width: 22px; height: 22px; margin-right: 8px; font-weight: 900; place-items: center; }
.first-setup-path.discord > span { color: #fff; background: #5865f2; }
.account-connections { display: grid; grid-column: 1 / -1; gap: 8px; width: 100%; margin-top: 3px; padding: 13px; background: rgb(255 255 255 / 3%); border: 1px solid var(--line); border-radius: 13px; }
.account-connections > strong { margin-bottom: 2px; color: var(--muted); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; }
.account-connection-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 42px; }
.account-connection-row > div { display: grid; gap: 2px; }
.account-connection-row b { color: var(--ink); font-size: 0.72rem; }
.account-connection-row small { color: var(--faint); font-size: 0.62rem; }
.account-connection-row small[data-connected="true"] { color: var(--success); }
.account-provider-mark { display: grid; width: 30px; height: 30px; color: #fff; border-radius: 9px; font-size: 0.72rem; font-weight: 900; place-items: center; }
.account-provider-mark.google { color: #4285f4; background: #fff; }
.account-provider-mark.discord { background: #5865f2; }
.account-connection-row .button { min-height: 34px; padding: 7px 11px; }
.account-sync-placeholder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 0.7fr) auto; align-items: end; gap: 13px; margin-top: 15px; padding-top: 14px; border-top: 1px solid rgb(101 71 117 / 45%); }
.account-sync-placeholder > div { display: grid; gap: 3px; }
.account-sync-placeholder strong { color: var(--ink); font-size: 0.72rem; }
.account-sync-placeholder small { color: var(--faint); font-size: 0.62rem; }
.account-sync-placeholder .button { min-height: 44px; white-space: nowrap; }
.account-sync-placeholder .button:disabled { opacity: 0.52; cursor: default; }
.account-deletion { display: flex; align-items: center; justify-content: space-between; gap: 13px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgb(101 71 117 / 45%); }
.account-deletion > div { display: grid; gap: 3px; }
.account-deletion strong { color: var(--ink); font-size: 0.72rem; }
.account-deletion small { color: var(--faint); font-size: 0.62rem; line-height: 1.4; }
.account-deletion .button { min-height: 38px; white-space: nowrap; }
.settings-control,
.settings-toggle { margin: 0; padding: 12px 0; border-top: 1px solid rgb(101 71 117 / 45%); }
.settings-control:first-of-type { border-top: 0; }
.settings-control > span,
.settings-toggle > span { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.settings-control strong,
.settings-toggle strong { color: var(--ink); font-size: 0.72rem; }
.settings-control small,
.settings-toggle small,
.settings-control output { color: var(--faint); font-size: 0.62rem; font-weight: 700; }
.settings-control input[type="range"] { width: 100%; min-height: 32px; padding: 0; accent-color: #a855f7; }
.settings-control select { width: 100%; min-height: 42px; color: var(--ink); background: #17101f; border: 1px solid var(--line-light); border-radius: 10px; }
.settings-number { width: 100%; min-height: 42px; color: var(--ink); background: #17101f; border: 1px solid var(--line-light); border-radius: 10px; }
.settings-toggle { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.settings-toggle > span { display: grid; justify-content: start; margin: 0; }
.settings-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.settings-toggle i { position: relative; width: 46px; height: 26px; flex: 0 0 auto; background: #34243f; border: 1px solid var(--line-light); border-radius: 999px; transition: background 160ms ease; }
.settings-toggle i::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: var(--muted); border-radius: 50%; content: ""; transition: transform 160ms ease; }
.settings-toggle input:checked + i { background: #6d28d9; }
.settings-toggle input:checked + i::after { background: #63ffc6; transform: translateX(20px); }
.settings-help { margin: 0 0 12px; color: var(--faint); font-size: 0.68rem; line-height: 1.5; }
.settings-backup { width: 100%; min-height: 86px; padding: 11px; resize: vertical; color: #b6ddce; background: #09060d; border: 1px solid var(--line); border-radius: 10px; font: 0.63rem/1.45 monospace; }
.settings-actions { display: flex; gap: 9px; margin-top: 10px; }
.settings-actions .button { min-height: 40px; }
.settings-message { min-height: 18px; margin: 9px 0 0; color: var(--success); font-size: 0.66rem; }
.settings-message.error { color: var(--danger); }
.settings-test { width: 100%; margin-top: 12px; }
.settings-info-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 11px 0; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 0.72rem; }
.settings-info-row strong { color: #63ffc6; }
.settings-instructions { margin-top: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; }
.settings-instructions summary { padding: 12px; color: var(--ink); cursor: pointer; font-size: 0.72rem; font-weight: 800; }
.settings-instructions ol { margin: 0; padding: 0 26px 14px 38px; font-size: 0.68rem; line-height: 1.6; }
.settings-privacy { margin-top: 12px; padding: 12px; color: var(--muted); background: rgb(99 255 198 / 5%); border-radius: 10px; font-size: 0.68rem; line-height: 1.5; }
.settings-privacy strong { color: #63ffc6; }
.settings-privacy p { margin: 5px 0 0; }
.settings-group.settings-privacy-section {
  grid-column: 1 / -1 !important;
  width: 100%;
  max-width: none;
  color: var(--muted);
  background: rgb(99 255 198 / 5%);
}
.settings-privacy-section p { width: 100%; max-width: none; margin: 0; font-size: 0.68rem; line-height: 1.55; }
.settings-group.settings-feedback {
  background: linear-gradient(125deg, rgb(88 101 242 / 13%), rgb(9 7 17 / 78%));
  border-color: rgb(126 138 255 / 30%);
}
.settings-feedback-copy { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.settings-feedback-copy h3 { margin-bottom: 7px; color: #b9c0ff; }
.settings-feedback-copy p { max-width: 34rem; margin: 0; color: var(--muted); font-size: 0.7rem; line-height: 1.5; }
.settings-feedback-copy > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: #5865f2;
  border-radius: 13px 7px 13px 7px;
  font: 900 1.1rem/1 "Segoe UI", sans-serif;
  box-shadow: 0 8px 24px rgb(88 101 242 / 28%);
}
.settings-feedback .discord-feedback-button {
  width: 100%;
  margin-top: 14px;
  color: #fff;
  background: #5865f2;
  border-color: #7e8aff;
}
.settings-feedback .discord-feedback-button:hover,
.settings-feedback .discord-feedback-button:active { color: #fff; background: #6975f5; border-color: #9ca5ff; }

@media (max-width: 760px) {
  .home-shell { padding-top: 34px; }
  .apk-tool-grid {
    grid-template-rows: repeat(3, minmax(0, 1fr));
    min-height: calc(100dvh - 122px - env(safe-area-inset-bottom));
    padding: 34px 24px;
  }
  .apk-tool-grid .tool-card {
    width: min(88%, 330px);
    min-height: 170px;
    height: 100%;
    margin: 0 auto;
  }
  .settings-content { grid-template-columns: 1fr; }
  .settings-group.settings-wide { grid-column: auto; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1040px) { .reinforcement-layout { grid-template-columns: 280px minmax(0, 1fr); }.enemy-panel { grid-column: 1 / -1; } }
@media (max-width: 960px) { .app-layout, .multi-layout { grid-template-columns: 280px minmax(0, 1fr); }.rally-grid { grid-template-columns: 1fr; }.rally-card ul, .rally-card .empty-card { min-height: 92px; }.rally-card .empty-card { height: 92px; } }
@media (max-width: 760px) { .site-header { width: min(100% - 28px, 600px); min-height: 0; padding: 14px 0 0; flex-direction: column; align-items: flex-start; gap: 11px; }.nav { width: 100%; overflow-x: auto; align-self: auto; }.nav a { min-height: 38px; padding: 0 9px; font-size: 0.7rem; white-space: nowrap; }.home-shell, .app-shell { width: min(100% - 28px, 600px); }.home-shell { padding-top: 75px; }.tool-grid, .app-layout, .multi-layout, .reinforcement-layout { grid-template-columns: minmax(0, 1fr); }.tool-card { min-height: 225px; }.page-heading { align-items: start; flex-direction: column; margin-bottom: 22px; }.utc-clock { padding: 8px 0 8px 14px; }.panel, .multi-workspace, .enemy-library { max-width: 100%; padding: 18px; }.panel-heading { flex-wrap: wrap; }.compact-field { margin-left: auto; }.preset-panel { order: 2; }.rally-panel { order: 1; }.enemy-panel { grid-column: auto; order: 3; }.workspace-heading { align-items: start; flex-direction: column; }.schedule-actions { flex-wrap: wrap; justify-content: start; }.schedule-actions .button-primary { margin-right: 0; }.table-current-time { order: 3; width: 100%; margin-left: 0; padding: 10px 0 0; border-top: 1px solid var(--line); border-right: 0; }.enemy-inputs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }.enemy-inputs .button { grid-column: 1 / -1; }.lock-card { align-items: start; flex-direction: column; }.button-row { flex-wrap: wrap; } }
@media (max-width: 430px) { h1 { font-size: 2.55rem; }.page-heading h1 { font-size: 2.3rem; }.panel-heading.rally-heading { align-items: start; flex-direction: column; }.enemy-inputs { grid-template-columns: 1fr; }.table-wrap { margin: 0 -3px; }.schedule-actions .button { width: 100%; }.compact-field { width: 100%; justify-content: space-between; }.impact-card { padding: 16px; } }
@media (max-width: 760px) { .home-shell { padding-top: 34px; } }

@media (max-width: 560px) {
  .app-shell,
  .home-shell { width: min(100% - 20px, 600px); }

  .app-shell { padding-top: 26px; }
  .panel,
  .multi-workspace,
  .enemy-library { padding: 15px; }

  .button,
  .icon-button,
  input,
  select:not(.listbox) { min-height: 44px; }

  .phone-navigation {
    right: 7px;
    bottom: calc(6px + env(safe-area-inset-bottom));
    left: 7px;
    min-height: 62px;
    padding: 5px;
    border-radius: 20px;
  }
  .phone-nav-item { min-height: 50px; padding: 5px 2px; font-size: 0.55rem; }

  .settings-overlay { padding: 8px 8px calc(78px + env(safe-area-inset-bottom)); }
  .settings-sheet {
    max-height: calc(100dvh - 94px - env(safe-area-inset-bottom));
    border-radius: 18px;
  }
  .settings-header { padding: 15px 16px 12px; }
  .settings-header h2 { font-size: 1.2rem; }
  .settings-content { gap: 10px; padding: 10px; }
  .settings-group { padding: 14px; border-radius: 14px; }
  .settings-actions { flex-direction: column; }
  .settings-actions .button { width: 100%; }
  .account-welcome-overlay { padding: 12px; }
  .account-welcome { padding: 25px 20px; border-radius: 21px; }
  .first-setup-overlay { padding: max(7px, env(safe-area-inset-top)) 7px max(7px, env(safe-area-inset-bottom)); place-items: stretch center; }
  .first-setup { max-height: calc(100dvh - max(14px, env(safe-area-inset-top) + env(safe-area-inset-bottom))); border-radius: 21px; }
  .first-setup-header { padding: 13px 14px; }
  .first-setup-brand img { width: 36px; height: 36px; }
  .first-setup-brand strong { font-size: 0.8rem; }
  .first-setup-progress { padding: 6px 8px; font-size: 0.6rem; }
  .first-setup-body { min-height: 0; padding: 21px 15px 14px; }
  .first-setup-choice { padding: 10px; }
  .first-setup-layout-preview { height: 73px; }
  .first-setup-actions { padding: 11px 14px; }
  .first-setup-actions .button { flex: 1; min-width: 0; }
  .first-setup-name-actions { display: grid; }
  .account-sync-placeholder { align-items: stretch; grid-template-columns: 1fr; }
  .account-sync-placeholder .button { width: 100%; }
  .account-deletion { align-items: stretch; flex-direction: column; }
  .account-deletion .button { width: 100%; }

  .table-wrap { overflow: visible; border: 0; }
  .table-wrap table,
  .table-wrap tbody { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: grid; gap: 10px; }
  .table-wrap tbody tr:not(.empty-row) {
    display: block;
    overflow: hidden;
    background: rgb(17 10 24 / 72%);
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  .table-wrap tbody tr.send-now { border-color: var(--timer-warning); }
  .table-wrap tbody tr:not(.empty-row) td {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    padding: 9px 11px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    overflow-wrap: anywhere;
  }
  .table-wrap tbody tr:not(.empty-row) td::before {
    margin-right: auto;
    color: var(--faint);
    content: attr(data-label);
    font-family: Arial, sans-serif;
    font-size: 0.59rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
  }
  .table-wrap tbody tr:not(.empty-row) td:last-child { border-bottom: 0; }
  .table-wrap tbody tr:not(.empty-row) td[data-mobile-action] { padding: 6px 9px; }
  .table-wrap tbody tr:not(.empty-row) td[data-mobile-action]::before { display: none; }
  .table-wrap .table-player { margin-left: auto; }
  .table-wrap .table-remove {
    min-height: 36px;
    margin-left: 7px;
    padding: 5px 8px;
    float: none;
    border: 1px solid var(--line);
    border-radius: 7px;
  }
  .table-wrap td[data-mobile-action] .table-remove { width: 100%; margin: 0; }
  .table-wrap .empty-row {
    display: block;
    border: 1px dashed var(--line);
    border-radius: 10px;
  }
  .table-wrap .empty-row td { display: block; width: 100%; padding: 24px 13px; border: 0; }
}

@media (orientation: landscape) and (max-height: 600px) {
  .first-setup-overlay { padding: max(5px, env(safe-area-inset-top)) 7px max(5px, env(safe-area-inset-bottom)); }
  .first-setup { width: min(760px, 100%); height: calc(100dvh - max(10px, env(safe-area-inset-top) + env(safe-area-inset-bottom))); max-height: none; border-radius: 17px; }
  .first-setup-header { padding: 8px 14px; }
  .first-setup-brand img { width: 30px; height: 30px; border-radius: 9px; }
  .first-setup-brand span { font-size: 0.48rem; }
  .first-setup-brand strong { font-size: 0.72rem; }
  .first-setup-progress { padding: 5px 8px; }
  .first-setup-body { padding: 11px 16px; }
  .first-setup-step > h2,
  .first-setup-name-panel > h2 { margin: 4px 0 6px; font-size: 1.25rem; }
  .first-setup-step > p,
  .first-setup-name-panel > p { margin-bottom: 10px; line-height: 1.4; }
  .first-setup-choice { padding: 8px 10px; }
  .first-setup-layout-preview { height: 45px; }
  .first-setup-fieldset { margin-top: 10px; }
  .first-floating-preview { display: none; }
  .first-setup-actions { flex-wrap: wrap; padding: 7px 14px; }
  .first-setup-actions .button { min-height: 38px; }
}

/* ================================================================
   Preview 1 integration — rally route command deck
   Visual-only overrides. Existing Android and Firebase hooks remain.
   ================================================================ */
:root {
  --canvas: #090711;
  --canvas-soft: #100d19;
  --panel: #1b1728;
  --panel-deep: #0d0c15;
  --line: rgb(255 255 255 / 10%);
  --line-light: rgb(169 121 255 / 38%);
  --ink: #f7f4ff;
  --muted: #aaa3ba;
  --faint: #81798d;
  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-soft: #a979ff;
  --success: #5ff0c5;
  --preview-gold: #f6c66b;
  --danger: #ff6b82;
  --shadow: 0 22px 60px rgb(0 0 0 / 36%);
}

html {
  background: var(--canvas);
  font-size: clamp(16px, calc(14.4px + 0.24vw), 20px);
  scrollbar-width: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar { width: 0; height: 0; }

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 72% -8%, rgb(124 58 237 / 22%), transparent 36rem),
    radial-gradient(circle at -12% 74%, rgb(95 240 197 / 7%), transparent 30rem),
    var(--canvas);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

h1,
.launch-content h1 { font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(95 240 197 / 72%);
  outline-offset: 3px;
}

/* Home command map */
.preview-home-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 18px 10px;
  background: linear-gradient(180deg, rgb(9 7 17 / 98%), rgb(9 7 17 / 84%));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.preview-home-brand { display: flex; min-width: 0; align-items: center; gap: 10px; }
.preview-home-brand img {
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid rgb(169 121 255 / 38%);
  border-radius: 13px 8px 13px 8px;
  box-shadow: 0 7px 20px rgb(0 0 0 / 30%);
}
.preview-home-brand div { min-width: 0; }
.preview-home-brand strong {
  display: block;
  overflow: hidden;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-home-brand small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font: 700 0.55rem/1 Consolas, monospace;
  letter-spacing: 0.13em;
}
.preview-home-clock {
  flex: 0 0 auto;
  padding: 7px 10px;
  background: rgb(17 16 27 / 78%);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: right;
}
.preview-home-header-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.preview-reset-ui {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  color: var(--ink);
  background: linear-gradient(145deg, rgb(43 28 59 / 88%), rgb(17 16 27 / 88%));
  border: 1px solid rgb(169 121 255 / 38%);
  border-radius: 12px;
  font: inherit;
  cursor: pointer;
}
.preview-reset-ui:hover { border-color: var(--success); }
.preview-reset-ui > span { color: var(--success); font-size: 1.1rem; line-height: 1; }
.preview-reset-ui > strong { font-size: 0.62rem; letter-spacing: 0.04em; white-space: nowrap; }
.preview-home-clock span {
  display: block;
  color: var(--faint);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.preview-home-clock strong {
  display: block;
  margin-top: 3px;
  color: var(--success);
  font: 700 0.72rem/1 Consolas, monospace;
}
.preview-home-clock small {
  display: block;
  margin-bottom: 3px;
  color: var(--faint);
  font: 700 0.5rem/1 Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.preview-home-clock > span[data-clock] {
  display: block;
  color: var(--success);
  font: 700 0.72rem/1.2 Consolas, monospace;
  letter-spacing: 0;
  text-transform: none;
}
.preview-home-shell {
  width: min(68rem, calc(100% - clamp(28px, 4vw, 68px)));
  padding: clamp(14px, 1.5vw, 24px) 0 clamp(26px, 3vw, 48px);
}
.preview-home-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 4px 13px;
  color: var(--faint);
  font: 700 0.58rem Consolas, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.preview-home-status span::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--success);
  content: "";
}
.preview-home-status small { color: var(--faint); font: inherit; }

.preview-home-shell .apk-tool-grid {
  position: relative;
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: none;
  gap: clamp(12px, 1.3vw, 22px);
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.preview-rally-route {
  position: absolute;
  inset: 7% 8%;
  z-index: 0;
  width: 84%;
  height: 86%;
  filter: drop-shadow(0 0 12px rgb(124 58 237 / 55%));
  pointer-events: none;
}
.preview-rally-route path {
  fill: none;
  stroke: url(#preview-route-gradient);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 8 13;
  animation: preview-route-flow 8s linear infinite;
}
@keyframes preview-route-flow { to { stroke-dashoffset: -84; } }

.preview-home-shell .apk-tool-grid .tool-card,
.preview-home-shell .apk-tool-grid .tool-card:nth-child(1),
.preview-home-shell .apk-tool-grid .tool-card:nth-child(2),
.preview-home-shell .apk-tool-grid .tool-card:nth-child(3),
.preview-home-shell .apk-tool-grid .tool-card:nth-child(4) {
  position: relative;
  z-index: 1;
  display: flex;
  width: auto;
  min-height: clamp(190px, 23svh, 280px);
  height: auto;
  margin: 0;
  align-items: stretch;
  justify-content: flex-start;
  padding: clamp(16px, 1.6vw, 26px);
  overflow: hidden;
  color: var(--ink);
  background: linear-gradient(148deg, rgb(31 27 47 / 97%), rgb(14 13 23 / 99%));
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 27px 13px 27px 13px;
  box-shadow: var(--shadow);
  text-align: left;
  transform: none;
  transition: transform 180ms ease, border-color 180ms ease;
}
.preview-home-shell .apk-tool-grid .tool-card:nth-of-type(3n + 2) { border-radius: 13px 27px 13px 27px; }
.preview-home-shell .apk-tool-grid .tool-card:hover,
.preview-home-shell .apk-tool-grid .tool-card:active { border-color: rgb(169 121 255 / 55%); transform: translateY(-3px); }
.preview-home-shell .apk-tool-grid .tool-card::after {
  display: block;
  position: absolute;
  top: auto;
  right: -34px;
  bottom: -34px;
  width: 90px;
  height: 90px;
  opacity: 0.22;
  clip-path: none;
  border-radius: 50%;
  filter: blur(32px);
}
.preview-home-shell .accent-orange { --tool-color: #5ff0c5; }
.preview-home-shell .accent-blue { --tool-color: #a979ff; }
.preview-home-shell .accent-green { --tool-color: #f6c66b; }
.preview-home-shell .accent-live { --tool-color: #68b5ff; }
.preview-home-shell .accent-prep { --tool-color: #ff8cc6; }
.preview-home-shell .tool-card::after { background: var(--tool-color); }
.preview-tool-top { display: flex; align-items: flex-start; justify-content: space-between; }
.preview-tool-top b { color: var(--faint); font-size: 1.05rem; font-weight: 400; transition: transform 180ms ease; }
.tool-card:hover .preview-tool-top b { color: var(--ink); transform: translate(2px, -2px); }
.preview-tool-icon {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  color: var(--tool-color);
  background: color-mix(in srgb, var(--tool-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--tool-color) 28%, transparent);
  border-radius: 15px 9px 15px 9px;
}
.preview-tool-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.preview-tool-copy { margin-top: 24px; }
.preview-home-shell .apk-tool-grid .tool-card h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: clamp(1rem, 4.4vw, 1.3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.preview-home-shell .apk-tool-grid .tool-card p {
  max-width: 18rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}
.preview-home-shell .apk-tool-grid .card-link {
  margin-top: auto;
  padding-top: 12px;
  color: var(--tool-color);
  font: 750 0.55rem Consolas, monospace;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.preview-home-shell .apk-tool-grid .card-link span { color: inherit; }
.preview-home-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 5px 0;
  color: var(--faint);
  font-size: 0.62rem;
}
.tools-discord-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  margin-top: 14px;
  padding: clamp(17px, 1.45vw, 25px);
}
.tools-discord-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  background: #5865f2;
  border-radius: 15px;
}
.tools-discord-icon img { width: 29px; height: 29px; }
.tools-discord-panel h2 { margin: 5px 0 4px; font-size: 1.08rem; }
.tools-discord-panel p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.tools-discord-button {
  display: flex;
  min-width: 160px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #fff;
  background: #5865f2;
  border-color: #7b86ff;
  text-decoration: none;
}
.tools-discord-button img { width: 19px; height: 19px; }
@media (max-width: 680px) {
  .tools-discord-panel { grid-template-columns: auto minmax(0, 1fr); padding: 18px; }
  .tools-discord-button { grid-column: 1 / -1; width: 100%; }
}

/* Tool pages */
.app-shell,
.session-shell {
  width: min(86rem, calc(100% - clamp(30px, 4vw, 72px)));
  padding: clamp(24px, 2.5vw, 42px) 0 clamp(42px, 5vw, 72px);
}
.page-heading {
  align-items: center;
  margin-bottom: 18px;
  padding: 2px;
}
.page-heading h1 {
  margin-bottom: 5px;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: clamp(1.8rem, 7vw, 3.15rem);
  letter-spacing: -0.045em;
}
.page-heading > div:first-child > p:last-child { max-width: 42rem; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.eyebrow,
.panel-kicker { color: var(--success); font: 750 0.58rem/1 Consolas, monospace; letter-spacing: 0.14em; }
.utc-clock {
  min-width: 150px;
  padding: 8px 10px;
  background: rgb(17 16 27 / 72%);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: right;
}
.utc-clock span { color: var(--faint); }
.utc-clock strong { color: var(--success); font-family: Consolas, monospace; font-size: 0.78rem; }

.panel,
.multi-workspace,
.rally-card {
  background: linear-gradient(155deg, rgb(27 23 40 / 94%), rgb(15 14 24 / 97%));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 14px 38px rgb(0 0 0 / 20%);
}
.panel,
.enemy-library { padding: clamp(17px, 1.45vw, 25px); }
.panel-heading,
.workspace-heading { margin-bottom: 14px; }
.panel-heading h2,
.workspace-heading h2,
.section-title { font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; font-size: 1.15rem; font-weight: 600; }
.count {
  min-width: 30px;
  height: 27px;
  color: var(--success);
  background: rgb(95 240 197 / 8%);
  border-color: rgb(95 240 197 / 18%);
  border-radius: 10px;
  font-family: Consolas, monospace;
}

.listbox,
input,
select,
textarea,
.session-entry-card input,
.session-self-card input,
.session-host-controls input,
.session-host-controls select,
.session-member select,
.session-member input {
  color: var(--ink);
  background: var(--panel-deep);
  border-color: rgb(255 255 255 / 12%);
  border-radius: 12px;
}
input,
select:not(.listbox) { min-height: clamp(44px, 2.8rem, 56px); padding: 0.65rem 0.72rem; }
.listbox { padding: 6px; }
.listbox option { padding: 10px 9px; border-radius: 8px; }
.listbox option:checked { color: #07110e; background: var(--success) linear-gradient(0deg, var(--success), var(--success)); }
input:focus,
select:focus,
textarea:focus { border-color: rgb(95 240 197 / 60%); box-shadow: 0 0 0 3px rgb(95 240 197 / 8%); }

.button,
.icon-button,
.danger-session,
.session-member-admin button {
  min-height: 43px;
  border-radius: 12px;
  font-weight: 800;
}
.button { color: var(--ink); background: var(--accent); border-color: var(--accent-soft); }
.button-primary { color: #07110e; background: var(--success); border-color: var(--success); }
.button-primary:hover { background: #7ff8d5; }
.button-secondary { color: var(--ink); background: var(--raised, #242035); border-color: var(--line-light); }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.icon-button { border-color: var(--line); border-radius: 12px; }

.impact-card {
  padding: 16px;
  background: linear-gradient(110deg, rgb(246 198 107 / 9%), rgb(124 58 237 / 8%));
  border-color: rgb(246 198 107 / 24%);
  border-radius: 16px;
}
.impact-card strong,
.impact-card.classic strong { color: var(--preview-gold); font-family: Consolas, monospace; font-size: clamp(1rem, 4.2vw, 1.45rem); }
.impact-card.classic { background: linear-gradient(110deg, rgb(246 198 107 / 7%), rgb(124 58 237 / 6%)); border-color: rgb(246 198 107 / 20%); }
.lock-card,
.session-tool-panel,
.session-profile-row,
.session-code-block,
.session-member,
.session-personal-countdown {
  background: rgb(9 7 17 / 54%);
  border-color: var(--line);
  border-radius: 15px;
}
.lock-card { background: rgb(124 58 237 / 10%); border-color: rgb(169 121 255 / 22%); }
.lock-card strong,
.session-lock-row strong,
.session-enemy-landing strong { color: var(--success); }

.table-wrap { border-color: var(--line); border-radius: 14px; }
th { color: var(--faint); background: rgb(9 7 17 / 62%); }
td { color: var(--muted); }
td:first-child { color: var(--ink); }
th.send-time,
td.send-time { color: var(--preview-gold); }
td.countdown { color: var(--success); }
tbody tr.send-now { background: color-mix(in srgb, var(--timer-warning) 9%, transparent); }
.table-remove { border-radius: 10px; }
.how-to-use { background: rgb(9 7 17 / 48%); border-color: var(--line); border-radius: 15px; }
.how-to-use summary { color: var(--success); }
.reinforcement-heading-side {
  width: clamp(220px, 24vw, 330px);
  flex: 0 0 auto;
}
.reinforcement-heading-side .utc-clock { width: 100%; }
.heading-how-to { width: 100%; margin-top: 9px; }
.heading-how-to summary { padding: 12px 14px; }
.heading-how-to .how-to-use-content { max-height: min(46vh, 350px); overflow-y: auto; }

/* Shared sessions */
.session-entry { gap: 14px; }
.session-room-header { border-radius: 20px; }
.session-code-block strong { color: var(--preview-gold); font-family: Consolas, monospace; }
.session-streamer-control {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  width: 100%;
  min-height: 58px;
  margin-top: 11px;
  padding: 9px;
  align-items: center;
  gap: 10px;
  color: var(--text);
  background: #161020;
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 17px 9px 17px 9px;
  cursor: pointer;
  text-align: left;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.session-streamer-control::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -1px;
  width: 3px;
  content: "";
  background: var(--preview-gold);
  border-radius: 0 3px 3px 0;
  transition: background 180ms ease, box-shadow 180ms ease;
}
.streamer-private .session-streamer-control {
  background: #10231e;
  border-color: rgb(95 240 197 / 44%);
  box-shadow: 0 0 0 3px rgb(95 240 197 / 6%);
}
.streamer-private .session-streamer-control::before {
  background: var(--success);
  box-shadow: 0 0 12px rgb(95 240 197 / 42%);
}
.session-heading .session-streamer-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--preview-gold);
  background: rgb(246 198 107 / 8%);
  border: 1px solid rgb(246 198 107 / 24%);
  border-radius: 13px 7px 13px 7px;
  letter-spacing: normal;
  text-transform: none;
}
.streamer-private .session-heading .session-streamer-icon {
  color: var(--success);
  background: rgb(95 240 197 / 8%);
  border-color: rgb(95 240 197 / 26%);
}
.session-heading .session-streamer-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.session-streamer-hidden,
.streamer-private .session-streamer-visible { display: none; }
.streamer-private .session-streamer-hidden { display: block; }
.session-heading .session-streamer-copy {
  display: block;
  min-width: 0;
  color: var(--text);
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: normal;
  text-transform: none;
}
.session-heading .session-streamer-copy b,
.session-heading .session-streamer-copy small { display: block; }
.session-heading .session-streamer-copy b { color: var(--text); font-size: 0.76rem; font-weight: 750; }
.streamer-private .session-heading .session-streamer-copy b { color: var(--success); }
.session-heading .session-streamer-copy small { margin-top: 2px; color: var(--muted); font-size: 0.64rem; font-weight: 500; line-height: 1.25; letter-spacing: normal; text-transform: none; }
.session-heading .session-streamer-check {
  position: relative;
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  color: inherit;
  font-size: inherit;
  letter-spacing: normal;
  text-transform: none;
}
.session-streamer-check input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.session-streamer-check i {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  background: #090711;
  border: 1px solid var(--line-light);
  border-radius: 7px;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.session-streamer-check input:checked + i {
  background: var(--success);
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgb(95 240 197 / 10%);
}
.session-streamer-check input:checked + i::after {
  width: 9px;
  height: 5px;
  content: "";
  border-bottom: 2px solid #07110e;
  border-left: 2px solid #07110e;
  transform: translateY(-1px) rotate(-45deg);
}
.session-streamer-control:focus-within { outline: 2px solid var(--success); outline-offset: 2px; }
.session-streamer-control:active { transform: scale(0.995); }
.session-code-block { position: relative; overflow: hidden; }
.session-code-block::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgb(95 240 197 / 13%), transparent);
  pointer-events: none;
  transform: translateX(-105%);
}
.streamer-private .session-code-block::after { animation: session-privacy-shutter 260ms ease-out; }
.streamer-private .session-code-block strong { color: var(--success); }
@keyframes session-privacy-shutter {
  from { transform: translateX(-105%); }
  to { transform: translateX(105%); }
}
@media (prefers-reduced-motion: reduce) {
  .streamer-private .session-code-block::after { animation: none; }
}
.session-personal-countdown {
  background: radial-gradient(circle at center, rgb(95 240 197 / 9%), transparent 68%), #0b0913;
}
.session-personal-countdown strong { color: var(--success); font-family: Consolas, monospace; }
.session-live-pill { border-color: var(--line); }
.session-live-pill.active { color: #07120e; background: var(--success); border-color: var(--success); }
.session-tool-panel h3 { color: var(--preview-gold); }
.session-member-assignment strong { color: var(--accent-soft); }
.account-avatar { color: #080b0f; background: linear-gradient(145deg, var(--success), var(--preview-gold)); border-color: rgb(95 240 197 / 42%); }

/* Native-style overlays, settings and bottom controls */
.phone-navigation {
  right: 9px;
  bottom: calc(7px + env(safe-area-inset-bottom));
  left: 9px;
  min-height: 64px;
  padding: 6px;
  background: rgb(10 8 17 / 96%);
  border-color: var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.phone-nav-item { min-height: 51px; color: var(--faint); border-radius: 15px; }
.phone-nav-item.active,
.phone-nav-item:hover { color: var(--success); background: rgb(95 240 197 / 7%); }
.phone-nav-icon { font-size: 1.16rem; }
.tool-minimize-action {
  position: fixed;
  right: 17px;
  bottom: calc(87px + env(safe-area-inset-bottom));
  z-index: 49;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  color: #07120e;
  background: var(--success);
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgb(0 0 0 / 46%), 0 0 20px rgb(95 240 197 / 16%);
  font: inherit;
  cursor: pointer;
}
.tool-minimize-action span { font-size: 1rem; line-height: 1; }
.tool-minimize-action strong { font-size: .64rem; letter-spacing: .04em; text-transform: uppercase; }
.tool-minimize-action:active { transform: translateY(1px); }

.settings-overlay { background: rgb(3 2 7 / 78%); backdrop-filter: blur(9px); }
.settings-sheet {
  background: linear-gradient(155deg, #211c31, #100e19);
  border-color: rgb(169 121 255 / 30%);
  border-radius: 24px 14px 24px 14px;
}
.settings-header { background: rgb(20 16 29 / 96%); }
.settings-header span { color: var(--success); }
.settings-group { background: rgb(9 7 17 / 48%); border-color: var(--line); border-radius: 17px; }
.settings-group h3 { color: var(--preview-gold); font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; }
.settings-toggle input:checked + i { background: rgb(95 240 197 / 22%); border-color: rgb(95 240 197 / 45%); }
.settings-toggle input:checked + i::after { background: var(--success); }
.settings-info-row strong,
.settings-privacy strong { color: var(--success); }
.settings-privacy { background: rgb(95 240 197 / 5%); }
.settings-backup { color: #bff5e2; background: #090711; }
.account-welcome {
  background: linear-gradient(155deg, #211c31, #100e19);
  border-color: rgb(169 121 255 / 36%);
  border-radius: 24px 14px 24px 14px;
}
.account-eyebrow { color: var(--success); }
.app-confirm-dialog {
  background: linear-gradient(155deg, #211c31, #100e19);
  border-color: rgb(169 121 255 / 30%);
  border-radius: 24px 14px 24px 14px;
}
.app-toast { color: var(--success); background: #1b1728; border-color: rgb(95 240 197 / 25%); }

.launch-screen {
  background:
    radial-gradient(circle at 50% 20%, rgb(124 58 237 / 40%), transparent 22rem),
    linear-gradient(150deg, #090711, #1b1028 58%, #090711);
}
.launch-app-icon { border-radius: 28px 14px 28px 14px; box-shadow: 0 18px 58px rgb(124 58 237 / 45%); }

html[data-theme="orange"] {
  --preview-gold: #f96d00;
  --success: #ffb275;
}

@media (max-width: 760px) {
  .preview-home-shell { padding-top: 12px; }
  .preview-home-shell .apk-tool-grid {
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: 14px;
    padding: 0;
  }
  .preview-home-shell .apk-tool-grid .tool-card,
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(1),
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(2),
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(3),
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(4) {
    width: auto;
    min-height: clamp(188px, 24svh, 230px);
    height: auto;
    margin: 0;
    padding: 18px;
  }
  .preview-tool-icon { width: 48px; height: 48px; }
  .preview-tool-icon svg { width: 27px; height: 27px; }
  .preview-tool-copy { margin-top: 24px; }
  .preview-home-shell .apk-tool-grid .tool-card h2 { font-size: 1.38rem; }
  .preview-home-shell .apk-tool-grid .tool-card p { max-width: 25rem; font-size: 0.82rem; line-height: 1.5; }
  .preview-home-shell .apk-tool-grid .card-link { padding-top: 14px; font-size: 0.59rem; }
  .app-shell,
  .session-shell { width: min(100% - 22px, 620px); padding-top: 20px; }
  .page-heading { align-items: flex-start; margin-bottom: 16px; }
  .page-heading h1 { font-size: 2rem; }
  .utc-clock { width: 100%; min-width: 0; text-align: left; }
  .reinforcement-heading-side { width: 100%; }
  .panel,
  .multi-workspace,
  .enemy-library { padding: 15px; border-radius: 18px; }
  .preset-panel { order: 2; }
  .rally-panel,
  .multi-workspace { order: 1; }
  .enemy-panel { order: 3; }
  .settings-content { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .preview-home-header { padding-inline: 13px; }
  .preview-home-brand strong { font-size: 0.88rem; }
  .preview-home-brand small { font-size: 0.49rem; }
  .preview-home-clock { padding: 6px 8px; }
  .preview-home-clock span { font-size: 0.5rem; }
  .preview-home-clock strong { font-size: 0.64rem; }
  .preview-home-shell { width: min(100% - 18px, 500px); }
  .preview-home-shell .apk-tool-grid .tool-card,
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(1),
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(2),
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(3),
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(4) { min-height: clamp(180px, 23svh, 215px); padding: 17px; }
  .preview-tool-icon { width: 46px; height: 46px; }
  .preview-tool-icon svg { width: 25px; height: 25px; }
  .preview-tool-copy { margin-top: 21px; }
  .preview-home-shell .apk-tool-grid .tool-card h2 { font-size: 1.27rem; }
  .preview-home-shell .apk-tool-grid .tool-card p { font-size: 0.78rem; }
  .preview-home-shell .apk-tool-grid .card-link { padding-top: 12px; font-size: 0.56rem; }
  .phone-navigation { right: 7px; left: 7px; }

  .table-wrap tbody tr:not(.empty-row) {
    background: rgb(9 7 17 / 62%);
    border-color: var(--line);
    border-radius: 14px;
  }
  .table-wrap tbody tr.send-now { border-color: var(--timer-warning); }
  .table-wrap tbody tr:not(.empty-row) td { border-color: var(--line); }
  .table-wrap tbody tr:not(.empty-row) td::before { color: var(--faint); font-family: "Segoe UI", sans-serif; }
  .settings-sheet { border-radius: 20px 12px 20px 12px; }
}

@media (max-width: 390px) {
  .preview-home-brand small { font-size: 0.46rem; letter-spacing: 0.08em; }
  .preview-home-shell .apk-tool-grid { gap: 12px; }
  .preview-home-shell .apk-tool-grid .tool-card,
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(1),
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(2),
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(3),
  .preview-home-shell .apk-tool-grid .tool-card:nth-child(4) { min-height: clamp(174px, 22svh, 200px); padding: 16px; }
  .preview-tool-icon { width: 44px; height: 44px; }
  .preview-tool-copy { margin-top: 19px; }
  .preview-home-shell .apk-tool-grid .tool-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .preview-home-note { font-size: 0.55rem; }
}

/* Large and high-density touchscreen phones keep a full-width command deck. */
@media (max-width: 960px), (hover: none) and (pointer: coarse) and (max-width: 1180px) {
  .preview-home-shell {
    width: min(100% - 18px, 760px);
  }
  .preview-home-shell .apk-tool-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(12px, 2.4vw, 18px);
  }
  .preview-home-shell .apk-tool-grid > .tool-card {
    width: 100%;
    min-height: clamp(184px, 22svh, 260px);
    padding: clamp(18px, 3.4vw, 28px);
  }
  .preview-home-shell .apk-tool-grid .tool-card h2 {
    font-size: clamp(1.27rem, 3.4vw, 1.58rem);
  }
  .preview-home-shell .apk-tool-grid .tool-card p {
    max-width: 34rem;
    font-size: clamp(0.78rem, 1.8vw, 0.94rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .preview-rally-route path { animation: none; }
}

/* Keep mobile form controls visible while the on-screen keyboard is open. */
html { scroll-padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
input,
textarea,
select { scroll-margin-block: 96px 180px; }
body.keyboard-open { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
body.keyboard-open .phone-navigation {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
body.keyboard-open .tool-minimize-action { display: none; }

/* Friendly Rally Caller — fixed command view with contained schedule overflow. */
body.rally-friendly-page {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.rally-friendly-shell {
  width: min(86rem, calc(100% - clamp(18px, 3vw, 46px)));
  height: 100%;
  min-height: 0;
  padding: clamp(8px, 1.4vh, 15px) 0 clamp(4px, 1vh, 10px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1.3vh, 13px);
}

.rally-friendly-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 44px;
}

.rally-back {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--muted);
  background: rgb(255 255 255 / 3%);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1.35rem;
  line-height: 1;
  text-decoration: none;
}

.rally-back:hover { color: var(--ink); border-color: var(--line-light); }

.rally-friendly-title { min-width: 0; }
.rally-friendly-title h1 {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: clamp(1.08rem, 2.6vw, 1.45rem);
  letter-spacing: -0.03em;
}
.rally-friendly-title p {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--faint);
  font-size: clamp(0.61rem, 1.5vw, 0.74rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rally-friendly-clock {
  width: auto;
  min-width: 142px;
  padding: 6px 10px;
  text-align: right;
}

.rally-friendly-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(255px, 0.72fr) minmax(420px, 1.55fr);
  gap: clamp(9px, 1.4vw, 15px);
}

.rally-setup-panel,
.rally-live-panel {
  min-height: 0;
  overflow: hidden;
}

.rally-setup-panel { display: flex; flex-direction: column; }
.rally-friendly-panel-heading { align-items: center; margin-bottom: clamp(10px, 1.5vh, 15px); }
.rally-friendly-panel-heading h2 { font-family: "Segoe UI", system-ui, sans-serif; font-size: 1rem; font-weight: 750; }

.rally-ready-badge {
  padding: 5px 8px;
  color: var(--success);
  background: rgb(95 240 197 / 7%);
  border: 1px solid rgb(95 240 197 / 20%);
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 800;
  white-space: nowrap;
}

.rally-ready-badge strong { font-family: Consolas, monospace; }

.rally-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 7px;
}

.rally-add-row .button { padding-inline: 13px; }
.rally-player-select,
.rally-add-row .button { height: 44px; min-height: 44px; }
.rally-player-select { width: 100%; align-self: start; }
.rally-player-menu { min-width: 0; align-self: start; }
.rally-player-trigger { height: 44px; min-height: 44px; padding-block: 4px; }
.rally-player-trigger:disabled { cursor: default; opacity: 0.58; }
.rally-player-options { min-width: min(300px, calc(100vw - 36px)); }
.rally-setup-panel.menu-open { z-index: 60; overflow: visible; }
.rally-friendly-hint { margin: 7px 1px 0; color: var(--faint); font-size: 0.62rem; line-height: 1.35; }

.rally-prep-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px;
  align-items: center;
  gap: 12px;
  margin-top: clamp(12px, 2vh, 20px);
  padding: clamp(11px, 1.6vh, 16px) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.rally-prep-row > div > strong { display: block; color: var(--ink); font-size: 0.73rem; }
.rally-prep-row > div > small { display: block; margin-top: 3px; color: var(--faint); font-size: 0.59rem; line-height: 1.3; }
.rally-prep-input { width: 94px; margin: 0; }
.rally-prep-input input { margin: 0; }

.rally-preset-editor { margin-top: auto; }
.rally-preset-editor > summary {
  padding: 11px 12px;
  color: var(--accent-soft);
  background: rgb(124 58 237 / 8%);
  border: 1px solid rgb(169 121 255 / 22%);
  border-radius: 11px;
  cursor: pointer;
  font-size: 0.67rem;
  font-weight: 800;
  list-style: none;
  text-align: center;
}
.rally-preset-editor > summary::-webkit-details-marker { display: none; }
.rally-preset-editor > summary::after { margin-left: 7px; content: "+"; }
.rally-preset-editor[open] > summary {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 82;
  min-width: 76px;
  color: var(--ink);
  background: #2a2138;
  border-color: var(--line-light);
  font-size: 0;
}
.rally-preset-editor[open] > summary::after { margin: 0; content: "Close"; font-size: 0.68rem; }
.rally-preset-editor[open]::before {
  position: fixed;
  inset: 0;
  z-index: 80;
  content: "";
  background: rgb(3 2 7 / 78%);
  backdrop-filter: blur(8px);
}

.rally-preset-editor-card {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 81;
  width: min(430px, calc(100% - 24px));
  max-height: calc(100dvh - 120px);
  padding: 20px;
  overflow-y: auto;
  background: linear-gradient(155deg, #211c31, #100e19);
  border: 1px solid rgb(169 121 255 / 30%);
  border-radius: 22px 14px 22px 14px;
  box-shadow: 0 24px 72px rgb(0 0 0 / 64%);
  transform: translate(-50%, -50%);
}

.rally-editor-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.rally-editor-heading h2 { margin: 0; font-size: 1rem; }
.rally-editor-heading > span { max-width: 130px; color: var(--faint); font-size: 0.56rem; line-height: 1.35; text-align: right; }
.rally-preset-editor-card .preset-form { margin-top: 16px; padding-top: 15px; }

.rally-live-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(8px, 1.3vh, 13px);
}

.rally-friendly-impact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: clamp(12px, 1.8vw, 17px);
  background:
    radial-gradient(circle at 90% 50%, rgb(124 58 237 / 20%), transparent 42%),
    linear-gradient(105deg, rgb(246 198 107 / 9%), rgb(95 240 197 / 5%));
}

.rally-friendly-impact strong { margin-top: 3px; font-size: clamp(1.13rem, 3vw, 1.7rem); }
.rally-friendly-impact small { margin-top: 3px; }

.rally-schedule-state {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 800;
  white-space: nowrap;
}
.rally-schedule-state::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: currentColor;
  border-radius: 50%;
  content: "";
}
.rally-schedule-state.ready { color: var(--success); }
.rally-schedule-state.ready::before { box-shadow: 0 0 12px var(--success); }

.rally-schedule-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.rally-schedule-heading h2 { margin: 0; font: 750 0.95rem "Segoe UI", system-ui, sans-serif; }
.rally-schedule-heading > span { color: var(--faint); font-size: 0.58rem; }

.rally-friendly-table {
  min-height: 0;
  overflow: auto;
  background: rgb(9 7 17 / 46%);
}

.rally-friendly-table table { height: 100%; }
.rally-friendly-table thead { position: sticky; top: 0; z-index: 2; }
.rally-friendly-table th,
.rally-friendly-table td { padding: clamp(8px, 1.25vh, 12px) clamp(8px, 1vw, 12px); }
.rally-friendly-table tbody { counter-reset: rally-call-order; }
.rally-friendly-table tbody tr:not(.empty-row) { counter-increment: rally-call-order; }
.rally-friendly-table .rally-player-cell { min-width: 110px; }
.rally-player-line { display: flex; align-items: center; gap: 8px; }
.rally-call-order {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 700 0.58rem Consolas, monospace;
}
.rally-call-order::before { content: counter(rally-call-order); }
.rally-player-copy { min-width: 0; }
.rally-player-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rally-player-copy small { display: none; margin-top: 2px; color: var(--faint); font: 0.58rem "Segoe UI", sans-serif; }
.rally-friendly-table tr.send-now .rally-call-order { color: #07110e; background: var(--timer-warning); border-color: var(--timer-warning); }
.rally-friendly-table .table-remove {
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border-radius: 8px;
  font-size: 0;
}
.rally-friendly-table .table-remove::after { content: "×"; font-size: 1rem; }

.rally-action-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.rally-action-bar .status-message { min-height: 0; margin: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rally-calculate-button {
  min-width: min(310px, 46vw);
  min-height: 46px;
  padding-inline: clamp(18px, 3vw, 30px);
  box-shadow: 0 10px 26px rgb(95 240 197 / 14%);
}

@media (max-width: 760px) {
  .rally-friendly-shell {
    width: min(100% - 16px, 620px);
    padding-top: 7px;
    padding-bottom: 3px;
    gap: 7px;
  }
  .rally-friendly-header { min-height: 38px; }
  .rally-back { width: 34px; height: 34px; }
  .rally-friendly-clock { width: auto; min-width: 126px; padding: 5px 8px; text-align: right; }
  .rally-friendly-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 7px;
  }
  .rally-setup-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    order: 0;
    gap: 7px;
    padding: 10px 11px;
  }
  .rally-setup-panel .rally-friendly-panel-heading { grid-column: 1; margin: 0; }
  .rally-add-row { grid-column: 1; }
  .rally-friendly-hint { display: none; }
  .rally-prep-row {
    grid-column: 1;
    grid-row: auto;
    grid-template-columns: minmax(0, 1fr) 90px;
    gap: 10px;
    margin: 0;
    padding: 7px 0 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
  }
  .rally-prep-row > div > small { display: block; }
  .rally-prep-input { width: 90px; }
  .rally-preset-editor { grid-column: 1; margin: 0; }
  .rally-preset-editor > summary { padding: 7px 10px; }
  .rally-live-panel { order: 1; padding: 10px 11px; gap: 7px; }
  .rally-friendly-impact { padding: 9px 11px; }
  .rally-friendly-impact small { display: none; }
  .rally-schedule-heading > span { display: none; }

  .rally-friendly-table { overflow: auto; border: 1px solid var(--line); }
  .rally-friendly-table table { display: table; width: 100%; height: auto; }
  .rally-friendly-table thead { display: table-header-group; }
  .rally-friendly-table tbody { display: table-row-group; }
  .rally-friendly-table tbody tr:not(.empty-row) {
    display: table-row;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
  }
  .rally-friendly-table tbody tr:not(.empty-row) td {
    display: table-cell;
    min-height: 0;
    padding: clamp(6px, 1.25vh, 10px) 7px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    overflow-wrap: normal;
  }
  .rally-friendly-table tbody tr:not(.empty-row) td::before { display: none; }
  .rally-friendly-table th:nth-child(2),
  .rally-friendly-table td:nth-child(2),
  .rally-friendly-table th:nth-child(4),
  .rally-friendly-table td:nth-child(4) { display: none; }
  .rally-friendly-table th:nth-child(3),
  .rally-friendly-table td:nth-child(3),
  .rally-friendly-table th:nth-child(5),
  .rally-friendly-table td:nth-child(5) { text-align: right; }
  .rally-friendly-table th { font-size: 0.53rem; }
  .rally-friendly-table .rally-player-cell { min-width: 92px; }
  .rally-player-copy small { display: block; }
  .rally-friendly-table tbody tr:not(.empty-row) td[data-mobile-action] { display: table-cell; width: 30px; padding: 4px; }
  .rally-friendly-table tbody tr:not(.empty-row) td[data-mobile-action] .table-remove { width: 27px; margin: 0; border: 0; }
  .rally-friendly-table .empty-row { display: table-row; border: 0; }
  .rally-friendly-table .empty-row td { display: table-cell; width: auto; padding: 20px 10px; }
  .rally-action-bar { gap: 7px; }
  .rally-action-bar .status-message { font-size: 0.62rem; }
  .rally-calculate-button { min-width: min(250px, 58vw); min-height: 43px; }
}

@media (max-width: 440px) {
  .rally-friendly-title p { display: none; }
  .rally-friendly-title h1 { font-size: 1rem; }
  .rally-friendly-clock { min-width: 112px; }
  .rally-friendly-clock span { font-size: 0.48rem; }
  .rally-friendly-clock strong { font-size: 0.66rem; }
  .rally-friendly-panel-heading .panel-kicker { display: none; }
  .rally-friendly-panel-heading h2 { font-size: 0.82rem; }
  .rally-ready-badge { padding: 4px 7px; font-size: 0.54rem; }
  .rally-add-row { gap: 5px; }
  .rally-add-row .button { padding-inline: 9px; }
  .rally-prep-row { grid-template-columns: minmax(0, 1fr) 84px; gap: 8px; }
  .rally-prep-row > div > strong { font-size: 0.68rem; }
  .rally-prep-row > div > small { font-size: 0.54rem; }
  .rally-prep-input { width: 84px; }
  .rally-prep-input input { min-height: 34px; height: 34px; }
  .rally-prep-input span { top: 10px; }
  .rally-preset-editor > summary { font-size: 0.59rem; }
  .rally-friendly-impact strong { font-size: 1rem; }
  .rally-schedule-state { font-size: 0.55rem; }
  .rally-schedule-heading .panel-kicker { display: none; }
  .rally-schedule-heading h2 { font-size: 0.78rem; }
  .rally-call-order { display: none; }
  .rally-player-line { gap: 0; }
  .rally-player-copy strong { font-size: 0.68rem; }
  .rally-friendly-table td:nth-child(3),
  .rally-friendly-table td:nth-child(5) { font-size: 0.64rem; }
  .rally-action-bar { grid-template-columns: 1fr; }
  .rally-action-bar .status-message { display: none; }
  .rally-calculate-button { width: 100%; min-width: 0; min-height: 41px; }
}

@media (max-height: 650px) {
  .rally-friendly-shell { padding-top: 4px; gap: 5px; }
  .rally-friendly-header { min-height: 34px; }
  .rally-setup-panel { padding-top: 7px; padding-bottom: 7px; }
  .rally-setup-panel .rally-friendly-panel-heading,
  .rally-preset-editor { display: none; }
  .rally-live-panel { padding-top: 7px; padding-bottom: 7px; gap: 5px; }
  .rally-friendly-impact { padding-top: 6px; padding-bottom: 6px; }
  .rally-friendly-table tbody tr:not(.empty-row) td { padding-top: 4px; padding-bottom: 4px; }
  .rally-calculate-button { min-height: 38px; }
}

/* Compact Rally Caller v2 — explicit library-first workflow. */
.rally-compact-page .rally-builder-panel {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: clamp(12px, 2vh, 18px);
}

.rally-builder-step { min-width: 0; }
.rally-builder-step + .rally-builder-step {
  padding-top: clamp(11px, 1.8vh, 17px);
  border-top: 1px solid var(--line);
}

.rally-step-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.rally-step-heading h2 {
  margin: 0;
  color: var(--ink);
  font: 750 clamp(0.78rem, 1.7vw, 0.96rem) "Segoe UI", system-ui, sans-serif;
}

.rally-step-heading .panel-kicker { margin-bottom: 4px; }
.rally-step-number {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  place-items: center;
  color: #07110e;
  background: var(--success);
  border-radius: 8px;
  font: 900 0.63rem Consolas, monospace;
}

.rally-library-form {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 86px auto;
  align-items: end;
  gap: 7px;
  margin-top: 10px;
}

.rally-library-form label { min-width: 0; margin: 0; }
.rally-library-form label > span {
  display: block;
  margin: 0 0 5px 2px;
  color: var(--faint);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rally-library-form input { height: 42px; min-height: 42px; margin: 0; }
.rally-library-form .rally-save-player { height: 42px; min-height: 42px; padding-inline: 11px; }

.rally-add-heading .rally-ready-badge { margin-left: auto; }
.rally-compact-page .rally-add-row { margin-top: 10px; }
.rally-compact-page .rally-add-player { min-width: 108px; }

.rally-library-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}
.rally-library-actions > span {
  overflow: hidden;
  color: var(--faint);
  font-size: 0.56rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rally-library-actions .button {
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 0.58rem;
}
.rally-delete-player {
  color: var(--danger);
  background: rgb(255 107 130 / 7%);
  border-color: rgb(255 107 130 / 35%);
}

.rally-compact-page .rally-prep-row {
  margin-top: 9px;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.rally-compact-page .rally-schedule-heading { align-items: center; }
.rally-compact-page .rally-schedule-heading .rally-step-heading { flex: 1; }
.rally-compact-page .rally-friendly-table .table-remove {
  width: auto;
  min-width: 54px;
  height: 29px;
  padding: 0 8px;
  color: var(--danger);
  border: 1px solid rgb(255 107 130 / 24%);
  font-size: 0.56rem;
  font-weight: 800;
}
.rally-compact-page .rally-friendly-table .table-remove::after { display: none; }

body.keyboard-open.rally-compact-page { overflow: hidden; }
body.keyboard-open.rally-compact-page .rally-friendly-shell {
  grid-template-rows: auto minmax(0, 1fr);
  padding-bottom: 5px;
}
body.keyboard-open.rally-compact-page .rally-compact-grid {
  display: block;
  min-height: 0;
  overflow: hidden;
}
body.keyboard-open.rally-compact-page .rally-builder-panel {
  height: 100%;
  overflow-y: auto;
}
body.keyboard-open.rally-compact-page .rally-live-panel,
body.keyboard-open.rally-compact-page .rally-action-bar { display: none; }

@media (max-width: 760px) {
  .rally-compact-page .rally-builder-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 9px;
    padding: 9px 10px;
  }
  .rally-compact-page .rally-builder-step + .rally-builder-step { padding-top: 9px; }
  .rally-library-form { grid-template-columns: minmax(95px, 1fr) 76px auto; margin-top: 7px; }
  .rally-library-form input,
  .rally-library-form .rally-save-player { height: 39px; min-height: 39px; }
  .rally-library-form .rally-save-player { padding-inline: 9px; font-size: 0.62rem; }
  .rally-compact-page .rally-add-row { margin-top: 7px; }
  .rally-player-select,
  .rally-add-row .button { height: 39px; min-height: 39px; }
  .rally-compact-page .rally-prep-row { grid-template-columns: minmax(0, 1fr) 84px; margin-top: 7px; padding-top: 7px; }
  .rally-compact-page .rally-live-panel { min-height: 0; }
  .rally-compact-page .rally-friendly-table tbody tr:not(.empty-row) td[data-mobile-action] { width: 58px; }
  .rally-compact-page .rally-friendly-table tbody tr:not(.empty-row) td[data-mobile-action] .table-remove {
    width: auto;
    min-width: 52px;
    margin: 0;
    padding: 0 6px;
    border: 1px solid rgb(255 107 130 / 24%);
  }
}

@media (max-width: 410px) {
  .rally-library-form { grid-template-columns: minmax(85px, 1fr) 70px 82px; gap: 5px; }
  .rally-library-form label > span { font-size: 0.5rem; }
  .rally-library-form input { padding-inline: 8px; font-size: 0.68rem; }
  .rally-library-form .rally-save-player { padding-inline: 6px; font-size: 0.56rem; }
  .rally-compact-page .rally-add-player { min-width: 96px; padding-inline: 7px; font-size: 0.6rem; }
  .rally-library-actions > span { font-size: 0.51rem; }
  .rally-library-actions .button { padding-inline: 7px; }
  .rally-compact-page .rally-schedule-heading > span { display: none; }
  .rally-compact-page .rally-friendly-table th:last-child { font-size: 0; }
}

@media (max-height: 650px) {
  .rally-compact-page .rally-builder-panel { display: grid; }
  .rally-compact-page .rally-step-heading .panel-kicker,
  .rally-compact-page .rally-prep-row small,
  .rally-compact-page .rally-library-actions > span { display: none; }
  .rally-compact-page .rally-library-actions { grid-template-columns: minmax(0, 1fr) auto auto; }
  .rally-compact-page .rally-builder-step + .rally-builder-step { padding-top: 6px; }
  .rally-compact-page .rally-library-form,
  .rally-compact-page .rally-add-row { margin-top: 5px; }
  .rally-compact-page .rally-prep-row { margin-top: 5px; padding-top: 5px; }
}

/* Home screen — always fit all four tools inside the current viewport. */
body[data-page="home"] {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-page="home"] .preview-home-header {
  position: relative;
  min-height: clamp(52px, 8.5dvh, 68px);
  padding: max(7px, env(safe-area-inset-top)) clamp(10px, 3vw, 18px) 7px;
}

body[data-page="home"] .preview-home-shell {
  width: min(68rem, calc(100% - clamp(14px, 3vw, 40px)));
  height: 100%;
  min-height: 0;
  padding: clamp(5px, 1dvh, 10px) 0 clamp(3px, 0.8dvh, 8px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(4px, 0.9dvh, 8px);
}

body[data-page="home"] .preview-home-status {
  min-height: 14px;
  margin: 0 3px;
  font-size: clamp(0.48rem, 1.4vw, 0.58rem);
}

body[data-page="home"] .preview-home-shell .apk-tool-grid {
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(6px, 1.5vmin, 13px);
}

body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card,
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(1),
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(2),
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(3),
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(4) {
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  padding: clamp(9px, 1.9dvh, 18px);
  border-radius: clamp(14px, 3vmin, 22px) clamp(8px, 1.8vmin, 13px) clamp(14px, 3vmin, 22px) clamp(8px, 1.8vmin, 13px);
}

body[data-page="home"] .preview-tool-icon {
  width: clamp(31px, 6dvh, 43px);
  height: clamp(31px, 6dvh, 43px);
  border-radius: 11px 7px 11px 7px;
}
body[data-page="home"] .preview-tool-icon svg { width: clamp(18px, 3.5dvh, 24px); height: clamp(18px, 3.5dvh, 24px); }
body[data-page="home"] .preview-tool-top b { font-size: clamp(0.78rem, 2.4dvh, 1rem); }
body[data-page="home"] .preview-tool-copy { margin-top: clamp(7px, 1.7dvh, 17px); }
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card h2 {
  display: -webkit-box;
  margin-bottom: clamp(2px, 0.7dvh, 5px);
  overflow: hidden;
  font-size: clamp(0.78rem, 2.4dvh, 1.22rem);
  line-height: 1.02;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card p {
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(0.57rem, 1.55dvh, 0.72rem);
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
body[data-page="home"] .preview-home-shell .apk-tool-grid .card-link {
  padding-top: clamp(3px, 0.8dvh, 8px);
  font-size: clamp(0.45rem, 1.25dvh, 0.55rem);
}

body[data-page="home"] .preview-home-note {
  min-height: 13px;
  margin: 0;
  padding: 0 4px;
  font-size: clamp(0.48rem, 1.3vw, 0.6rem);
}

@media (max-width: 420px) {
  body[data-page="home"] .preview-home-brand { gap: 7px; }
  body[data-page="home"] .preview-home-brand img { width: 33px; height: 33px; }
  body[data-page="home"] .preview-home-brand strong { font-size: 0.84rem; }
  body[data-page="home"] .preview-home-brand small { font-size: 0.45rem; }
  body[data-page="home"] .preview-home-clock { padding: 5px 7px; }
  body[data-page="home"] .preview-home-clock span { font-size: 0.46rem; }
  body[data-page="home"] .preview-home-clock strong { font-size: 0.61rem; }
  body[data-page="home"] .preview-home-header-actions { gap: 5px; }
  body[data-page="home"] .preview-reset-ui { min-height: 36px; padding: 5px 8px; }
  body[data-page="home"] .preview-reset-ui > strong { font-size: 0.52rem; }
}

@media (max-height: 620px) {
  body[data-page="home"] .preview-home-shell { grid-template-rows: minmax(0, 1fr); }
  body[data-page="home"] .preview-home-status,
  body[data-page="home"] .preview-home-note { display: none; }
  body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card p { -webkit-line-clamp: 1; }
}

@media (max-height: 500px) {
  body[data-page="home"] .preview-home-brand small,
  body[data-page="home"] .preview-home-clock small,
  body[data-page="home"] .preview-reset-ui > strong,
  body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card p,
  body[data-page="home"] .preview-home-shell .apk-tool-grid .card-link { display: none; }
  body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card { justify-content: center; }
}

/* Ralliance product shell */
.preview-home-brand { color: inherit; text-decoration: none; }
body[data-page="home"] { display: block; height: auto; min-height: 100dvh; overflow: auto; }
body[data-page="home"] .preview-home-header { position: sticky; top: 0; z-index: 70; }
body[data-page="home"] .preview-home-shell.ralliance-home {
  display: block;
  width: min(68rem, calc(100% - clamp(14px, 3vw, 40px)));
  height: auto;
  min-height: calc(100dvh - 70px);
  padding: clamp(16px, 3vw, 30px) 0 calc(98px + env(safe-area-inset-bottom));
}
body[data-page="home"] .ralliance-home .preview-home-status { margin: 0 3px 13px; }
body[data-page="home"] .ralliance-home .apk-tool-grid { height: auto; grid-template-rows: none; }
body[data-page="home"] .ralliance-home .apk-tool-grid .tool-card,
body[data-page="home"] .ralliance-home .apk-tool-grid .tool-card:nth-child(n) { min-height: 205px !important; }
body[data-page="home"] .ralliance-home .preview-home-note { margin-top: 12px; }
.ralliance-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 24px 2px 14px; }
.ralliance-section-heading > span, .ralliance-section-heading div > span { color: var(--faint); font-size: .58rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.ralliance-section-heading h2 { margin: 4px 0 0; font-size: 1.35rem; }
.ralliance-profile-card { width: 100%; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tool-card-title { display: block; margin: 0 0 7px; color: var(--text); font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; font-size: clamp(1.35rem, 3.2vw, 2rem); font-weight: 600; }
.tool-card-description { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: .74rem; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ralliance-module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.ralliance-module-grid article { min-height: 155px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px 9px 20px 9px; }
.ralliance-module-grid article > span { color: var(--success); font: 800 .58rem "DM Mono", monospace; letter-spacing: .12em; }
.ralliance-module-grid h2 { margin: 13px 0 7px; font-size: 1.45rem; }
.ralliance-module-grid p { margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.profile-quick-actions .settings-actions { justify-content: flex-start; }
.legacy-account { margin-top: 14px; padding: 13px; background: var(--panel-deep); border: 1px solid var(--line); border-radius: 12px; }
.legacy-account summary { color: var(--accent-soft); font-size: .72rem; font-weight: 800; cursor: pointer; }
.legacy-account > p { margin: 10px 0; color: var(--faint); font-size: .62rem; line-height: 1.5; }
.legacy-account .settings-control { margin-top: 10px; }
@media (max-width: 620px) {
  .ralliance-section-heading { align-items: start; flex-direction: column; }
  .ralliance-module-grid { grid-template-columns: 1fr; }
}

@media (orientation: landscape) and (max-height: 600px) {
  body[data-page="home"] .preview-home-shell .apk-tool-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
  }
}

@media (max-height: 360px) {
  body[data-page="home"] .preview-home-header { min-height: 42px; padding-top: 4px; padding-bottom: 4px; }
  body[data-page="home"] .preview-home-brand img { width: 30px; height: 30px; }
  body[data-page="home"] .preview-tool-top { justify-content: center; }
  body[data-page="home"] .preview-tool-top b { display: none; }
  body[data-page="home"] .preview-tool-copy { margin-top: 5px; text-align: center; }
}

/* Professional home cards — preserves the existing theme and background. */
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card,
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(1),
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(2),
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(3),
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(4) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  border-color: rgb(255 255 255 / 13%);
  border-radius: clamp(14px, 2.8vmin, 20px);
  box-shadow: 0 10px 30px rgb(0 0 0 / 24%), inset 0 1px 0 rgb(255 255 255 / 4%);
}

body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card::before {
  position: absolute;
  top: 0;
  right: 18%;
  left: 18%;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--tool-color), transparent);
  opacity: 0.72;
}

body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card::after {
  right: -26px;
  bottom: -26px;
  width: 76px;
  height: 76px;
  opacity: 0.14;
}

body[data-page="home"] .preview-tool-top { width: 100%; }
body[data-page="home"] .preview-tool-top > b {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  color: var(--faint);
  background: rgb(255 255 255 / 3%);
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 9px;
  font-size: 0.72rem;
}

body[data-page="home"] .preview-tool-copy {
  align-self: center;
  margin-top: clamp(6px, 1.2dvh, 12px);
}

body[data-page="home"] .preview-tool-type {
  display: block;
  margin-bottom: clamp(5px, 0.9dvh, 8px);
  color: var(--tool-color);
  font: 800 clamp(0.47rem, 1.2dvh, 0.56rem)/1 Consolas, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card h2 {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: clamp(0.9rem, 2.5dvh, 1.24rem);
  font-weight: 760;
  letter-spacing: -0.035em;
}

body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card p {
  max-width: 21rem;
  color: #b8b1c5;
  font-size: clamp(0.59rem, 1.55dvh, 0.73rem);
  line-height: 1.32;
}

body[data-page="home"] .preview-home-shell .apk-tool-grid .card-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: 0;
  padding-top: clamp(7px, 1.2dvh, 11px);
  color: var(--tool-color);
  border-top: 1px solid rgb(255 255 255 / 8%);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: clamp(0.51rem, 1.25dvh, 0.6rem);
  font-weight: 800;
  letter-spacing: 0.06em;
}
body[data-page="home"] .preview-home-shell .apk-tool-grid .card-link b {
  font-size: 0.78rem;
  font-weight: 500;
  transition: transform 160ms ease;
}
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:active .card-link b,
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:hover .card-link b { transform: translateX(3px); }

@media (max-height: 500px) {
  body[data-page="home"] .preview-tool-type { margin-bottom: 3px; }
  body[data-page="home"] .preview-home-shell .apk-tool-grid .card-link {
    display: flex;
    padding-top: 5px;
  }
}

@media (max-height: 390px) {
  body[data-page="home"] .preview-tool-type { display: none; }
  body[data-page="home"] .preview-home-shell .apk-tool-grid .card-link { display: none; }
}

/* Shared-session command controls — themed tool and assignment selection. */
.session-host-controls {
  position: relative;
  overflow: visible;
}
.session-host-controls::before {
  position: absolute;
  top: 0;
  right: 12%;
  left: 12%;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--success), var(--accent-soft), transparent);
}

.session-tool-picker {
  display: grid !important;
  gap: 7px !important;
  margin: 16px 0;
}
.session-select-label {
  color: var(--faint);
  font: 800 0.56rem Consolas, monospace;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.session-custom-select {
  position: relative;
  display: block;
  min-width: 0;
}
.session-select-trigger {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 7px 13px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  background: linear-gradient(145deg, rgb(31 24 45 / 96%), rgb(10 8 17 / 98%));
  border: 1px solid rgb(169 121 255 / 34%);
  border-radius: 15px 8px 15px 8px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%), 0 8px 22px rgb(0 0 0 / 18%);
  font: inherit;
  text-align: left;
}
.session-select-trigger:focus,
.session-custom-select.open .session-select-trigger {
  outline: none;
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgb(95 240 197 / 10%), inset 0 1px 0 rgb(255 255 255 / 6%);
}
.session-select-trigger > span:nth-child(2) { min-width: 0; }
.session-select-trigger strong,
.session-select-trigger small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-select-trigger strong { color: var(--ink); font-size: 0.72rem; }
.session-select-trigger small { margin-top: 2px; color: var(--faint); font-size: 0.55rem; }
.session-select-trigger > i {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--success);
  border-bottom: 2px solid var(--success);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 150ms ease;
}
.session-custom-select.open .session-select-trigger > i { transform: translateY(2px) rotate(225deg); }
.session-select-trigger-icon,
.session-option-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--accent-soft);
  background: rgb(124 58 237 / 15%);
  border: 1px solid rgb(169 121 255 / 25%);
  border-radius: 10px 6px 10px 6px;
  font: 800 0.64rem Consolas, monospace;
}
.session-select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  padding: 6px;
  background: linear-gradient(155deg, #21152f, #0d0915 72%);
  border: 1px solid rgb(169 121 255 / 42%);
  border-radius: 16px 9px 16px 9px;
  box-shadow: 0 22px 50px rgb(0 0 0 / 68%), inset 0 1px 0 rgb(255 255 255 / 7%);
}
.session-custom-select.open-up .session-select-menu { top: auto; bottom: calc(100% + 7px); }
.session-select-menu[hidden] { display: none !important; }
.session-select-menu button {
  width: 100%;
  min-height: 48px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px 6px 11px 6px;
  font: inherit;
  text-align: left;
}
.session-select-menu button + button { margin-top: 3px; }
.session-select-menu button:focus { outline: none; background: rgb(124 58 237 / 13%); border-color: rgb(169 121 255 / 30%); }
.session-select-menu button.selected {
  color: var(--ink);
  background: linear-gradient(90deg, rgb(95 240 197 / 12%), rgb(124 58 237 / 12%));
  border-color: rgb(95 240 197 / 30%);
}
.session-select-menu strong,
.session-select-menu small { display: block; }
.session-select-menu strong { font-size: 0.7rem; }
.session-select-menu small { margin-top: 2px; color: var(--faint); font-size: 0.54rem; }
.session-select-menu button > i {
  width: 16px;
  height: 16px;
  border: 2px solid var(--faint);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #130d1b;
}
.session-select-menu button.selected > i { background: var(--success); border-color: var(--success); }
.session-select-menu button.selected .session-option-icon {
  color: #07110e;
  background: var(--success);
  border-color: var(--success);
}
.session-tool-menu::before {
  position: absolute;
  z-index: 1;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  content: "";
  background: linear-gradient(var(--success), var(--accent-soft));
  border-radius: 0 3px 3px 0;
  pointer-events: none;
}

.session-rally-duration { margin: 16px 0 0; padding: 0; border: 0; }
.session-rally-duration[hidden] { display: none; }
.session-rally-duration legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.session-rally-duration > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 5px;
  background: rgb(9 7 17 / 72%);
  border: 1px solid rgb(169 121 255 / 20%);
  border-radius: 13px;
}
.session-rally-duration label { min-width: 0; cursor: pointer; }
.session-rally-duration input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.session-rally-duration span {
  display: grid;
  min-height: 41px;
  padding: 0 7px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 0.7rem;
  font-weight: 900;
  place-items: center;
}
.session-rally-duration input:checked + span {
  color: #07120e;
  background: var(--success);
  border-color: #9affdc;
  box-shadow: 0 5px 18px rgb(99 255 198 / 17%);
}
.offline-rally-duration { margin: 16px 0 0; }
.rally-builder-step .offline-rally-duration { padding-top: 15px; border-top: 1px solid rgb(255 255 255 / 8%); }
.multi-rally-duration { margin: 0 0 16px; }

.session-tool-panel {
  position: relative;
  background:
    radial-gradient(circle at 100% 0, rgb(124 58 237 / 13%), transparent 13rem),
    rgb(9 7 17 / 58%);
  border-color: rgb(169 121 255 / 20%);
  border-radius: 17px 10px 17px 10px;
}
.session-tool-panel::before {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: -1px;
  width: 3px;
  content: "";
  background: var(--preview-gold);
  border-radius: 0 4px 4px 0;
}
.session-tool-panel[data-session-tool-panel="rally"]::before { background: var(--success); }
.session-tool-panel[data-session-tool-panel="multi"]::before { background: var(--accent-soft); }
.session-delay-adjustments { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.session-delay-adjustments button { min-width: 0; min-height: 38px; padding: 0 3px; color: var(--success); background: rgb(95 240 197 / 8%); border: 1px solid rgb(95 240 197 / 28%); border-radius: 9px; font: 900 0.7rem/1 "Segoe UI", sans-serif; }
.session-delay-adjustments button:active { color: #07120e; background: var(--success); }

.session-members-panel .panel-heading { align-items: center; }
.session-member {
  position: relative;
  background: linear-gradient(135deg, rgb(22 18 33 / 96%), rgb(10 8 16 / 96%));
  border-color: rgb(255 255 255 / 10%);
  border-radius: 16px 9px 16px 9px;
}
.session-member::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: -1px;
  width: 3px;
  content: "";
  background: var(--accent-soft);
  border-radius: 0 3px 3px 0;
}
.session-member-assignment {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr);
  align-items: center;
  gap: 8px;
}
.session-assignment-caption {
  color: var(--faint);
  font: 750 0.52rem Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.session-assignment-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 6px;
  padding: 4px;
  background: rgb(8 7 13 / 68%);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.session-member-menu { min-width: 0; flex: 1; }
.session-member-menu .session-select-trigger { min-height: 38px; padding: 3px 8px; border-radius: 8px; }
.session-member-menu .session-select-trigger-icon { width: 26px; height: 26px; }
.session-member-menu .session-select-menu { right: 0; left: auto; width: max(100%, 245px); max-width: calc(100vw - 42px); }
.session-member .session-group-input {
  width: 48px;
  min-height: 36px;
  padding: 0 5px;
  color: var(--success);
  background: rgb(95 240 197 / 7%);
  border-color: rgb(95 240 197 / 24%);
  border-radius: 8px;
  text-align: center;
}
.session-member .session-group-input[hidden] { display: none; }
.session-rally-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 3px;
}
.session-rally-checks[hidden] { display: none; }
.session-rally-check {
  display: flex;
  min-width: 0;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: var(--muted);
  background: rgb(95 240 197 / 5%);
  border: 1px solid rgb(95 240 197 / 18%);
  border-radius: 8px;
  cursor: pointer;
}
.session-rally-check:has(input:checked) {
  color: var(--success);
  background: rgb(95 240 197 / 11%);
  border-color: rgb(95 240 197 / 38%);
}
.session-rally-check input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--success);
}
.session-rally-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.session-schedule-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; }

@media (max-width: 900px) {
  .session-member-assignment { grid-template-columns: 1fr; }
  .session-assignment-caption { display: none; }
  .session-schedule-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .session-member { gap: 9px; padding: 10px; }
  .session-assignment-fields { width: 100%; }
  .session-schedule-actions { grid-template-columns: 1fr; }
}

/* Appearance setting for the home-menu card layout. */
.settings-menu-style {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}
.settings-menu-style legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.settings-menu-style label {
  position: relative;
  min-width: 0;
  padding: 9px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: rgb(9 7 17 / 54%);
  border: 1px solid var(--line);
  border-radius: 12px 7px 12px 7px;
}
.settings-menu-style input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.settings-menu-style label:has(input:checked) {
  color: var(--ink);
  background: linear-gradient(145deg, rgb(95 240 197 / 10%), rgb(124 58 237 / 11%));
  border-color: rgb(95 240 197 / 42%);
  box-shadow: 0 0 0 3px rgb(95 240 197 / 6%);
}
.settings-menu-style label:has(input:focus-visible) { outline: 2px solid var(--success); outline-offset: 2px; }
.settings-menu-style label > span:last-child { min-width: 0; }
.settings-menu-style strong,
.settings-menu-style small { display: block; }
.settings-menu-style strong { color: inherit; font-size: 0.64rem; }
.settings-menu-style small { margin-top: 2px; color: var(--faint); font-size: 0.52rem; }
.settings-menu-preview {
  width: 38px;
  height: 31px;
  padding: 3px;
  display: grid;
  gap: 2px;
  background: #0c0812;
  border: 1px solid rgb(169 121 255 / 24%);
  border-radius: 7px 4px 7px 4px;
}
.settings-menu-preview-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.settings-menu-preview-list { grid-template-columns: 1fr; grid-template-rows: repeat(4, 1fr); }
.settings-menu-preview i { background: rgb(169 121 255 / 30%); border-radius: 2px; }
.settings-menu-style label:has(input:checked) .settings-menu-preview i { background: var(--success); }

html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: clamp(5px, 1dvh, 9px);
}
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-rally-route { display: none; }
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .tool-card,
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .tool-card:nth-child(1),
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .tool-card:nth-child(2),
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .tool-card:nth-child(3),
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .tool-card:nth-child(4) {
  min-height: 0 !important;
  height: 100% !important;
  padding: clamp(7px, 1.25dvh, 11px) clamp(9px, 2.5vw, 14px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  gap: clamp(8px, 2.4vw, 13px);
  border-radius: 13px 7px 13px 7px;
}
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .tool-card::before {
  top: 17%;
  right: auto;
  bottom: 17%;
  left: 0;
  width: 2px;
  height: auto;
  background: linear-gradient(transparent, var(--tool-color), transparent);
}
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-tool-top { width: auto; align-self: center; }
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-tool-top > b { display: none; }
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-tool-icon {
  width: clamp(32px, 5.5dvh, 40px);
  height: clamp(32px, 5.5dvh, 40px);
}
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-tool-icon svg { width: 20px; height: 20px; }
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-tool-copy {
  min-width: 0;
  align-self: center;
  margin: 0;
}
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-tool-type { margin-bottom: 3px; }
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .tool-card h2 {
  margin: 0 0 2px;
  font-size: clamp(0.78rem, 2dvh, 1rem);
  -webkit-line-clamp: 1;
}
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .tool-card p {
  margin: 0;
  font-size: clamp(0.53rem, 1.35dvh, 0.66rem);
  -webkit-line-clamp: 1;
}
html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .card-link {
  width: auto;
  max-width: 72px;
  height: 100%;
  margin: 0;
  padding: 0 0 0 10px;
  justify-content: flex-end;
  gap: 5px;
  color: var(--tool-color);
  border-top: 0;
  border-left: 1px solid rgb(255 255 255 / 8%);
  font-size: clamp(0.45rem, 1.15dvh, 0.55rem);
  text-align: right;
}

@media (max-width: 420px) {
  .settings-menu-style { grid-template-columns: 1fr; }
  html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .card-link { max-width: 58px; }
}

@media (max-height: 500px) {
  html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .tool-card p,
  html[data-menu-style="list"] body:is([data-page="home"], [data-page="tools"]) .preview-home-shell .apk-tool-grid .card-link { display: none; }
}

/* Keep Home aligned with the shared Tools/Profile/Settings header. */
body[data-page="home"] .preview-home-header {
  min-height: 68px;
  padding: max(10px, env(safe-area-inset-top)) 18px 10px;
}
body[data-page="home"] .preview-home-brand { gap: 10px; }
body[data-page="home"] .preview-home-brand img { width: 39px; height: 39px; }
body[data-page="home"] .preview-home-brand strong { font-size: 1rem; }
body[data-page="home"] .preview-home-clock { padding: 7px 10px; }
body[data-page="home"] .preview-home-clock span { font-size: 0.55rem; }
body[data-page="home"] .preview-home-clock strong { font-size: 0.72rem; }
body[data-page="home"] .preview-home-header-actions { gap: 8px; }
body[data-page="home"] .preview-reset-ui { min-height: 40px; padding: 7px 11px; }
body[data-page="home"] .preview-reset-ui > strong { display: inline; font-size: 0.62rem; }

@media (max-width: 560px) {
  body[data-page="home"] .preview-home-header { padding-inline: 13px; }
  body[data-page="home"] .preview-home-clock { padding: 6px 8px; }
  body[data-page="home"] .preview-home-clock span { display: block; font-size: 0.5rem; }
  body[data-page="home"] .preview-home-clock strong { font-size: 0.64rem; }
}

/* Keep Prep aligned with the Alliance workspace after generic app-shell rules. */
body[data-page="prep"] .prep-shell {
  width: min(1120px, calc(100% - clamp(20px, 5vw, 64px)));
  margin: 0 auto;
  padding: 145px 0 104px;
}
body[data-page="prep"] .prep-heading { margin-bottom: 22px; }
body[data-page="prep"] .prep-organizer { gap: 16px; }

@media (max-width: 680px) {
  body[data-page="prep"] .prep-shell {
    width: calc(100% - 20px);
    padding-top: 137px;
  }
}

/* Use the Alliance Overview header dimensions and typography on every web page. */
.ralliance-shared-header .preview-home-brand > strong {
  font: 600 1rem/1 "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}
.ralliance-shared-header .preview-home-brand > img { width: 39px; height: 39px; }
.ralliance-shared-header .preview-home-clock > small { display: block; font-size: 0.5rem; }
.ralliance-shared-header .preview-home-clock > span[data-clock] { font-size: 0.72rem; }

@media (max-width: 560px) {
  .ralliance-shared-header { padding-inline: 13px; }
  .ralliance-shared-header .preview-home-brand > strong { font-size: 1rem; }
  .ralliance-shared-header .preview-home-brand > img { width: 39px; height: 39px; }
  .ralliance-shared-header .preview-home-clock { padding: 6px 8px; }
  .ralliance-shared-header .preview-home-clock > small { display: block; font-size: 0.5rem; }
  .ralliance-shared-header .preview-home-clock > span[data-clock] { font-size: 0.64rem; }
}

/* Prep ministers and shared Alliance chrome. */
.prep-choice-help { margin: 0 0 10px; color: var(--faint); font-size: .68rem; line-height: 1.45; }
.prep-minister-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prep-minister-day { display: grid; min-width: 0; gap: 8px; padding: 10px; background: rgb(10 7 15 / 58%); border: 1px solid var(--line); border-radius: 12px; }
.prep-minister-day.selected { border-color: rgb(95 240 197 / 42%); background: rgb(95 240 197 / 6%); }
.prep-minister-day > label { min-height: 38px; }
.prep-minister-day select { width: 100%; min-height: 38px; }
.prep-minister-day select:disabled { opacity: .42; }
.prep-minister-day:not(.selected) .prep-minister-boxes,
.prep-minister-day:not(.selected) .prep-fixed-minister,
.prep-module-nav [hidden] { display: none !important; }
.prep-minister-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.prep-minister-boxes label { min-height: 40px; padding: 8px 9px; border-radius: 9px; }
.prep-minister-boxes input { width: 17px; height: 17px; }
.prep-fixed-minister { display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; color: var(--mint); background: rgb(95 240 197 / 7%); border: 1px solid rgb(95 240 197 / 22%); border-radius: 9px; font-size: .72rem; font-weight: 800; }
.prep-fixed-minister small { color: var(--faint); font-size: .56rem; letter-spacing: .08em; text-transform: uppercase; }
.prep-day-minister { display: block; margin-top: 4px; color: var(--mint); font-size: .65rem; font-weight: 750; }
.preview-header-log { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; color: var(--muted); background: transparent; border: 1px solid var(--line-light); border-radius: 12px; text-decoration: none; }
.preview-header-log:hover { color: var(--mint); border-color: var(--mint); }
.preview-header-log svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.prep-slot-speedups { display: grid; gap: 5px; }
.prep-slot-speedups span { min-height: 24px; padding: 4px 7px; color: var(--gold); background: rgb(255 204 102 / 7%); border: 1px solid rgb(255 204 102 / 18%); border-radius: 7px; font-size: .62rem; line-height: 1.35; }
.prep-delete-form { color: #fff; background: linear-gradient(135deg,#be123c,#881337); border-color: #fb7185; }
.prep-organizer-actions { display: flex; justify-content: space-between; gap: 10px; }
.prep-confirm-overlay { position: fixed; inset: 0; z-index: 130; display: grid; padding: 22px; place-items: center; background: rgb(5 3 8 / 80%); backdrop-filter: blur(9px); }
.prep-confirm-dialog { width: min(410px, 100%); padding: 24px; color: var(--ink); background: linear-gradient(155deg,#21152c,#100917); border: 1px solid rgb(255 107 130 / 48%); border-radius: 21px; box-shadow: 0 28px 80px rgb(0 0 0 / 72%); }
.prep-confirm-dialog h2 { margin: 7px 0 9px; }
.prep-confirm-dialog p { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.55; }
.prep-confirm-dialog .button-row { margin-top: 20px; }

/* Profile and Settings are full pages, not modal sheets. */
.account-page .settings-page { width: min(1120px, calc(100% - clamp(20px, 5vw, 64px))); min-height: auto; padding: clamp(24px, 4vw, 46px) 0 calc(104px + env(safe-area-inset-bottom)); }
.account-page .settings-page .settings-sheet { background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.account-page .settings-page .settings-header { padding: 0 0 20px; background: transparent; border-bottom: 1px solid var(--line); }
.account-page .settings-page .settings-header h2 { margin-top: 6px; font-size: clamp(1.9rem, 6vw, 2.45rem); }
.account-page .settings-page .settings-content { padding: 20px 0 0; }
.account-page .settings-page .settings-group { border-radius: 16px; }

@media (max-width: 680px) {
  .prep-minister-choices { grid-template-columns: 1fr; }
  .account-page .settings-page { width: calc(100% - 20px); padding-top: 22px; }
  .account-page .settings-page .settings-content { padding-top: 16px; }
  body[data-page="prep"] .preview-home-header-actions { gap: 5px; }
  body[data-page="prep"] .preview-reset-ui { padding-inline: 8px; }
  body[data-page="prep"] .preview-reset-ui > strong { display: inline; }
  body[data-page="prep"] .preview-header-log { width: 38px; height: 38px; flex-basis: 38px; }
}

/* Prep uses the exact Alliance Overview header structure. */
body[data-page="prep"] .prep-alliance-header { position: fixed; top: 0; right: 0; left: 0; z-index: 70; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 12px; padding: max(10px, env(safe-area-inset-top)) 18px 10px; background: linear-gradient(180deg,rgb(9 7 17 / 98%),rgb(9 7 17 / 84%)); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
body[data-page="prep"] .prep-alliance-header .brand { display: flex; min-width: 0; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
body[data-page="prep"] .prep-alliance-header .sigil { display: grid; width: 39px; height: 39px; flex: 0 0 39px; overflow: hidden; place-items: center; background: #050517; border: 1px solid rgb(169 121 255 / 38%); border-radius: 13px 8px 13px 8px; box-shadow: 0 7px 20px rgb(0 0 0 / 30%); }
body[data-page="prep"] .prep-alliance-header .sigil img { width: 100%; height: 100%; object-fit: cover; }
body[data-page="prep"] .prep-alliance-header .brand strong { display: block; overflow: hidden; font: 600 1rem/1 "Palatino Linotype",Georgia,serif; text-overflow: ellipsis; white-space: nowrap; }
body[data-page="prep"] .prep-alliance-header .top-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
body[data-page="prep"] #resetUiBtn { display: inline-flex; min-height: 40px; align-items: center; gap: 6px; padding: 7px 11px; color: var(--ink); background: linear-gradient(145deg,rgb(43 28 59 / 88%),rgb(17 16 27 / 88%)); border: 1px solid rgb(169 121 255 / 38%); border-radius: 12px; font: inherit; cursor: pointer; white-space: nowrap; }
body[data-page="prep"] #resetUiBtn > span { color: var(--mint); font-size: 1.1rem; line-height: 1; }
body[data-page="prep"] #resetUiBtn > strong { font-size: .62rem; letter-spacing: .04em; }
body[data-page="prep"] .prep-alliance-header .clock { display: block; height: auto; min-height: 0; padding: 7px 10px; background: rgb(17 16 27 / 78%); border: 1px solid var(--line); border-radius: 12px; text-align: right; }
body[data-page="prep"] .prep-alliance-header .clock small { display: block; margin: 0; color: var(--faint); font: 800 .55rem/normal "Segoe UI",system-ui,sans-serif; letter-spacing: .11em; }
body[data-page="prep"] .prep-alliance-header .clock span { display: block; margin-top: 3px; color: var(--mint); font: 700 .72rem/1 Consolas,monospace; white-space: nowrap; }
body[data-page="prep"] .prep-alliance-header .icon-btn { display: grid; width: 40px; height: 40px; flex: 0 0 40px; padding: 0; place-items: center; color: var(--muted); background: var(--panel-deep); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
body[data-page="prep"] .prep-alliance-header .icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body[data-page="prep"] .prep-alliance-header .icon-btn { position: relative; }
body[data-page="prep"] .prep-alliance-header .badge { position: absolute; top: -4px; right: -4px; display: grid; min-width: 18px; height: 18px; padding: 0 4px; place-items: center; color: #07110e; background: var(--mint); border: 2px solid var(--canvas); border-radius: 9px; font: 800 9px Consolas,monospace; }
body[data-page="prep"] .prep-alliance-header .badge[hidden] { display: none; }

/* Keep member forms, published results, and wide tables inside the same page margins. */
body[data-page="prep"],body[data-page="prep"] .prep-shell,body[data-page="prep"] .prep-member,body[data-page="prep"] .prep-organizer,body[data-page="prep"] .prep-results,body[data-page="prep"] .prep-schedule-panel,body[data-page="prep"] .prep-assignment-days,body[data-page="prep"] .prep-assignment-day { min-width: 0; max-width: 100%; overflow-x: clip; }
body[data-page="prep"] .prep-member,body[data-page="prep"] .prep-results { width: 100%; margin: 0; }
body[data-page="prep"] .prep-timeslot-table-wrap { width: 100%; max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; }
body[data-page="prep"] .prep-timeslot-table { min-width: 0; table-layout: fixed; }
body[data-page="prep"] .prep-form-header,body[data-page="prep"] .prep-member-step,body[data-page="prep"] .prep-day-card,body[data-page="prep"] .prep-range-row { min-width: 0; max-width: 100%; }
body[data-page="prep"] .prep-range-row select,body[data-page="prep"] .prep-duration-fields input { min-width: 0; max-width: 100%; }

@media (max-width: 560px) {
  body[data-page="prep"] .prep-alliance-header { padding-inline: 13px; }
  body[data-page="prep"] .prep-alliance-header .clock { padding: 6px 8px; }
  body[data-page="prep"] .prep-alliance-header .clock small { font-size: .5rem; }
  body[data-page="prep"] .prep-alliance-header .clock span { font-size: .64rem; }
}
/* Alliance Overview and Prep now share the same sticky page flow. */
body[data-page="prep"] .prep-alliance-header,
body[data-page="prep"] .prep-module-nav { --text: #f7f4ff; --ink: #f7f4ff; --muted: #aaa3ba; --faint: #81798d; --line: rgb(255 255 255 / 10%); --line-accent: rgb(169 121 255 / 38%); --mint: #5ff0c5; --gold: #f6c66b; --deep: #0d0c15; --panel-deep: #0d0c15; font: 14px/1.45 "Segoe UI",system-ui,sans-serif; letter-spacing: normal; }
body[data-page="prep"] .prep-alliance-header { position: sticky; top: 0; right: auto; left: auto; z-index: 30; }
body[data-page="prep"] .prep-module-nav { position: sticky; top: max(68px,calc(49px + env(safe-area-inset-top))); right: auto; left: auto; z-index: 19; }
body[data-page="prep"] .prep-alliance-header .brand { flex: 0 1 auto; font: inherit; letter-spacing: normal; }
body[data-page="prep"] .prep-alliance-header .sigil { flex: 0 1 auto; }
body[data-page="prep"] .prep-alliance-header .brand strong { overflow: visible; text-overflow: clip; white-space: normal; }
body[data-page="prep"] .prep-alliance-header .top-actions { flex: 0 1 auto; }
body[data-page="prep"] .prep-alliance-header .clock { align-items: center; }
body[data-page="prep"] .prep-alliance-header .icon-btn { flex: 0 1 auto; padding: 1px 6px; }
body[data-page="prep"] .prep-module-nav .module-context-dot { flex: 0 1 auto; }
body[data-page="prep"] .prep-module-nav .nav-btn { justify-content: center; gap: 3px; }
body[data-page="prep"] .prep-shell { padding: clamp(24px,4vw,46px) 0 104px; }
@media (max-width: 520px) {
  body[data-page="prep"] .prep-shell { padding-top: 22px; }
  body[data-page="prep"] .prep-module-nav .module-context-dot { flex: 0 0 8px; }
}

/* Compact Prep day tables: all columns remain visible at phone width. */
body[data-page="prep"] .prep-assignment-day { padding: 10px; border-radius: 12px; }
body[data-page="prep"] .prep-day-table-heading { align-items: center; gap: 8px; margin-bottom: 9px; }
body[data-page="prep"] .prep-day-table-heading h3 { margin-top: 2px; font-size: 1.08rem; }
body[data-page="prep"] .prep-day-table-heading > span { flex: 0 0 auto; font-size: .52rem; }
body[data-page="prep"] .prep-day-minister { margin-top: 2px; font-size: .58rem; }
body[data-page="prep"] .prep-timeslot-table-wrap { max-height: 500px; overflow-x: hidden; border-radius: 10px; }
body[data-page="prep"] .prep-timeslot-table { width: 100%; min-width: 0; table-layout: fixed; }
body[data-page="prep"] .prep-timeslot-table th,
body[data-page="prep"] .prep-timeslot-table td { min-width: 0; padding: 7px 5px; vertical-align: middle; overflow-wrap: anywhere; }
body[data-page="prep"] .prep-timeslot-table thead th { font-size: .5rem; letter-spacing: .04em; }
body[data-page="prep"] .prep-timeslot-table tbody th { width: auto; font-size: .56rem; line-height: 1.25; white-space: normal; }
body[data-page="prep"] .prep-timeslot-table--standard th:nth-child(1),
body[data-page="prep"] .prep-timeslot-table--troops th:nth-child(1) { width: 31%; }
body[data-page="prep"] .prep-timeslot-table--standard th:nth-child(2),
body[data-page="prep"] .prep-timeslot-table--troops th:nth-child(2) { width: 36%; }
body[data-page="prep"] .prep-timeslot-table--standard th:nth-child(3),
body[data-page="prep"] .prep-timeslot-table--troops th:nth-child(3) { width: 33%; }
body[data-page="prep"] .prep-timeslot-table--research th:nth-child(1) { width: 25%; }
body[data-page="prep"] .prep-timeslot-table--research th:nth-child(2) { width: 27%; }
body[data-page="prep"] .prep-timeslot-table--research th:nth-child(3) { width: 29%; }
body[data-page="prep"] .prep-timeslot-table--research th:nth-child(4) { width: 19%; }
body[data-page="prep"] .prep-timeslot-table--construction th:nth-child(1) { width: 22%; }
body[data-page="prep"] .prep-timeslot-table--construction th:nth-child(2) { width: 23%; }
body[data-page="prep"] .prep-timeslot-table--construction th:nth-child(3) { width: 25%; }
body[data-page="prep"] .prep-timeslot-table--construction th:nth-child(4) { width: 14%; }
body[data-page="prep"] .prep-timeslot-table--construction th:nth-child(5) { width: 16%; }
body[data-page="prep"] .prep-slot-members,
body[data-page="prep"] .prep-slot-speedups,
body[data-page="prep"] .prep-slot-items { gap: 3px; }
body[data-page="prep"] .prep-slot-members span,
body[data-page="prep"] .prep-slot-speedups span,
body[data-page="prep"] .prep-slot-items span { display: block; min-width: 0; min-height: 0; padding: 3px 4px; border-radius: 5px; font-size: .53rem; line-height: 1.25; overflow-wrap: anywhere; }
body[data-page="prep"] .prep-slot-empty { font-size: .53rem; line-height: 1.25; }

body[data-page="prep"] .prep-member-overview .panel-heading { align-items: center; }
body[data-page="prep"] .prep-member-overview .panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: .65rem; }
body[data-page="prep"] .prep-member-overview .prep-responses { margin-bottom: 0; }
body[data-page="prep"] .prep-response-table-wrap { width: 100%; max-width: 100%; overflow: hidden; border-radius: 10px; }
body[data-page="prep"] .prep-response-table { width: 100%; min-width: 0; table-layout: fixed; }
body[data-page="prep"] .prep-response-table th,
body[data-page="prep"] .prep-response-table td { min-width: 0; padding: 8px 5px; vertical-align: middle; overflow-wrap: anywhere; }
body[data-page="prep"] .prep-response-table thead th { font-size: .5rem; letter-spacing: .04em; white-space: normal; }
body[data-page="prep"] .prep-response-table tbody th { min-width: 0; }
body[data-page="prep"] .prep-response-table tbody th strong { font-size: .61rem; line-height: 1.2; }
body[data-page="prep"] .prep-response-table tbody th small { margin-top: 3px; font-size: .48rem; line-height: 1.2; overflow-wrap: anywhere; }
body[data-page="prep"] .prep-response-table tbody td { font-size: .56rem; line-height: 1.35; white-space: normal; }
body[data-page="prep"] .prep-response-table--standard th:nth-child(1),
body[data-page="prep"] .prep-response-table--troops th:nth-child(1) { width: 27%; }
body[data-page="prep"] .prep-response-table--standard th:nth-child(2),
body[data-page="prep"] .prep-response-table--troops th:nth-child(2) { width: 32%; }
body[data-page="prep"] .prep-response-table--standard th:nth-child(3),
body[data-page="prep"] .prep-response-table--troops th:nth-child(3) { width: 41%; }
body[data-page="prep"] .prep-response-table--research th:nth-child(1) { width: 24%; }
body[data-page="prep"] .prep-response-table--research th:nth-child(2) { width: 28%; }
body[data-page="prep"] .prep-response-table--research th:nth-child(3) { width: 30%; }
body[data-page="prep"] .prep-response-table--research th:nth-child(4) { width: 18%; }
body[data-page="prep"] .prep-response-table--construction th:nth-child(1) { width: 22%; }
body[data-page="prep"] .prep-response-table--construction th:nth-child(2) { width: 25%; }
body[data-page="prep"] .prep-response-table--construction th:nth-child(3) { width: 25%; }
body[data-page="prep"] .prep-response-table--construction th:nth-child(4) { width: 13%; }
body[data-page="prep"] .prep-response-table--construction th:nth-child(5) { width: 15%; }
body[data-page="prep"] .prep-response-window,
body[data-page="prep"] .prep-response-speed { color: var(--muted); }
body[data-page="prep"] .prep-resource-number { color: var(--gold); font-family: Consolas, monospace; font-weight: 750; }
body[data-page="prep"] .prep-response-resource-stack { display: flex; flex-wrap: wrap; gap: 3px; }
body[data-page="prep"] .prep-response-resource-stack span { padding: 2px 4px; color: var(--gold); background: rgb(246 198 107 / 7%); border: 1px solid rgb(246 198 107 / 16%); border-radius: 5px; font: 700 .49rem Consolas, monospace; }

@media (max-width: 420px) {
  body[data-page="prep"] .prep-assignment-day { padding: 8px; }
  body[data-page="prep"] .prep-timeslot-table th,
  body[data-page="prep"] .prep-timeslot-table td,
  body[data-page="prep"] .prep-response-table th,
  body[data-page="prep"] .prep-response-table td { padding-inline: 4px; }
  body[data-page="prep"] .prep-member-overview { padding: 12px; }
}

/* Release polish: compact tool menu, state-aware profile, and shorter settings. */
body[data-page="tools"] .preview-home-shell { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
body[data-page="tools"] .preview-home-shell .apk-tool-grid { gap: 11px; }
body[data-page="tools"] .preview-home-shell .apk-tool-grid .tool-card,
body[data-page="tools"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(n) {
  min-height: 146px;
  padding: 15px 17px;
}
body[data-page="tools"] .preview-tool-icon { width: 39px; height: 39px; }
body[data-page="tools"] .preview-tool-copy { margin-top: 11px; }
body[data-page="tools"] .preview-home-shell .apk-tool-grid .tool-card h2 { font-size: 1.12rem; }
body[data-page="tools"] .preview-home-shell .apk-tool-grid .tool-card p { font-size: .72rem; line-height: 1.35; }
body[data-page="tools"] .preview-home-shell .apk-tool-grid .card-link { padding-top: 8px; }
.settings-collapsible { padding: 0; overflow: hidden; }
.settings-collapsible > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 16px; color: var(--preview-gold); cursor: pointer; list-style: none; }
.settings-collapsible > summary::-webkit-details-marker { display: none; }
.settings-collapsible > summary::after { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--muted); content: "+"; font-size: 1.15rem; }
.settings-collapsible[open] > summary::after { content: "−"; }
.settings-collapsible > summary > span { font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; font-size: .8rem; font-weight: 700; }
.settings-collapsible > summary > small { color: var(--faint); font-size: .62rem; }
.settings-collapsible-content { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.account-danger-zone { margin-top: 12px; border-top: 1px solid var(--line); }
.account-danger-zone > summary { padding: 14px 0; color: var(--muted); cursor: pointer; font-size: .68rem; font-weight: 800; }
.account-danger-zone .account-deletion { margin-top: 0; }
/* State-driven visibility must win over component display declarations. */
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .tool-minimize-action {
    width: 46px;
    min-height: 46px;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
  }
  .tool-minimize-action strong {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  body[data-page="tools"] .preview-home-shell .apk-tool-grid .tool-card,
  body[data-page="tools"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(n) { min-height: 142px; padding: 14px 16px; }
  .account-page .settings-page .settings-group { padding: 13px; }
  .account-page .settings-page .settings-collapsible { padding: 0; }
  .account-page .settings-page .settings-control,
  .account-page .settings-page .settings-toggle { padding-block: 10px; }
}

@media (orientation: landscape) and (max-height: 600px) {
  .ralliance-shared-header,
  body[data-page="home"] .preview-home-header {
    min-height: 52px;
    padding: max(4px, env(safe-area-inset-top)) 12px 4px;
  }
  .ralliance-shared-header .preview-home-brand img,
  body[data-page="home"] .preview-home-brand img { width: 34px; height: 34px; }
  .ralliance-shared-header .preview-home-clock,
  body[data-page="home"] .preview-home-clock { padding: 4px 8px; }
  .phone-navigation {
    right: 7px;
    bottom: calc(5px + env(safe-area-inset-bottom));
    left: 7px;
    min-height: 42px;
    height: 42px;
    padding: 3px;
    border-radius: 15px;
  }
  .phone-nav-item {
    min-height: 34px;
    padding: 2px 5px;
    flex-direction: row;
    border-radius: 11px;
    font-size: .5rem;
  }
  .phone-nav-icon svg { width: 17px; height: 17px; }
  .tool-minimize-action {
    right: 9px;
    bottom: calc(52px + env(safe-area-inset-bottom));
    width: 42px;
    min-height: 42px;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
  }
  .tool-minimize-action strong {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .session-shell { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .page-heading { margin-bottom: 10px; }
  .page-heading h1 { font-size: clamp(1.55rem, 9dvh, 2.25rem); }
  .page-heading > div:first-child > p:last-child { font-size: .68rem; line-height: 1.3; }
}


/* Provider brand icons */
.provider-logo { color: transparent !important; background-repeat: no-repeat !important; background-position: center !important; }
.provider-logo-google { background-image: url("assets/google-g.svg") !important; background-size: 18px 18px !important; }
.provider-logo-discord { background-image: url("assets/discord-mark.svg") !important; background-size: 19px auto !important; }
.first-setup-path > .provider-logo-google { background-color: #fff; background-size: 23px 23px !important; }
.first-setup-path > .provider-logo-discord { background-color: #5865f2; background-size: 25px auto !important; }
.account-provider-mark.provider-logo-google { background-size: 18px 18px !important; }
.account-provider-mark.provider-logo-discord { background-size: 19px auto !important; }

/* Five tools plus the community panel need a naturally scrolling home menu. */
body[data-page="home"] {
  height: auto;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}
body[data-page="home"] .preview-home-header { position: sticky; top: 0; }
body[data-page="home"] .preview-home-shell {
  height: auto;
  min-height: calc(100dvh - 68px);
  padding-bottom: calc(98px + env(safe-area-inset-bottom));
  grid-template-rows: auto auto auto auto;
}
body[data-page="home"] .preview-home-shell .apk-tool-grid {
  height: auto;
  grid-template-rows: repeat(3, minmax(0, 1fr));
}
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card,
body[data-page="home"] .preview-home-shell .apk-tool-grid .tool-card:nth-child(n) {
  height: auto !important;
  min-height: clamp(150px, 20svh, 205px) !important;
}
