:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: #e3eff8;
  background: #080f18;
  --muted: #96a9ba;
  --edge: #263744;
  --cyan: #8eeeff;
  --surface: #121f2b;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
h1, h2, p { margin: 0; }

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3.4vw, 3.25rem);
  border-bottom: 1px solid #2637449c;
  background: #0d1722;
}
.identity, .utilities, .panel-title, .stage-heading, .stage-foot {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.utilities { flex-wrap: wrap; }
.identity h1 { font-size: clamp(1rem, 2.3vw, 1.43rem); font-weight: 650; }
.mark {
  display: inline-grid;
  place-items: center;
  min-width: 2.4rem;
  min-height: 2.05rem;
  padding: 0 .32rem;
  border: 1px solid #296171;
  border-radius: .5rem;
  background: #143541;
  color: var(--cyan);
  font: 650 .86rem ui-monospace, monospace;
}
.connection { display: flex; align-items: center; gap: .45rem; font-size: .875rem; color: var(--muted); white-space: nowrap; }
.connection i, .supplies i { width: .5rem; height: .5rem; flex: none; border-radius: 50%; background: #728394; }
.connection.connected i { background: #81ebbe; box-shadow: 0 0 .55rem #81ebbe48; }
.screen-link, button {
  border: 1px solid #324958;
  border-radius: .5rem;
  padding: .58rem .77rem;
  color: #dceaf5;
  background: #182935;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-size: .9rem;
  font-weight: 550;
  line-height: 1.4;
  min-height: 2.55rem;
}
.screen-link { white-space: nowrap; }
.screen-link:hover, button:not(:disabled):hover { background: #264352; border-color: #487381; }
button:disabled { opacity: .43; cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid #a1edff; outline-offset: 2px; }
button.primary { background: #88e8f7; border-color: #a3f2ff; color: #082730; }
button.primary:not(:disabled):hover { background: #b4f5ff; border-color: #caffff; }
button.quiet { background: transparent; border-color: transparent; color: #b4c7d7; }

.workspace {
  width: min(100%, 101rem);
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(23.5rem, 1fr);
  align-items: start;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 3.4vw, 3.25rem) 2rem;
}
.stage, .panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: .85rem;
  background: var(--surface);
}
.stage-heading, .stage-foot {
  justify-content: space-between;
  min-height: 3.1rem;
  padding: .68rem .94rem;
}
.stage-heading h2, .panel h2 { font-size: 1rem; font-weight: 650; }
.state-label { font-size: .85rem; color: #a5e4ef; }
.aquarium { position: relative; container-type: inline-size; background: #07141f; }
.tank-visual { position: relative; }
.tank-title { display: none; }
.aquarium canvas { display: block; width: 100%; aspect-ratio: 720 / 612; }
.aquarium canvas.can-feed { cursor: crosshair; }
.tank-guide {
  display: grid;
  gap: .38em;
  margin-inline: 12%;
  padding-block: .65em .15em;
  color: #d4e7ed;
  pointer-events: none;
  font-size: clamp(.56rem, 2.1cqw, 1.15rem);
  line-height: 1.2;
}
.tank-guide-label { color: #b1d4df; font-weight: 650; letter-spacing: .09em; }
.tank-guide-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45em; }
.tank-guide-actions p {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .14em .35em;
  padding: .35em .6em;
  border: 1px solid #396477;
  border-radius: .46em;
  background: linear-gradient(115deg, #173745, #0d2532);
}
.tank-guide-actions strong { color: #a5f1ff; font-size: 1.55em; line-height: 1.05; }
.tank-guide-actions span { color: #c7dce4; font-size: .86em; white-space: nowrap; }
.tank-guide-actions .tank-guide-shrimp {
  border-color: #725943;
  background: linear-gradient(115deg, #352c28, #1d2630);
}
.tank-guide-shrimp strong { color: #ffd694; }
.tank-interactions {
  position: absolute;
  inset-inline: 12% 12%;
  bottom: 75%;
  display: grid;
  gap: .35em;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
  font-size: clamp(.56rem, 2.45cqw, 1.25rem);
}
.tank-interactions[hidden] { display: none; }
.tank-interactions.cat-visible { inset-inline-end: 43%; }
.tank-interactions li {
  --interaction-accent: #9cebf6;
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: .46em;
  padding: .39em .62em;
  border: 1px solid #456772;
  border-inline-start: .16em solid var(--interaction-accent);
  border-radius: .45em;
  background: linear-gradient(105deg, #142f3a, #0d202c);
  color: #e8f7fc;
  box-shadow: 0 .2em .7em #030d1580;
  line-height: 1.3;
}
.tank-interactions li[data-kind="like"] { --interaction-accent: #ffc0d9; }
.tank-interactions li[data-kind="gift"] { --interaction-accent: #ffda90; }
.tank-interactions li[data-kind="enter"],
.tank-interactions li[data-kind="online"] { --interaction-accent: #a4edcd; }
.tank-interaction-kind { flex: none; color: var(--interaction-accent); font-size: .84em; font-weight: 650; }
.tank-interaction-viewer, .tank-interaction-message {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tank-interaction-viewer { flex: 0 1 auto; max-width: 36%; color: #f3fbff; }
.tank-interaction-message { flex: 1; color: #d1e6ef; }
.stage-foot { align-items: baseline; line-height: 1.47; font-size: .91rem; color: #c5d5e2; border-top: 1px solid var(--edge); }
#countdown { color: #ffe19f; font-variant-numeric: tabular-nums; white-space: nowrap; }

.controls { min-width: 0; display: grid; gap: .7rem; }
.panel { display: grid; gap: .65rem; padding: .82rem .9rem; }
.panel-title { justify-content: space-between; flex-wrap: wrap; gap: .5rem .75rem; }
.muted, .supplies { color: var(--muted); font-size: .88rem; }
.supplies { display: flex; flex-wrap: wrap; gap: .27rem .65rem; }
.supplies span { display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; }
.supplies b { font-weight: 600; color: #d8e6ef; }
.supplies i.food { background: #fbcf7e; }
.supplies i.kelp { background: #8bdf58; }
.supplies i.shell { background: #d7b7ff; }
.buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .42rem; }
.buttons.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fish-list { display: flex; gap: .45rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.fish-chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  flex: 1 1 9rem;
  gap: .53rem;
  padding: .55rem .73rem;
  background: #132634;
  border: 1px solid #2c4758;
  border-radius: .5rem;
}
.fish-chip strong { white-space: nowrap; }
.fish-chip span, .feed-tip { color: #a6b8c8; font-size: .88rem; }
.shrimp-control { display: flex; align-items: center; gap: .65rem; }
.fish-details { display: grid; justify-items: end; gap: .13rem; white-space: nowrap; }
.fish-details b { color: #e1f4fa; font-size: .92rem; font-variant-numeric: tabular-nums; }
.fish-chip[data-kind="drum"] strong { color: #82efff; }
.fish-chip[data-kind="stripe"] strong { color: #abd9ff; }
.fish-chip[data-kind="spotted"] strong { color: #ffdc87; }
.cat-target { display: flex; align-items: center; gap: .42rem; }
.cat-target[hidden] { display: none; }
.cat-target select {
  background: #172b38;
  color: #e3eff8;
  border: 1px solid #345160;
  border-radius: .4rem;
  padding: .27rem .4rem;
  font: inherit;
}
.cat-target select:focus-visible { outline: 2px solid #a1edff; outline-offset: 2px; }
.log { gap: .32rem; }
.log ol { display: grid; gap: .36rem; margin: 0; padding: 0; list-style: none; color: #b9cad8; font-size: .86rem; }
.log li { display: flex; gap: .53rem; align-items: baseline; line-height: 1.4; }
.log time { color: #889cac; font-size: .79rem; font-variant-numeric: tabular-nums; }
.error { color: #ffc199; font-size: .88rem; }

@media (max-width: 850px) {
  .workspace { grid-template-columns: minmax(0, 1fr); max-width: 42rem; }
}
@media (max-width: 430px) {
  .masthead { flex-wrap: wrap; gap: .55rem; }
  .utilities { justify-content: space-between; flex: 1 0 100%; }
  .workspace { padding: .7rem .66rem 1.3rem; gap: .68rem; }
  .panel { padding: .7rem; }
  .stage-foot { align-items: flex-start; }
}

html[data-mode="screen"] { background: #07141f; }
html[data-background="transparent"] { color-scheme: normal; }
html[data-background="transparent"],
html[data-background="transparent"] body,
html[data-background="transparent"] .aquarium { background: transparent; }
html[data-background="transparent"] .tank-guide-label { text-shadow: 0 1px 4px #07141f; }
html[data-mode="screen"] .console-only { display: none; }
html[data-mode="screen"] .workspace {
  width: 100%;
  max-width: none;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding: 0;
}
html[data-mode="screen"] .stage {
  width: min(100vw, calc(100dvh * 9 / 16));
  border: 0;
  border-radius: 0;
  background: transparent;
}
html[data-mode="screen"] .aquarium canvas {
  height: auto;
  aspect-ratio: 9 / 16;
}
html[data-mode="screen"] .tank-overlay {
  position: absolute;
  z-index: 1;
  inset: 9.8% 14% auto 5.5%;
  pointer-events: none;
}
html[data-mode="screen"] .tank-title {
  display: block;
  margin-bottom: .28em;
  color: #f1fcff;
  font-size: clamp(.85rem, 5.05cqw, 3.4rem);
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: .04em;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 1px 3px #061019, 0 3px 15px #061019;
}
html[data-mode="screen"] .tank-guide {
  gap: .32em;
  margin: 0;
  padding: 0;
  font-size: clamp(.52rem, 2.9cqw, 2.05rem);
}
html[data-mode="screen"] .tank-guide-label { font-size: .85em; }
html[data-mode="screen"] .tank-guide-actions p { padding-block: .27em; }
html[data-mode="screen"] .tank-interactions {
  inset-inline: 5.5% 14%;
  bottom: 69.9%;
  font-size: clamp(.55rem, 3.55cqw, 2.4rem);
}
html[data-mode="screen"] .tank-interactions.cat-visible { inset-inline-end: 45%; }

@container (max-width: 260px) {
  html[data-mode="screen"] .tank-interactions li + li { display: none; }
}

.auto-workspace { grid-template-columns: minmax(0, 1.17fr) minmax(23rem, 1fr); }
.auto-preview {
  display: grid;
  place-items: center;
  padding: .7rem;
  background: #07141f;
}
.auto-preview iframe {
  display: block;
  width: min(100%, 26rem, calc(72vh * 9 / 16));
  aspect-ratio: 9 / 16;
  border: 0;
}
.auto-schedule {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, .9fr);
  gap: .6rem;
}
.auto-schedule > div {
  min-width: 0;
  display: grid;
  gap: .32rem;
  padding: .62rem .72rem;
  border: 1px solid #2c4758;
  border-radius: .5rem;
  background: #132634;
}
.auto-schedule strong { color: #def3f7; font-size: .94rem; }
#auto-status.is-running, #audience-status.is-running, #host-status.is-running { color: #89edc3; }
.auto-form, .auto-fields { display: grid; gap: .73rem; }
.auto-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.auto-fields label { min-width: 0; display: grid; gap: .34rem; color: #c5dce9; font-size: .88rem; }
.auto-fields input, .auto-fields select, .audience-demo select {
  width: 100%;
  min-height: 2.5rem;
  padding: .48rem .62rem;
  border: 1px solid #345160;
  border-radius: .44rem;
  color: #e8f6fa;
  background: #102430;
  font: inherit;
  font-size: 1rem;
}
.auto-fields input:focus-visible, .auto-fields select:focus-visible, .audience-demo select:focus-visible {
  outline: 2px solid #a1edff;
  outline-offset: 2px;
}
.auto-form p { line-height: 1.5; }
.audience-source-fields { grid-template-columns: minmax(0, 1fr); }
#audience-direct-fields[hidden], #audience-relay-fields[hidden] { display: none; }
.auto-fields .audience-visible { display: flex; align-items: center; gap: .45rem; }
.auto-fields .audience-visible input { width: 1rem; min-height: auto; accent-color: #88e8f7; }
#audience-room, #audience-detail, .audience-viewers p, .audience-recent li { overflow-wrap: anywhere; }
.audience-viewers p { padding-top: .32rem; }
.audience-recent { display: grid; gap: .43rem; padding-block: .63rem; border-block: 1px solid var(--edge); }
.audience-recent h3 { margin: 0; font-size: .91rem; }
.audience-recent ol { max-height: 14rem; overflow-y: auto; }
.audience-recent time { flex-shrink: 0; }
.audience-recent .event-kind { flex-shrink: 0; color: #9be6f9; font-size: .8rem; }
.auto-save { display: flex; align-items: center; gap: .62rem; flex-wrap: wrap; }
.audience-demo { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .45rem; }
.audience-demo label { color: #c5dce9; font-size: .88rem; }
.auto-log { gap: .58rem; }

@media (max-width: 850px) {
  .auto-workspace { grid-template-columns: minmax(0, 1fr); }
  .auto-controls { grid-row: 1; }
  .auto-preview iframe { width: min(100%, 22rem); }
}
