/* ==== components: one class per component, states written once ====
   colour = meaning: green = you can act, cyan = selected, pink = now / new, gold = reward, red = danger */

/* ---- states ---- */
.btn,
.tab,
.chip,
.seg > button,
.select,
button.pill {
  transition:
    transform var(--dur-press) var(--ease-spring),
    filter var(--dur-state),
    box-shadow var(--dur-state),
    background var(--dur-state);
}
.btn:active,
.tab:active,
.chip:active,
.seg > button:active,
.select:active,
button.pill:active {
  transform: translateY(2px) scale(0.96);
}
.btn:not(.link):active {
  box-shadow: none;
}
@media (hover: hover) {
  .btn:hover,
  .tab:hover,
  .chip:hover,
  .seg > button:hover,
  .select:hover,
  button.pill:hover,
  button.card:hover,
  .card[role='button']:hover,
  .card[data-sel]:hover {
    filter: brightness(1.08);
  }
}

/* ---- buttons ---- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--ctl-md);
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  background: var(--g-primary);
  border: var(--stroke-3) solid var(--c-ink);
  color: var(--c-on-primary);
  font-size: var(--font-md);
  line-height: var(--lh-tight);
  white-space: nowrap;
  box-shadow: var(--shadow-key);
  touch-action: none;
}
.btn.lg {
  min-height: var(--ctl-lg);
  padding: 0 var(--space-6);
  border-radius: var(--radius-lg);
  font-size: var(--font-lg);
}
.btn.lg small {
  display: block;
  font-size: var(--font-sm);
  line-height: var(--lh-tight);
}
/* one price model: verb on top, currency xs + value below */
.btn.price {
  flex-direction: column;
  gap: 0;
  min-width: 104px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-sm);
}
.btn.price .pr {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-md);
}
.btn.ghost {
  background: var(--g-neutral);
  border: var(--stroke-2) solid var(--c-line-strong);
  color: var(--c-text);
}
.btn.icon {
  width: var(--ctl-md);
  height: var(--ctl-md);
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--g-neutral);
  border: var(--stroke-2) solid var(--c-ink);
  color: var(--c-text);
}
.btn.link {
  min-height: var(--ctl-md);
  padding: 0 var(--space-3);
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--c-accent);
  font-size: var(--font-sm);
  text-decoration: underline;
}
.btn.danger {
  background: var(--c-danger);
  color: var(--c-text);
}
.btn.link.danger {
  background: none;
  color: var(--c-danger-soft);
}
.btn.armed {
  background: linear-gradient(var(--c-gold-hi), var(--c-warn));
  color: var(--c-on-primary);
}
.btn.is-sel {
  background: var(--c-surface-1);
  color: var(--c-text);
  border-color: var(--c-ink);
  box-shadow: var(--glow-accent);
}
/* disabled: one look (the reason is written on or next to the button) */
.btn.off,
.btn:disabled {
  background: var(--c-surface-2);
  color: var(--c-text-3);
  box-shadow: none;
  cursor: default;
}
.btn.link:disabled {
  background: none;
  opacity: 0.55;
}
.cam-arrow.prev .ico {
  transform: rotate(90deg);
}
.cam-arrow.next .ico {
  transform: rotate(-90deg);
}
.cam-arrow:disabled {
  opacity: 0.55;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.reset {
  display: block;
  margin: var(--space-3) auto 0;
}
.reset.holding {
  background: linear-gradient(90deg, var(--c-accent-2-soft) 0 100%, transparent 0) no-repeat;
  background-size: 0 100%;
  animation: holdFill 2s linear forwards;
}
@keyframes holdFill {
  to {
    background-size: 100% 100%;
  }
}

/* ---- HUD pill: money, gems, income, base, hype, robots, buy amount ---- */
.pill {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--ctl-md);
  min-width: 0;
  padding: 0 var(--space-4) 0 var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--c-well);
  border: var(--stroke-2) solid var(--c-line);
  color: var(--c-text-2);
}
.pill .val {
  flex: 1;
  min-width: 0;
  font-size: var(--font-lg);
  color: var(--c-text);
  letter-spacing: -0.3px;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
}
.pill .btn {
  min-height: 0;
  height: var(--ctl-sm);
  padding: 0 var(--space-3);
  border-width: var(--stroke-2);
  font-size: var(--font-sm);
}
.pill .btn::after {
  content: '';
  position: absolute;
  inset: calc(-1 * var(--space-3));
} /* touch area 44 */
.pill .btn.icon {
  width: var(--ctl-sm);
  padding: 0;
  background: var(--g-primary);
}

/* ---- card: one dark theme ---- */
.card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--c-surface-1);
  border: var(--stroke-2) solid var(--c-line);
  box-shadow: var(--shadow-drop-1);
  color: var(--c-text);
  text-align: left;
}
.card.is-ok {
  border-color: var(--c-success);
}
.card.is-ready {
  border-color: var(--c-gold);
}
.card.is-sel {
  box-shadow: var(--glow-accent);
}
.card.is-locked {
  opacity: 0.55;
}
.card-art {
  width: 56px;
  height: 56px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: var(--stroke-2) solid var(--c-ink);
  background: radial-gradient(circle at 50% 40%, var(--c-violet-mid), var(--c-surface-3));
}
.card-art.sm {
  width: var(--ctl-md);
  height: var(--ctl-md);
}
.card-art .ico {
  transform: translateY(6px);
} /* crew portraits: head and shoulders */
.card-art.fit {
  background: var(--c-bg);
}
.card-art.fit .ico {
  transform: none;
}
.card-art.swatch {
  border-color: var(--c-ink);
}
.cm-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.cm-name {
  font-size: var(--font-md);
  color: var(--c-text);
  line-height: var(--lh-tight);
  overflow-wrap: break-word;
  hyphens: manual;
}
.cm-role {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-sm);
  color: var(--c-text-2);
}
.cm-quote {
  font-size: var(--font-sm);
  color: var(--c-text-2);
  font-weight: 700;
}
.cm-trait {
  font-size: var(--font-xs);
  color: var(--c-accent-2-pale);
  font-weight: 700;
  margin-top: var(--space-1);
}
.cm-buy {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}
.need {
  font-size: var(--font-xs);
  color: var(--c-text-3);
  text-align: center;
  max-width: 120px;
}
.maxed {
  color: var(--c-primary);
  font-size: var(--font-md);
  text-align: center;
}
.pips {
  display: inline-flex;
  gap: var(--space-1);
}
.pips i {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-xs);
  background: var(--c-well);
  border: var(--stroke-1) solid var(--c-ink);
}
.pips i.on {
  background: var(--c-success);
}
.lvbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.lvbar b {
  font-size: var(--font-sm);
  color: var(--c-text-2);
  min-width: 44px;
}
.lvbar .bar {
  flex: 1;
}

/* ---- tag, badge, bar ---- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  align-self: center;
  flex: none;
  height: 20px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--c-surface-2);
  color: var(--c-text-2);
  font-size: var(--font-xs);
  white-space: nowrap;
  -webkit-text-stroke: 0;
}
.tag.ok {
  height: auto;
  min-height: 20px;
  background: var(--c-primary-mid);
  color: var(--c-text);
}
.badge {
  display: none;
  position: absolute;
  right: var(--space-1);
  top: var(--space-1);
  width: 12px;
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--c-danger);
  border: var(--stroke-2) solid var(--c-ink);
  box-shadow: 0 0 6px var(--c-danger);
} /* a dot, no glyph */
.bar {
  display: block;
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--c-well);
  border: var(--stroke-2) solid var(--c-ink);
  overflow: hidden;
  position: relative;
}
.pill .bar,
.card .bar {
  background: var(--c-surface-1);
  border-color: var(--c-line-strong);
} /* the track reads at 0% on the same dark as the pill */
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  transition: width 0.25s ease-out;
}
.bar.purple i {
  background: linear-gradient(var(--c-violet-hi), var(--c-violet));
  box-shadow: var(--shadow-shine);
}
.bar.green i {
  background: var(--g-primary);
  box-shadow: var(--shadow-shine);
}
.bar.gold i {
  background: linear-gradient(var(--c-gold-hi), var(--c-warn));
}

/* ---- inner tabs (segment) and filters (chip): active = the tab-bar neon ---- */
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  background: var(--c-bg);
}
.seg3 {
  grid-template-columns: repeat(3, 1fr);
}
.seg > button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--ctl-md);
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--font-md);
  color: var(--c-text-2);
}
.seg3 > button {
  padding: 0 var(--space-3);
  font-size: var(--font-sm);
}
.seg b {
  font-size: var(--font-sm);
  opacity: 0.85;
}
.filters {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  padding: var(--space-1) var(--space-6) var(--space-1) var(--space-1);
  scrollbar-width: none;
}
.filters.more {
  -webkit-mask-image: linear-gradient(90deg, var(--c-bg-deep) 85%, transparent);
  mask-image: linear-gradient(90deg, var(--c-bg-deep) 85%, transparent);
} /* fade only while more chips hide to the right */
.filters::-webkit-scrollbar {
  display: none;
}
.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  height: 36px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--c-surface-2);
  border: var(--stroke-2) solid var(--c-line);
  font-size: var(--font-sm);
  color: var(--c-text-2);
}
.chip::after {
  content: '';
  position: absolute;
  inset: calc(-1 * var(--space-3)) 0;
} /* 44 px touch height (the box is 32 inside its border) */
.seg > button.on,
.chip.on {
  background: var(--c-surface-1);
  color: var(--c-text);
  box-shadow: var(--glow-accent);
}

/* ---- dropdown (language) ---- */
.lang-pick {
  position: relative;
}
.select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  height: var(--ctl-md);
  padding: 0 var(--space-3) 0 var(--space-4);
  border-radius: var(--radius-md);
  background: var(--g-neutral);
  border: var(--stroke-2) solid var(--c-line-strong);
  color: var(--c-text);
  font-size: var(--font-md);
  white-space: nowrap;
  box-shadow: var(--shadow-key);
}
.select-t {
  overflow: hidden;
  text-overflow: ellipsis;
}
/* the list opens in the window's flow: it scrolls, never cuts, never covers the controls below it */
.select-menu {
  margin-top: var(--space-2);
  min-width: 100%;
  max-height: min(260px, calc(38vh / var(--z)));
  overflow-y: auto;
  padding: var(--space-2);
  list-style: none;
  background: var(--c-surface-1);
  border: var(--stroke-2) solid var(--c-line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}
.select-menu li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--ctl-md);
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  cursor: pointer;
  color: var(--c-text-2);
  font-size: var(--font-md);
}
.select-menu li:hover {
  background: var(--c-surface-3);
}
.select-menu li.on {
  background: var(--c-surface-2);
  color: var(--c-text);
}
.select-menu li[lang='ja'],
.select-menu li[lang='zh'],
.select-menu li[lang='ko'] {
  font-family: 'Hiragino Sans', 'Yu Gothic UI', 'Microsoft YaHei', 'Malgun Gothic', system-ui, sans-serif;
}

/* ---- slider (volume) ---- */
.slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: var(--ctl-md);
  background: transparent;
  cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: var(--radius-pill);
  border: var(--stroke-2) solid var(--c-ink);
  background: linear-gradient(90deg, var(--c-accent) var(--v, 50%), var(--c-well) var(--v, 50%));
  box-sizing: content-box;
}
.slider::-moz-range-track {
  height: 8px;
  border-radius: var(--radius-pill);
  border: var(--stroke-2) solid var(--c-ink);
  background: var(--c-well);
}
.slider::-moz-range-progress {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--c-accent);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: calc((8px - 24px) / 2 - var(--stroke-2));
  border-radius: var(--radius-pill);
  background: var(--c-text);
  border: var(--stroke-3) solid var(--c-ink);
  box-shadow: var(--shadow-drop-1);
}
.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--c-text);
  border: var(--stroke-3) solid var(--c-ink);
}

/* ---- notices ---- */
.sub {
  color: var(--c-text-2);
  font-size: var(--font-sm);
  font-weight: 700;
}
.note {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--c-primary-night);
  border: var(--stroke-2) solid var(--c-primary-lo);
  color: var(--c-primary-pale);
  font-size: var(--font-sm);
  font-weight: 700;
}
.note.warn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  background: var(--c-gold-night);
  border-color: var(--c-warn);
  color: var(--c-gold-pale);
}

/* ---- toast ---- */
#ticker {
  position: absolute;
  top: 60px;
  right: var(--space-3);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: max-content;
  max-width: min(64%, 320px);
  min-height: var(--ctl-md);
  padding: var(--space-3) var(--space-5) var(--space-3) var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--g-window);
  border: var(--stroke-2) solid var(--c-accent-2);
  box-shadow: var(--shadow-float), var(--glow-now);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(14px) scale(0.92);
  transform-origin: top right;
}
#ticker.tk-on {
  opacity: 1;
  transform: none;
  transition:
    transform 0.42s cubic-bezier(0.25, 1.6, 0.5, 1),
    opacity 0.2s;
}
#ticker.tk-story {
  border-color: var(--c-accent);
  box-shadow: var(--shadow-float), var(--glow-accent-soft);
}
#ticker.tk-prize {
  border-color: var(--c-gold);
  box-shadow: var(--shadow-float), var(--halo-gold);
} /* stars, targets, base level: rewards look like rewards */
#ticker.tk-out {
  opacity: 0;
  transform: translateX(10px) scale(0.95);
  transition:
    transform 0.3s ease-in,
    opacity 0.3s;
}
#ticker:not(.tk-on):not(.tk-out) {
  visibility: hidden;
}
#app:has(#sheet.open) #ticker,
#app:has(#modal.open) #ticker {
  opacity: 0;
}
:where([data-layout='desk']) #ticker {
  top: 64px;
  right: var(--space-4);
  max-width: min(40%, 480px);
} /* wide rooms: a long notice stays on two lines, above the art */
:where([data-layout='desk'][data-size~='n']) #ticker {
  max-width: min(70%, 360px);
} /* narrow desktop: a wider, shorter toast */
:where([data-layout='land']) #ticker {
  top: 54px;
}
:where([data-layout='phone'], [data-layout='land'][data-size~='n']) #ticker {
  left: var(--space-3);
  right: var(--space-3);
  width: auto;
  max-width: none;
  transform-origin: top center;
} /* phones: a strip across the top of the room */
:where([data-layout='land']:not([data-size~='ln'])) #ticker {
  top: var(--space-3);
  max-width: min(72%, 420px);
} /* sideways phone: up in the wall band, a long notice on 2 lines, clear of the first row of plates */
:where([data-layout='land'][data-size~='n']:not([data-size~='ln'])) #ticker {
  left: calc(var(--space-3) * 2 + 64px);
  max-width: none;
} /* narrow: beside the x1 chip, not over it */ /* sideways phone: beside the x1 chip, not under it (a 3-line notice stayed clear of the first row of plates) */
:where([data-h~='xxs']) #ticker {
  top: auto;
  bottom: 6px;
}
:where([data-layout='phone'][data-size~='xs'], [data-layout='phone'][data-h~='s']) #ticker {
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
}
:where([data-layout='phone'][data-size~='xs'], [data-layout='phone'][data-h~='s']) #ticker .tk-txt,
:where([data-layout='phone'][data-size~='xs'], [data-layout='phone'][data-h~='s']) #ticker .tk-txt b {
  font-size: var(--font-xs);
} /* small phones: a shorter toast, clear of the first row of plates */ /* very short screens: the toast sits at the bottom edge */
#ticker .tk-ico {
  flex: none;
  width: var(--ico-md);
  height: var(--ico-md);
  display: grid;
  place-items: center;
}
#ticker.tk-prize .tk-ico {
  width: var(--ico-lg);
  height: var(--ico-lg);
}
#ticker .tk-ico .ico {
  max-width: var(--ico-lg);
  max-height: var(--ico-lg);
}
#ticker .tk-txt {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  line-height: var(--lh-body);
  font-size: var(--font-sm);
  color: var(--c-text-2);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
} /* never cut: a third line ends in an ellipsis */
:where([data-h~='xs']) #ticker .tk-txt {
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 70vw;
}
#ticker .tk-txt b {
  color: var(--c-gold);
  font-size: var(--font-md);
}
#ticker .tk-txt span .ico {
  vertical-align: -3px;
}
#ticker.tk-undo {
  pointer-events: auto;
}
.btn.tk-undo {
  margin-left: var(--space-3);
  min-height: var(--ctl-sm);
  padding: 0 var(--space-4);
  font-size: var(--font-sm);
  background: var(--c-accent);
}
.btn.tk-undo::after {
  content: '';
  position: absolute;
  inset: calc(-1 * var(--space-2));
}

/* ---- glossary tip and the "how to" highlight ---- */
.term-tip {
  position: fixed;
  z-index: var(--z-tip);
  pointer-events: none;
}
.tip {
  max-width: min(320px, calc(90vw / var(--z)));
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--c-surface-1);
  border: var(--stroke-2) solid var(--c-accent);
  color: var(--c-text-2);
  font-size: var(--font-sm);
  box-shadow: var(--shadow-float);
}
.tip b {
  color: var(--c-text);
}
.hint-glow,
.tut-glow {
  position: relative;
  z-index: 3;
  animation: hintPulse 1.6s ease-in-out infinite;
}
#app :is(.hint-glow, .tut-glow),
#room.hint-glow {
  outline: 3px solid var(--c-accent);
  outline-offset: 3px;
  box-shadow: var(--glow-hint);
}
#room.hint-glow {
  outline-offset: -6px;
}
@keyframes hintPulse {
  50% {
    box-shadow: var(--glow-hint-hi);
  }
}
/* a refused purchase: "N short" pops over the button for a moment (ui.js shortTip; screen px on the outer box, zoom inside) */
.short-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: var(--z-tip);
  pointer-events: none;
  opacity: 0;
}
.short-tip.on {
  animation: shortTip 1.4s ease-out forwards;
}
.short-in {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--c-surface-1);
  border: var(--stroke-2) solid var(--c-danger);
  color: var(--c-text);
  font-size: var(--font-sm);
  white-space: nowrap;
  box-shadow: var(--shadow-drop-2);
}
@keyframes shortTip {
  0% {
    opacity: 0;
    translate: 0 6px;
  }
  12%,
  75% {
    opacity: 1;
    translate: 0 0;
  }
  100% {
    opacity: 0;
    translate: 0 -4px;
  }
}

/* keyboard focus wins over every selected/active glow; it never changes a control's radius or border */
:root body :focus-visible:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
}
button:focus:not(:focus-visible) {
  outline: none;
}
/* portrait phones: a compact 2-line toast that fits the notice lane the scene keeps under the room pills */
:where([data-layout='phone']) #ticker {
  min-height: 0;
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-2);
}
:where([data-layout='phone']) #ticker .tk-txt b {
  font-size: var(--font-sm);
}
:where([data-layout='land']:not([data-size~='ln'])) #ticker {
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
  gap: var(--space-2);
}
:where([data-layout='land']:not([data-size~='ln'])) #ticker :is(.tk-txt, .tk-txt b) {
  font-size: var(--font-xs);
} /* the toast rides in the foot of the HUD column, above the meter */
.maxed.gift-tag {
  color: var(--c-text-2);
  font-size: var(--font-xs);
  max-width: 9em;
  line-height: var(--lh-tight);
} /* moving gift, not for sale */
/* End of css/components.css */
