/* Panels: house, workshop, ship, island, stats, route editor, tutorial card + spotlight. Shared by desktop and the
   phone sheets (the phone restyles the frame only). */

.panel__img {
  flex: none;
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(36, 27, 18, 0.3));
}
.panel__img--good {
  width: 46px;
  height: 46px;
  margin: 5px;
}
.panel__sub .portrait {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: -4px;
  margin-right: 3px;
  box-shadow: 0 0 0 1.5px var(--tone);
}
.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 2px 0 4px;
}
.kpi {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(246, 232, 197, 0.75);
  box-shadow: inset 0 0 0 1px var(--paper-300);
}
.kpi__top {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 16px;
  white-space: nowrap;
}
.kpi__top .glyph {
  color: var(--text-2);
}
.kpi__top small {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.kpi__cap {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi .bar {
  margin-top: 2px;
}
.mood {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mood--ok .glyph {
  color: var(--good-ui);
}
.need-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 10px 4px;
}
.need-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 11.5px;
}
.need-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.need-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.rules {
  display: grid;
  gap: 4px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}
.rules li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.rules .ok {
  color: var(--good);
}
.rules .no {
  color: var(--bad);
}
.upgrade-box {
  padding: 10px;
  border-radius: 7px;
  background: rgba(246, 232, 197, 0.75);
  box-shadow: inset 0 0 0 1px var(--paper-300);
}
.upgrade-box__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
}
.upgrade-box__head .portrait {
  width: 26px;
  height: 26px;
}
.upgrade-box__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* workshop */
.prod-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 6px;
}
.prod-ring {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 68px;
  height: 68px;
}
.prod-ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
.prod-ring__n {
  font-size: 18px;
}
.prod-ring__n small {
  font-size: 11px;
}
.prod-status {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.prod-status__why {
  color: var(--text-2);
  font-size: 12.5px;
}
.buffers {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 7px;
  background: rgba(246, 232, 197, 0.75);
  box-shadow: inset 0 0 0 1px var(--paper-300);
}
.buffers__group {
  display: flex;
  gap: 6px;
}
.buffer {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 56px;
}
.buffer img {
  width: 36px;
  height: 36px;
}
.buffer__pips {
  display: flex;
  gap: 2px;
}
.buffer__pips i {
  width: 9px;
  height: 6px;
  border-radius: 1.5px;
  background: rgba(36, 27, 18, 0.16);
}
.buffer__pips i.on {
  background: var(--good-ui);
}
.buffer.is-empty .buffer__pips i {
  background: rgba(163, 31, 18, 0.25);
}
.buffer__name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}
.buffer .need__flag {
  top: -4px;
  right: 2px;
}
.buffers__arrow {
  display: grid;
  justify-items: center;
  gap: 3px;
  flex: 1;
  color: var(--muc-500);
  min-width: 34px;
}
.buffers__arrow .bar {
  width: 100%;
  height: 4px;
}
.buffers__arrow small {
  color: var(--text-muted);
  font-size: 10.5px;
  white-space: nowrap;
}
.facts-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}
.facts-list .fact {
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(246, 232, 197, 0.6);
  box-shadow: inset 0 0 0 1px var(--paper-300);
}
.fact__v {
  font-size: 13.5px;
}
.fact__l {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.1;
}
.sources {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.source {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  font-size: 12.5px;
}
.source img {
  width: 30px;
  height: 30px;
}
.source__name {
  flex: 1;
  min-width: 0;
}
.note-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 12px;
}
.note-line .glyph {
  margin-top: 1px;
}

/* ship */
.ship-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(70, 121, 138, 0.14);
  color: var(--info);
  font-size: 13px;
  font-weight: 600;
}
.ship-status .num {
  margin-left: auto;
}
.cargo {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.cargo__slot {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  aspect-ratio: 1;
  min-height: 56px;
  padding: 4px;
  border: 1px solid var(--paper-400);
  border-radius: 7px;
  background: radial-gradient(circle at 50% 35%, var(--paper-50), var(--paper-200));
}
.cargo__slot img {
  width: 34px;
  height: 34px;
}
.cargo__n {
  font-size: 12px;
}
.cargo__fill {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 4px;
  height: 3px;
  border-radius: 2px;
  background: rgba(36, 27, 18, 0.14);
  overflow: hidden;
}
.cargo__fill i {
  display: block;
  height: 100%;
  background: var(--song-500);
}
.cargo__slot.is-empty {
  border-style: dashed;
  background: transparent;
  color: var(--muc-400);
}
.stops {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: stop;
}
.stop {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 2px 8px;
  padding: 6px 0 8px;
}
.stop + .stop::before {
  content: '';
  position: absolute;
  left: 13px;
  top: -10px;
  height: 16px;
  border-left: 2px dotted var(--muc-500);
}
.stop__n {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper-50);
  box-shadow: inset 0 0 0 1.5px var(--muc-500);
  font: 700 13px/1 var(--font-num);
}
.stop.is-next .stop__n {
  background: var(--song-500);
  color: var(--paper-50);
  box-shadow: 0 0 0 3px rgba(70, 121, 138, 0.3);
}
.stop__where {
  align-self: center;
  font-weight: 700;
  font-size: 13px;
}
.stop__where small {
  color: var(--info);
  font-weight: 600;
  margin-left: 4px;
}
.stop__acts {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.act {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 26px;
  padding: 0 7px 0 3px;
  border-radius: 999px;
  background: var(--paper-50);
  box-shadow: inset 0 0 0 1px var(--paper-400);
  font-size: 12px;
}
.act img {
  width: 20px;
  height: 20px;
}
.act .glyph {
  color: var(--text-2);
}
.act--sell .glyph {
  color: var(--good-ui);
}

/* island panel */
.isl-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 10px 0 2px;
  color: var(--text-2);
  font-size: 12.5px;
}
.isl-summary .stat .glyph {
  color: var(--text-2);
}
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.store {
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto auto;
  gap: 1px 8px;
  align-items: center;
  min-height: 56px;
  padding: 6px 8px;
  border: 1px solid var(--paper-300);
  border-radius: 7px;
  background: rgba(246, 232, 197, 0.8);
  text-align: left;
}
.store img {
  grid-row: 1 / 4;
  width: 38px;
  height: 38px;
}
.store__name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.store__name .num {
  font-size: 13.5px;
}
.store__name .num small {
  color: var(--text-muted);
  font-size: 11px;
}
.store__meta {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  font-size: 11.5px;
  white-space: nowrap;
}
.store__keep {
  color: var(--text-muted);
}
.store.is-low {
  border-color: var(--nghe-ui);
}
.need-rows {
  display: grid;
  gap: 0;
}
.need-row {
  display: grid;
  grid-template-columns: 34px minmax(80px, 1.2fr) minmax(90px, 1.4fr) 68px auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 3px 4px;
  border-bottom: 1px solid var(--paper-300);
  font-size: 12.5px;
}
.need-row img {
  width: 30px;
  height: 30px;
}
.need-row__name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.need-row__name small {
  display: block;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
}
.need-row__bar {
  display: grid;
  gap: 2px;
}
.need-row__bar .bar {
  height: 6px;
}
.need-row__bar small {
  color: var(--text-muted);
  font-size: 11px;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}
.switch__track {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--paper-300);
  box-shadow: inset 0 0 0 1px var(--paper-400);
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper-50);
  box-shadow: 0 1px 2px rgba(36, 27, 18, 0.35);
}
.switch.is-on .switch__track {
  background: var(--son-400);
}
.switch.is-on .switch__track::after {
  left: 16px;
}
.tier-block {
  margin-top: 6px;
}
.tier-block__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 6px 0;
}
.tier-block__head .portrait {
  width: 34px;
  height: 34px;
}
.tier-block__name {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--tone);
}
.tier-block__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--text-2);
  font-size: 12px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.table th {
  padding: 4px 6px;
  border-bottom: 1px solid var(--paper-400);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}
.table th:first-child,
.table td:first-child {
  text-align: left;
}
.table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--paper-300);
  text-align: right;
  white-space: nowrap;
}
.table .good-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}
.table .good-cell img {
  width: 26px;
  height: 26px;
}
.request {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(121, 87, 123, 0.12);
  box-shadow: inset 0 0 0 1px rgba(121, 87, 123, 0.35);
  font-size: 12.5px;
}
.request img {
  width: 36px;
  height: 36px;
}
.request__text {
  flex: 1;
  min-width: 0;
}
.request__text b {
  display: block;
  color: var(--luxury);
}
.offer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--paper-300);
  font-size: 12.5px;
}
.offer img {
  width: 28px;
  height: 28px;
}
.offer__side {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 52px;
  font-weight: 700;
}
.offer__side.is-sell {
  color: var(--good);
}
.offer__side.is-buy {
  color: var(--info);
}
.offer__note {
  flex: 1;
  color: var(--text-muted);
}
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 6px 22px;
}

/* stats */
.stats-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-bottom: 4px;
}
.select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: max(30px, var(--tap));
  padding: 0 8px 0 10px;
  border: 1px solid var(--paper-400);
  border-radius: 5px;
  background: var(--paper-50);
  font-size: 12.5px;
  font-weight: 600;
}
.spark {
  display: inline-block;
  vertical-align: middle;
}
.spark path {
  fill: none;
  stroke: var(--song-500);
  stroke-width: 1.5;
}
.spark .area {
  fill: rgba(70, 121, 138, 0.14);
  stroke: none;
}
.idle-icons {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
}
.idle-icon {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--warn);
  font-weight: 700;
}
.fin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 56px;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  font-size: 12.5px;
}
.fin-row .bar {
  height: 8px;
}
.fin-row .num {
  text-align: right;
}
.fin-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(70, 125, 34, 0.12);
  font-weight: 700;
}
.fin-total .num {
  font-size: 18px;
}

/* tutorial card (left column; phone: the guidance card) */
.tutorial {
  overflow: visible;
}
.tutorial__crest {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -10px -12px 8px;
  padding: 8px 10px 8px 12px;
  background: var(--lacquer-red);
  border-bottom: 1px solid var(--vang-500);
  color: var(--paper-50);
}
.tutorial__chapter {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 1.15;
}
.tutorial__chapter small {
  color: var(--vang-200);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tutorial__chapter b {
  font-family: var(--font-title);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tutorial__crest .icon-btn {
  width: max(28px, var(--tap));
  height: max(28px, var(--tap));
  background: rgba(9, 8, 6, 0.25);
}
.tutorial__scene {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.tutorial__scene .advisor {
  flex: none;
}
.tutorial__say {
  position: relative;
  flex: 1;
  margin: 2px 0 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--paper-50);
  box-shadow: inset 0 0 0 1px var(--paper-400);
  font-size: 12.5px;
  font-style: italic;
  line-height: 1.35;
}
.tutorial__say::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 16px;
  width: 10px;
  height: 10px;
  background: var(--paper-50);
  border-left: 1px solid var(--paper-400);
  border-bottom: 1px solid var(--paper-400);
  transform: rotate(45deg);
}
.tutorial__who {
  display: block;
  margin-bottom: 2px;
  color: var(--text-title);
  font-style: normal;
  font-weight: 700;
  font-size: 11.5px;
}
.tutorial__goal {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(213, 183, 143, 0.38);
}
.tutorial__step {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.tutorial__goal-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.25;
}
.tutorial__goal-text img {
  width: 30px;
  height: 30px;
  flex: none;
}
.tutorial__unlocked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.tutorial__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.tutorial__dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
}
.tutorial__dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper-300);
  box-shadow: inset 0 0 0 1px var(--muc-500);
}
.tutorial__dots i.done {
  background: var(--good-ui);
  box-shadow: none;
}
.tutorial__dots i.now {
  background: var(--son-400);
  box-shadow: 0 0 0 2px rgba(124, 25, 15, 0.25);
}

/* spotlight: a dimmed layer with a soft hole around what the step points at (pointer-events: none) */
.spotlight {
  position: absolute;
  z-index: 30;
  border-radius: 12px;
  box-shadow: 0 0 0 200vmax rgba(9, 8, 6, 0.62), 0 0 0 3px var(--vang-200), 0 0 18px 6px rgba(239, 200, 112, 0.7);
  pointer-events: none;
}
.spotlight__label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  transform: translateX(-50%);
  padding: 6px 12px;
  border: 1px solid var(--then-900);
  border-radius: 999px;
  background: var(--lacquer-red);
  box-shadow: inset 0 0 0 1px var(--vang-500), var(--shadow);
  color: var(--paper-50);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.spotlight__label::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: var(--son-600);
  transform: translateX(-50%) rotate(45deg);
}

/* route editor */
.route-stop {
  position: relative;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid var(--paper-400);
  border-radius: 8px;
  background: rgba(246, 232, 197, 0.85);
}
.route-stop__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.route-stop__head b {
  flex: 1;
  font-size: 13.5px;
}
.route-stop__meta {
  color: var(--text-muted);
  font-size: 11.5px;
}
.route-act {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 2px 0;
  border-top: 1px dashed var(--paper-400);
  font-size: 12.5px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--paper-400);
  border-radius: 6px;
  overflow: hidden;
}
.seg button {
  min-height: max(28px, var(--tap));
  padding: 0 9px;
  border: 0;
  background: var(--paper-50);
  font-size: 12px;
  font-weight: 600;
}
.seg button + button {
  border-left: 1px solid var(--paper-400);
}
.seg button.is-on {
  background: var(--son-400);
  color: var(--paper-50);
}
.good-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 600;
}
.good-pick img {
  width: 26px;
  height: 26px;
}
.amount {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.amount input {
  width: 46px;
  min-height: max(28px, var(--tap));
  padding: 0 4px;
  border: 1px solid var(--paper-400);
  border-radius: 5px;
  background: var(--paper-50);
  font: 600 13px var(--font-num);
  text-align: center;
}
.prod-ring svg {
  width: 100%;
  height: 100%;
}
.prod-ring .ring__track {
  fill: var(--paper-50);
  stroke: rgba(36, 27, 18, 0.14);
}
.prod-ring .ring__fill {
  fill: none;
  stroke: var(--warn-ui);
  stroke-linecap: round;
}
.prod-ring__n {
  position: relative;
}
.tutorial__actions .btn {
  flex: 1 1 auto;
}
.tutorial__actions .btn--primary {
  flex: 1 0 100%;
}
.tutorial__chapter b {
  white-space: normal;
}
.need-row__name {
  white-space: normal;
}
.big-panel {
  container: bigpanel / inline-size;
}
.big-panel .tabs {
  overflow-x: auto;
  scrollbar-width: none;
}
.big-panel .tab {
  flex: none;
}
@container bigpanel (max-width: 560px) {
  .big-panel .tab {
    padding: 0 10px;
  }
  .stats-filter .select {
    font-size: 0;
    gap: 2px;
  }
  .stats-filter .select .glyph {
    width: 16px;
    height: 16px;
  }
  .big-panel .need-row {
    grid-template-columns: 30px minmax(70px, 1fr) minmax(80px, 1.2fr) auto;
  }
  .big-panel .need-row > .num {
    display: none;
  }
  .big-panel .table .opt {
    display: none;
  }
}
