:root {
  color-scheme: light;
  --bg: #f4f7fa;
  --panel: #ffffff;
  --ink: #14191f;
  --muted: #657180;
  --line: #dbe2ea;
  --line-strong: #b9c4d1;
  --blue: #0a84ff;
  --green: #19a974;
  --amber: #ffb02e;
  --red: #e85135;
  --black: #11151b;
  --shadow: 0 18px 55px rgba(21, 28, 36, .10);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(10, 132, 255, .10), transparent 34%),
    linear-gradient(225deg, rgba(255, 176, 46, .12), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 18px;
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.matchup-rail,
.voice-panel,
.quick-plan,
.section-card,
.mantra-strip,
.status-band {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.matchup-rail {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: calc(100vh - 36px);
  border-radius: 8px;
  overflow: hidden;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.45rem;
  line-height: 1.05;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 3.2rem);
  line-height: .98;
}

h3 {
  font-size: 1rem;
}

.search-zone {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.search-zone label,
.settings-grid label > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 15px;
  height: 15px;
  border: 2px solid var(--muted);
  border-radius: 999px;
  transform: translateY(-55%);
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 8px;
  height: 2px;
  background: var(--muted);
  transform: rotate(45deg);
  transform-origin: left center;
}

#opponentSearch {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

#opponentSearch:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, .14);
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  margin-top: 8px;
  color: var(--muted);
  font-size: .9rem;
}

.text-button {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
}

.matchup-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  padding: 14px;
}

.matchup-button {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.matchup-button:hover,
.matchup-button:focus-visible {
  border-color: var(--blue);
  outline: none;
}

.matchup-button.is-active {
  border-color: var(--black);
  background: var(--black);
  color: #fff;
}

.matchup-button strong {
  display: block;
  overflow-wrap: anywhere;
}

.matchup-button span {
  color: inherit;
  font-size: .76rem;
  opacity: .74;
}

.type-pill {
  max-width: 112px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(10, 132, 255, .10);
  color: #09549d;
  font-size: .72rem;
  font-weight: 800;
  text-align: center;
}

.matchup-button.is-active .type-pill {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.fight-stage {
  display: grid;
  align-content: start;
  gap: 18px;
}

.status-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 170px;
  padding: 28px;
  border-radius: 8px;
}

.type-line {
  max-width: 780px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.meter {
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  border-radius: 999px;
  background: conic-gradient(from 210deg, var(--blue), var(--green), var(--amber), var(--red), var(--blue));
  box-shadow: inset 0 0 0 14px #fff;
}

.meter span {
  grid-area: 1 / 1;
  display: block;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .78);
}

.meter span:nth-child(1) {
  width: 82px;
  height: 82px;
}

.meter span:nth-child(2) {
  width: 50px;
  height: 50px;
}

.meter span:nth-child(3) {
  width: 18px;
  height: 18px;
  background: #fff;
}

.voice-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border-radius: 8px;
}

.now-playing {
  min-height: 68px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: #fbfcfe;
}

#chunkStatus {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

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

.command-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.command-button:hover,
.command-button:focus-visible {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 4px rgba(10, 132, 255, .12);
}

.command-button.primary {
  border-color: var(--black);
  background: var(--black);
  color: #fff;
}

.button-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.icon-play::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 2px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
}

.icon-pause::before,
.icon-pause::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 5px;
  height: 14px;
  background: currentColor;
  border-radius: 2px;
}

.icon-pause::before {
  left: 3px;
}

.icon-pause::after {
  right: 3px;
}

.icon-stop::before {
  content: "";
  position: absolute;
  inset: 3px;
  background: currentColor;
  border-radius: 3px;
}

.icon-repeat::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
}

.icon-repeat::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 2px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
  transform: rotate(-18deg);
}

.icon-next::before,
.icon-next::after {
  content: "";
  position: absolute;
  top: 2px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 8px solid currentColor;
}

.icon-next::before {
  left: 2px;
}

.icon-next::after {
  left: 9px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, .65fr) auto;
  gap: 12px;
  align-items: end;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input[type="range"] {
  accent-color: var(--blue);
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  font-weight: 900;
}

.toggle-row span {
  margin: 0;
  color: var(--ink);
  font-size: .95rem;
  text-transform: none;
}

.support-note {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.quick-plan,
.mantra-strip {
  padding: 18px;
  border-radius: 8px;
}

.quick-plan p:last-child,
.mantra-strip p {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.55;
}

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

.section-card {
  min-height: 180px;
  padding: 18px;
  border-radius: 8px;
}

.section-card[data-tone="do"] {
  border-top: 5px solid var(--green);
}

.section-card[data-tone="avoid"] {
  border-top: 5px solid var(--red);
}

.section-card[data-tone="plan"] {
  border-top: 5px solid var(--blue);
}

.section-card ul {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding-left: 19px;
}

.section-card li {
  line-height: 1.5;
}

.mantra-strip {
  border-color: rgba(255, 176, 46, .55);
  background: linear-gradient(90deg, rgba(255, 176, 46, .18), rgba(25, 169, 116, .10));
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .matchup-rail {
    min-height: auto;
    max-height: 560px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .brand-block,
  .status-band,
  .voice-panel,
  .quick-plan,
  .mantra-strip {
    padding: 14px;
  }

  .status-band {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .meter {
    width: 88px;
    height: 88px;
  }

  .meter span:nth-child(1) {
    width: 62px;
    height: 62px;
  }

  .meter span:nth-child(2) {
    width: 38px;
    height: 38px;
  }

  .control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .command-button {
    min-height: 58px;
  }

  .settings-grid,
  .section-grid {
    grid-template-columns: 1fr;
  }

  .matchup-button {
    display: flex;
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .type-pill {
    max-width: 100%;
    justify-self: start;
  }
}
