:root {
  --bg: #141c28;
  --surface: #1c2838;
  --surface-2: #243347;
  --text: #e8eef4;
  --muted: #94a3b8;
  --accent: #8eb9ff;
  --focus: #b8d4ff;
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

/* Belt picker screen — cool slate (default :root above) */
body.belt-picker-mode {
  --bg: #141c28;
  --surface: #1c2838;
  --surface-2: #243347;
  --text: #e8eef4;
  --muted: #94a3b8;
  --accent: #8eb9ff;
  --focus: #b8d4ff;
}

/* Main app — colors match chosen belt */
body.belt-theme-green {
  --bg: #0f1f18;
  --surface: #163529;
  --surface-2: #1e4536;
  --text: #e8f2ed;
  --muted: #9fb8ad;
  --accent: #3ecf8e;
  --focus: #7ef0bf;
}

body.belt-theme-yellow {
  --bg: #1c1a0e;
  --surface: #2a2614;
  --surface-2: #363018;
  --text: #f5f0e0;
  --muted: #b8a878;
  --accent: #e8c547;
  --focus: #f5dc7a;
}

body.belt-theme-orange {
  --bg: #1c120a;
  --surface: #2a1a10;
  --surface-2: #3a2416;
  --text: #f5ebe3;
  --muted: #c49a7a;
  --accent: #f0884a;
  --focus: #ffb07a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}

body {
  margin: 0 auto;
  max-width: 28rem;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding: 0;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body.belt-picker-mode {
  padding: 0;
}

#app-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: calc(8px + var(--safe-top)) 16px var(--safe-bottom);
}

#app-main[hidden] {
  display: none !important;
}

.site-header {
  flex-shrink: 0;
  margin-bottom: 4px;
}

.belt-gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: calc(16px + var(--safe-top));
  padding-bottom: calc(16px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg) 92%, #000);
}

.belt-gate[hidden] {
  display: none !important;
}

.belt-gate-card {
  width: 100%;
  max-width: 22rem;
  padding: 22px 18px;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.belt-gate-title {
  margin: 0 0 18px;
  font-size: 1.25rem;
  font-weight: 700;
}

.belt-gate-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.belt-pick-btn {
  min-height: 52px;
  padding: 14px 16px;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}

.belt-picker-mode .belt-pick-btn[data-belt="green"] {
  color: #fff;
  background: linear-gradient(180deg, #4a9474 0%, #3d7d62 100%);
  border: 1px solid #5aa888;
}

.belt-picker-mode .belt-pick-btn[data-belt="yellow"] {
  color: #fff;
  background: linear-gradient(180deg, #c4ad58 0%, #a89448 100%);
  border: 1px solid #d4bc68;
}

.belt-picker-mode .belt-pick-btn[data-belt="orange"] {
  color: #fff;
  background: linear-gradient(180deg, #d08858 0%, #b87448 100%);
  border: 1px solid #e09868;
}

.belt-pick-btn--current {
  box-shadow: 0 0 0 3px var(--focus);
}

.back-belts-btn {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin: 0;
  padding: 4px 0;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
}

.back-belts-btn:hover {
  color: var(--accent);
}

.back-belts-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.belt-pick-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.toolbar-label {
  margin: 0 0 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.list-toolbar .toolbar-label:not(:first-child) {
  margin-top: 12px;
}

.player-panel {
  flex-shrink: 0;
  margin-bottom: 10px;
  padding: 0;
  background: transparent;
  border: none;
}

.embed-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 40dvh;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.list-toolbar {
  flex-shrink: 0;
  z-index: 3;
  margin: 0 0 8px;
  padding: 0 0 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-heading[hidden] {
  display: none !important;
}

.list-toolbar .waza-group-heading {
  margin: 0;
  padding: 0 2px;
}

.list-main {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.list-main::-webkit-scrollbar {
  display: none;
}

.belt-tabs,
.section-tabs,
.group-tabs {
  display: flex;
  gap: 4px;
  padding: 5px 10px 5px 5px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: color-mix(in srgb, var(--surface) 85%, #000);
  border: 1px solid color-mix(in srgb, var(--surface-2) 70%, transparent);
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 6%, transparent),
    0 4px 14px rgba(0, 0, 0, 0.22);
}

.pill-tabs::-webkit-scrollbar {
  display: none;
}

.belt-tab,
.section-tab,
.group-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.belt-tab:hover,
.section-tab:hover,
.group-tab:hover {
  color: var(--text);
  background: color-mix(in srgb, #fff 5%, transparent);
}

.belt-tab:focus-visible,
.section-tab:focus-visible,
.group-tab:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.belt-tab:focus:not(:focus-visible),
.section-tab:focus:not(:focus-visible),
.group-tab:focus:not(:focus-visible) {
  outline: none;
}

.belt-tab.is-active,
.section-tab.is-active,
.group-tab.is-active {
  color: var(--bg);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 92%, #fff) 0%,
    var(--accent) 100%
  );
  box-shadow:
    0 1px 0 color-mix(in srgb, #fff 35%, transparent),
    0 3px 10px color-mix(in srgb, var(--accent) 45%, transparent);
}

.syllabus-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.syllabus-section > .waza-group-heading .group-name {
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: -0.01em;
}

.waza-group + .waza-group {
  margin-top: 4px;
}

#list-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
}

.waza-group-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 10px;
}

.waza-group-heading .group-name {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.waza-group-heading .group-meaning {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--muted);
}

.waza-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.throw-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.throw-btn-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.throw-btn-english {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--muted);
}

.throw-btn:hover {
  background: var(--surface-2);
}

.throw-btn:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.throw-btn.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.empty-state {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 8px 0;
}

.footer-note {
  flex-shrink: 0;
  margin: 0;
  padding: 8px 0 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-note a {
  color: var(--accent);
}

.footer-note a:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
