/* Buttons */
.btn {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  margin: 0;
  padding: 0 24px;
  border: 0;
  border-radius: var(--radius-pill);
  font-size: var(--fs-body);
  line-height: var(--lh-text);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}

.btn--primary {
  background: var(--grad-cta);
  color: var(--on-violet);
  box-shadow: var(--glow-cta);
}

.btn--outline {
  background: var(--canvas);
  border: 2px solid var(--neon);
  color: var(--ink);
}

.btn--block {
  display: flex;
  width: 100%;
  min-height: 60px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--neon);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

/* Cards */
.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.card--decision {
  background: var(--surface-raised);
  border: 2px solid var(--neon);
  box-shadow: var(--glow-neon);
}

/* Avatar */
.avatar {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--size, 36px);
  height: var(--size, 36px);
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  font-weight: 600;
}

.avatar--violet {
  background: var(--violet);
  color: var(--on-violet);
}

.avatar--neon {
  background: var(--neon);
  color: var(--canvas);
}

.avatar--gold {
  background: var(--gold);
  color: var(--on-gold);
}

.avatar--night {
  background: var(--surface-raised);
  border: 2px solid var(--neon);
  color: var(--ink);
}

.avatar--offline {
  opacity: 0.5;
}

.avatar__dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--canvas);
}

.avatar__off {
  position: absolute;
  right: -6px;
  bottom: -6px;
  display: flex;
  color: var(--ink);
}

/* Facts strip */
.fact {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0 10px;
  white-space: nowrap;
}

.fact__label {
  display: flex;
  flex-direction: column;
  min-height: 45px;
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.fact__title {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fact__value {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 32px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.fact--risk .fact__value {
  color: var(--markdown);
}

.fact--gold .fact__value {
  color: var(--gold);
}

.fact__foot {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.stepper__btn {
  appearance: none;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--neon);
  border-radius: var(--radius-pill);
  background: var(--canvas);
  color: var(--ink);
  cursor: pointer;
}

.stepper__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.stepper__readout {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-width: 132px;
  padding-left: 28px;
}

.stepper__value {
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 68px;
  line-height: 0.82;
  font-variant-numeric: tabular-nums;
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold);
}

.stepper__unit {
  flex: none;
  width: 20px;
  margin-left: 0;
  font-size: var(--fs-body);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

/* Hold to send */
.hold-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hold {
  overflow: hidden;
  gap: 10px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.hold__ring {
  position: relative;
  flex: none;
  transform: rotate(-90deg);
}

.hold__track,
.hold__bar {
  fill: none;
  stroke-width: 3;
}

.hold__track {
  stroke: rgba(255, 255, 255, 0.28);
}

.hold__bar {
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-dasharray: 106.8;
  stroke-dashoffset: 106.8;
}

.hold--active .hold__bar {
  animation: hold-fill var(--hold-ms) linear forwards;
}

.hold__label {
  position: relative;
}

@keyframes hold-fill {
  to {
    stroke-dashoffset: 0;
  }
}

.hold__confirm {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
}

.hold__confirm .btn {
  min-height: 60px;
}

/* Sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(6, 5, 42, 0.6);
}

.sheet {
  width: 100%;
  max-width: 430px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: var(--surface-raised);
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet__body {
  min-height: 0;
  overflow-y: auto;
}

/* Timer */
.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.timer-pill__word {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.timer-pill__time {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.timer-pill--paused .timer-pill__time {
  color: var(--ink-muted);
}

.bar {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--line);
}

.bar__fill {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--neon);
}

/* Notice and banner */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-raised);
  color: var(--ink-muted);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
}

.notice--risk {
  border-color: var(--markdown);
  background: var(--markdown-soft);
  color: var(--ink);
}

.notice--risk .icon {
  color: var(--markdown);
}

.banner {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
}

/* Language toggle */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted);
}

.lang-toggle__btn {
  appearance: none;
  min-width: 56px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--neon);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  font-weight: 500;
  cursor: pointer;
}

.lang-toggle__btn[aria-pressed="true"] {
  background: var(--violet);
  border-color: var(--violet);
  color: var(--on-violet);
}

/* Brand */
.mascot {
  display: block;
  width: 100%;
  height: auto;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
}

.logo {
  display: block;
  height: 28px;
  width: auto;
}

/* App shells */
.shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 16px;
  min-height: 100dvh;
}

.shell--host {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.shell--screen {
  padding: 40px 48px;
}

.shell__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.live-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  font-weight: 600;
}

.live-line > :not(:first-child)::before {
  content: "·";
  margin-right: 12px;
  color: var(--ink-faint);
}

.shell--screen .live-line {
  font-size: 48px;
}

.shell__code {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.signin {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
}

.signin__label {
  font-size: var(--fs-small);
  line-height: var(--lh-text);
  color: var(--ink-muted);
}

.signin__input {
  height: 52px;
  padding: 0 16px;
  border: 2px solid var(--neon);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--fs-body);
}

/* The component gallery (tools/e2e/components.mjs) */
.gallery__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.gallery__facts {
  display: flex;
}

.gallery__mascot {
  width: 140px;
}

/* Level emblems and badges */
.emblem {
  display: block;
  flex: none;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-num);
  font-weight: 700;
  line-height: var(--lh-text);
}

.level-lines {
  white-space: pre-line;
}

.gallery__panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.gallery__panel--canvas {
  background: var(--canvas);
}

.gallery__panel--raised {
  background: var(--surface-raised);
}

.gallery__lesson {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
