:root {
  color-scheme: dark;
  --ink: #050505;
  --ink-soft: #10100e;
  --panel: rgba(14, 13, 10, 0.82);
  --panel-strong: rgba(22, 20, 15, 0.94);
  --line: rgba(223, 179, 86, 0.28);
  --gold: #e0b45c;
  --gold-bright: #ffd77a;
  --jade: #67d4bc;
  --rose: #d88484;
  --text: #f6efd9;
  --muted: #a99f87;
  --shadow: rgba(0, 0, 0, 0.45);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: #050505;
  color: var(--text);
  font-family:
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    "Noto Sans CJK SC",
    system-ui,
    sans-serif;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(180deg, rgba(9, 10, 12, 0.88), rgba(5, 5, 5, 1)),
    #050505;
  z-index: -2;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 28px;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.auth-gate[hidden] {
  display: none;
}

.auth-shell {
  width: min(100%, 520px);
  border: 1px solid rgba(255, 215, 122, 0.36);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 215, 122, 0.16), transparent 42%),
    rgba(12, 11, 8, 0.9);
  box-shadow: 0 26px 86px rgba(0, 0, 0, 0.56), 0 0 46px rgba(224, 180, 92, 0.16);
  backdrop-filter: blur(18px);
  padding: 22px;
}

.auth-brand {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.auth-brand img {
  width: 96px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 215, 122, 0.36);
  object-fit: cover;
  background: #050505;
  box-shadow: 0 0 34px rgba(255, 215, 122, 0.2);
}

.auth-brand h2 {
  font-size: clamp(34px, 8vw, 52px);
  line-height: 1.08;
  letter-spacing: 0;
}

.auth-brand p {
  margin-top: 8px;
  color: rgba(246, 239, 217, 0.78);
  font-size: 14px;
  line-height: 1.55;
}

.auth-summary {
  display: grid;
  gap: 7px;
  margin: 20px 0 16px;
  border-top: 1px solid rgba(255, 215, 122, 0.14);
  border-bottom: 1px solid rgba(255, 215, 122, 0.14);
  padding: 12px 0;
}

.quota-line {
  color: var(--jade);
  font-size: 15px;
}

.auth-summary small,
.auth-login p,
.auth-login small,
.auth-message {
  color: var(--muted);
}

.auth-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.auth-actions[hidden] {
  display: none;
}

.auth-choice,
.auth-submit,
.auth-back {
  min-height: 48px;
  border: 1px solid rgba(255, 215, 122, 0.32);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.auth-choice.primary,
.auth-submit {
  color: #080705;
  border-color: rgba(255, 215, 122, 0.82);
  background: linear-gradient(180deg, #ffdc86, #c79437);
  font-weight: 700;
}

.auth-login {
  display: grid;
  gap: 12px;
}

.auth-login[hidden] {
  display: none;
}

.auth-login label {
  display: grid;
  gap: 8px;
}

.auth-login label span {
  color: var(--muted);
}

.auth-login input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 215, 122, 0.22);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  outline: 0;
  padding: 0 14px;
}

.auth-login input:focus {
  border-color: rgba(255, 215, 122, 0.68);
  box-shadow: 0 0 0 3px rgba(224, 180, 92, 0.12);
}

.auth-login p {
  line-height: 1.6;
}

.auth-message {
  min-height: 24px;
  margin: 12px 0 0;
  line-height: 1.55;
}

.auth-message[data-tone="warn"] {
  color: var(--gold-bright);
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 215, 122, 0.5);
  color: var(--gold-bright);
  background: rgba(224, 180, 92, 0.08);
  box-shadow: 0 0 24px rgba(224, 180, 92, 0.18);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-line {
  fill: none;
  stroke: #ffd77a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4.2;
}

.logo-line.faint {
  opacity: 0.55;
  stroke-width: 2.4;
}

.logo-stars {
  fill: #ffd77a;
  filter: drop-shadow(0 0 5px rgba(255, 215, 122, 0.58));
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  font-weight: 650;
  letter-spacing: 0;
}

.brand-lockup p,
.topbar-status span,
.panel-heading small,
.field span,
.upload-zone small,
.preflight span,
.metric-label,
.card-kicker,
.note {
  color: var(--muted);
}

.brand-lockup p {
  margin-top: 7px;
  font-size: 13px;
}

.topbar-status {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-direction: column;
  text-align: right;
  min-width: 128px;
}

.topbar-status strong {
  color: var(--jade);
  font-size: 14px;
  font-weight: 600;
}

.apk-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 215, 122, 0.36);
  border-radius: var(--radius);
  color: #080705;
  background: linear-gradient(180deg, #ffdc86, #c79437);
  padding: 0 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.apk-link[hidden] {
  display: none;
}

.apk-link:hover {
  box-shadow: 0 0 24px rgba(255, 215, 122, 0.18);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(520px, 1.28fr);
  grid-template-areas:
    "astro astro"
    "input knowledge"
    "results results";
  gap: 18px;
  padding-top: 18px;
  align-items: start;
}

.input-panel,
.astro-panel,
.knowledge-panel,
.results-panel,
.reading-card,
.photo-panel,
.preflight {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 60px var(--shadow);
  backdrop-filter: blur(16px);
}

.input-panel {
  grid-area: input;
  padding: 18px;
  align-self: start;
}

.astro-panel {
  grid-area: astro;
  width: min(100%, 1080px);
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(380px, 1.22fr) minmax(190px, 0.52fr);
  grid-template-rows: minmax(310px, 1fr) auto;
  gap: 14px;
  padding: 14px;
  min-height: 620px;
}

.results-panel {
  grid-area: results;
  min-height: 220px;
  padding: 18px;
}

.knowledge-panel {
  grid-area: knowledge;
  padding: 18px;
}

.knowledge-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 215, 122, 0.16);
  padding-bottom: 14px;
}

.knowledge-heading span {
  color: var(--gold-bright);
  font-size: 14px;
  font-weight: 650;
}

.knowledge-heading h2 {
  margin-top: 5px;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.18;
}

.knowledge-heading small,
.knowledge-card small {
  color: var(--muted);
}

.knowledge-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.knowledge-tab {
  min-height: 42px;
  border: 1px solid rgba(255, 215, 122, 0.24);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.knowledge-tab.active {
  color: #080705;
  border-color: rgba(255, 215, 122, 0.82);
  background: linear-gradient(180deg, #ffdc86, #c79437);
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(201, 149, 55, 0.16);
}

.knowledge-panel-stack {
  min-height: 390px;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.knowledge-grid[hidden] {
  display: none;
}

.knowledge-card {
  min-height: 190px;
  display: grid;
  align-content: start;
  gap: 9px;
  border: 1px solid rgba(255, 215, 122, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 215, 122, 0.045), transparent 42%),
    rgba(255, 255, 255, 0.025);
  padding: 14px;
}

.knowledge-card span {
  width: fit-content;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 215, 122, 0.25);
  color: var(--gold-bright);
  background: rgba(224, 180, 92, 0.07);
  padding: 0 8px;
  font-size: 13px;
}

.knowledge-card h3 {
  font-size: 18px;
  line-height: 1.25;
}

.knowledge-card p {
  color: rgba(246, 239, 217, 0.88);
  line-height: 1.68;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.quota-line {
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(103, 212, 188, 0.24);
  border-radius: var(--radius);
  background: rgba(103, 212, 188, 0.07);
  padding: 0 12px;
  margin-bottom: 14px;
  font-weight: 650;
}

.panel-heading span {
  color: var(--gold-bright);
  font-size: 18px;
  font-weight: 650;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 215, 122, 0.22);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  outline: 0;
  padding: 0 14px;
  color-scheme: dark;
}

.field input:focus {
  border-color: rgba(255, 215, 122, 0.68);
  box-shadow: 0 0 0 3px rgba(224, 180, 92, 0.12);
}

.upload-zone {
  min-height: 112px;
  border: 1px dashed rgba(255, 215, 122, 0.36);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  text-align: center;
  gap: 4px;
  margin: 16px 0;
  padding: 16px;
  background: rgba(224, 180, 92, 0.06);
  position: relative;
}

.upload-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.photo-actions {
  width: min(100%, 300px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.photo-actions button {
  min-height: 36px;
  border: 1px solid rgba(255, 215, 122, 0.28);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.photo-actions button:hover {
  border-color: rgba(255, 215, 122, 0.58);
  color: var(--gold-bright);
}

.upload-symbol {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--gold-bright);
  border: 1px solid rgba(224, 180, 92, 0.55);
  border-radius: 50%;
}

.tag-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.tag-toggle {
  min-height: 44px;
  border: 1px solid rgba(255, 215, 122, 0.22);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.tag-toggle.active {
  color: #11100d;
  background: linear-gradient(180deg, #ffd77a, #c99538);
  border-color: rgba(255, 215, 122, 0.92);
  box-shadow: 0 8px 28px rgba(224, 180, 92, 0.18);
}

.primary-action {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: var(--radius);
  color: #070705;
  background: linear-gradient(180deg, #ffdc86, #c79437);
  font-weight: 700;
  box-shadow: 0 20px 48px rgba(201, 149, 55, 0.22);
}

.primary-action b {
  font-size: 18px;
}

.astro-stage {
  grid-column: 1;
  grid-row: 1 / span 2;
  position: relative;
  min-height: 556px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 215, 122, 0.16), transparent 38%),
    linear-gradient(90deg, rgba(255, 215, 122, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 215, 122, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  border: 1px solid rgba(255, 215, 122, 0.28);
  box-shadow:
    inset 0 0 78px rgba(255, 215, 122, 0.08),
    0 0 42px rgba(224, 180, 92, 0.08);
  isolation: isolate;
}

#constellation {
  width: min(100%, 720px);
  max-height: 100%;
  aspect-ratio: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 1;
}

#constellation.is-dragging {
  cursor: grabbing;
}

.astro-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 2;
  pointer-events: none;
}

.astro-hud span,
.astro-hud strong {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 215, 122, 0.28);
  background: rgba(5, 5, 5, 0.54);
  backdrop-filter: blur(10px);
  padding: 0 10px;
  color: var(--gold-bright);
  font-size: 13px;
  font-weight: 650;
}

.astro-hud strong {
  color: var(--jade);
}

.season {
  position: absolute;
  color: rgba(255, 239, 205, 0.86);
  font-size: clamp(24px, 4vw, 42px);
  font-weight: 800;
  text-shadow: 0 0 16px rgba(255, 215, 122, 0.46);
  z-index: 2;
  pointer-events: none;
}

.season.north {
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
}

.season.east {
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.season.south {
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
}

.season.west {
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.photo-panel {
  position: relative;
  min-height: 270px;
  overflow: hidden;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.035);
}

.photo-panel img {
  width: 100%;
  height: 100%;
  min-height: 270px;
  object-fit: cover;
  display: none;
}

.photo-panel.has-photo img {
  display: block;
}

.photo-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.photo-panel.has-photo .photo-placeholder {
  display: none;
}

.photo-placeholder span {
  color: var(--gold);
  font-size: 20px;
}

.preflight {
  min-height: 136px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.preflight div {
  display: grid;
  gap: 4px;
  align-content: center;
  border-bottom: 1px solid rgba(255, 215, 122, 0.12);
  padding-bottom: 10px;
}

.preflight div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.preflight strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
}

.empty-state span {
  color: var(--gold-bright);
  font-size: 40px;
}

.result-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.result-title {
  display: grid;
  gap: 8px;
}

.result-title h2 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
  letter-spacing: 0;
}

.result-title p {
  color: var(--muted);
  line-height: 1.65;
}

.score-ring {
  width: 118px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 215, 122, 0.42);
  background: conic-gradient(from -90deg, var(--gold-bright) var(--score), rgba(255, 255, 255, 0.08) 0);
  border-radius: 50%;
  position: relative;
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--panel-strong);
}

.score-ring strong,
.score-ring span {
  position: relative;
  z-index: 1;
}

.score-ring strong {
  font-size: 28px;
  color: var(--gold-bright);
}

.score-ring span {
  margin-top: 34px;
  position: absolute;
  color: var(--muted);
  font-size: 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.metric {
  border: 1px solid rgba(255, 215, 122, 0.18);
  padding: 14px;
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.metric strong {
  color: var(--text);
  font-size: 18px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.reading-card {
  min-height: 230px;
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.reading-card.priority {
  border-color: rgba(255, 215, 122, 0.55);
  background: rgba(28, 24, 16, 0.92);
}

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

.card-head h3 {
  font-size: 20px;
  font-weight: 650;
}

.omen {
  min-width: 52px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 215, 122, 0.36);
  color: var(--gold-bright);
  background: rgba(224, 180, 92, 0.08);
}

.omen.mid {
  color: var(--jade);
  border-color: rgba(103, 212, 188, 0.36);
  background: rgba(103, 212, 188, 0.08);
}

.omen.caution {
  color: var(--rose);
  border-color: rgba(216, 132, 132, 0.38);
  background: rgba(216, 132, 132, 0.08);
}

.reading-card p,
.reading-card li {
  line-height: 1.72;
}

.reading-card ul {
  margin: 0;
  padding-left: 18px;
}

.wide-card {
  grid-column: span 2;
}

.full-card {
  grid-column: 1 / -1;
}

.product-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.product-tile {
  border: 1px solid rgba(255, 215, 122, 0.18);
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.product-tile strong {
  color: var(--gold-bright);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ghost-action {
  min-height: 42px;
  border: 1px solid rgba(255, 215, 122, 0.3);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  padding: 0 14px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
}

.loading-overlay.active {
  display: grid;
}

.loading-disc {
  width: min(74vw, 420px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
}

.loading-disc canvas {
  width: 100%;
  height: 100%;
}

.loading-disc span {
  position: absolute;
  bottom: 16%;
  color: var(--gold-bright);
  letter-spacing: 0;
}

.tips-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: start center;
  padding: max(22px, env(safe-area-inset-top)) 16px 16px;
  pointer-events: none;
}

.tips-overlay[hidden] {
  display: none;
}

.tips-card {
  width: min(92vw, 520px);
  max-height: min(76vh, 580px);
  overflow: auto;
  position: relative;
  border: 1px solid rgba(255, 215, 122, 0.42);
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 215, 122, 0.14), transparent 34%),
    rgba(12, 11, 8, 0.94);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.52), 0 0 34px rgba(224, 180, 92, 0.16);
  backdrop-filter: blur(18px);
  padding: 18px 18px 16px;
  pointer-events: auto;
  animation: tipsIn 260ms ease-out both;
}

.tips-overlay.closing .tips-card {
  animation: tipsOut 220ms ease-in both;
}

.tips-kicker {
  color: var(--gold-bright);
  font-size: 14px;
  font-weight: 700;
}

.tips-card h2 {
  margin-top: 8px;
  padding-right: 34px;
  font-size: 22px;
  line-height: 1.22;
}

.tips-card p {
  margin-top: 10px;
  color: rgba(246, 239, 217, 0.9);
  line-height: 1.72;
}

.tips-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 215, 122, 0.24);
  border-radius: 50%;
  color: var(--gold-bright);
  background: rgba(255, 255, 255, 0.04);
  font-size: 22px;
  line-height: 1;
}

.tips-progress {
  height: 2px;
  margin-top: 14px;
  background: rgba(255, 215, 122, 0.14);
  overflow: hidden;
}

.tips-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ffd77a, #c79437);
  transform-origin: left;
  animation: tipsTimer 5s linear both;
}

@keyframes tipsIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tipsOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

@keyframes tipsTimer {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "astro"
      "input"
      "knowledge"
      "results";
  }

  .astro-panel {
    min-height: auto;
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .knowledge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .knowledge-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding-bottom: 18px;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .topbar-status {
    min-width: auto;
  }

  .topbar-status span,
  .topbar-status strong {
    display: none;
  }

  .workspace {
    gap: 12px;
    padding-top: 12px;
  }

  .input-panel,
  .astro-panel,
  .knowledge-panel,
  .results-panel {
    padding: 12px;
  }

  .knowledge-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .knowledge-grid {
    grid-template-columns: 1fr;
  }

  .knowledge-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .knowledge-panel-stack {
    min-height: auto;
  }

  .astro-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    width: 100%;
  }

  .astro-stage {
    grid-column: auto;
    grid-row: auto;
    min-height: min(104vw, 500px);
  }

  .astro-hud {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .photo-panel {
    min-height: 220px;
  }

  .photo-panel img {
    min-height: 220px;
  }

  .metrics,
  .results-grid,
  .product-row {
    grid-template-columns: 1fr;
  }

  .wide-card {
    grid-column: auto;
  }

  .result-header {
    grid-template-columns: 1fr;
  }

  .score-ring {
    width: 104px;
  }

  .tag-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-shell {
    padding: 16px;
  }

  .auth-brand {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .auth-brand img {
    width: 78px;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }
}
