:root {
  color-scheme: dark;
  --bg: #06131f;
  --panel: rgba(11, 24, 36, 0.78);
  --panel-strong: rgba(12, 25, 39, 0.94);
  --line: rgba(136, 186, 225, 0.16);
  --text: #f3ebdc;
  --muted: #a8bfd1;
  --warm: #ffd166;
  --accent: #84dcc6;
  --danger: #ff7b72;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top, rgba(250, 183, 97, 0.12), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(113, 169, 221, 0.14), transparent 26%),
    linear-gradient(180deg, #07131d 0%, #040b12 100%);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 56%, transparent 100%);
}

.page-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.28;
}

.page-glow-left {
  left: -120px;
  top: 12vh;
  background: rgba(255, 184, 77, 0.48);
}

.page-glow-right {
  right: -140px;
  top: 52vh;
  background: rgba(90, 180, 190, 0.34);
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 28px;
  padding: 32px;
  min-height: 100vh;
}

.intro-panel,
.sky-panel,
.modal-card {
  border: 1px solid rgba(161, 207, 235, 0.16);
  background: var(--panel);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

.intro-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 30px;
  border-radius: 28px;
}

.eyebrow,
.detail-kicker,
.sky-title {
  margin: 0;
  color: var(--accent);
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 4vw, 4.3rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.site-title {
  display: grid;
  gap: 2px;
  max-width: 8em;
}

.site-title span {
  display: block;
}

.site-subtitle {
  margin: -10px 0 0;
  color: var(--warm);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.15rem, 1.8vw, 1.65rem);
  line-height: 1.25;
}

.lead {
  margin: 0;
  max-width: 32rem;
  color: var(--muted);
  line-height: 1.7;
  font-size: 1rem;
}

.toolbar,
.form-actions,
.sky-header,
.section-head,
.two-col {
  display: flex;
  gap: 12px;
}

.toolbar,
.sky-header,
.section-head {
  align-items: center;
  justify-content: space-between;
}

.toolbar {
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.line-toggle,
.icon-btn {
  border: 0;
  cursor: pointer;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.primary-btn,
.ghost-btn,
.line-toggle {
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  min-height: 44px;
  white-space: normal;
}

.primary-btn {
  background: linear-gradient(135deg, #f2c96d 0%, #f4978e 100%);
  color: #0d1722;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.line-toggle {
  padding: 8px 12px;
  background: rgba(132, 220, 198, 0.12);
  color: var(--accent);
  border: 1px solid rgba(132, 220, 198, 0.24);
  font-size: 0.8rem;
}

.line-toggle[aria-pressed="false"] {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.12);
}

.primary-btn:hover,
.ghost-btn:hover,
.line-toggle:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.backup-status {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.stats-card,
.detail-card,
.memory-list-card,
.locator-card,
.sound-card {
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.stats-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.stats-card strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.detail-card,
.memory-list-card,
.locator-card,
.sound-card {
  padding: 20px;
}

.sound-card {
  background:
    radial-gradient(circle at 86% 16%, rgba(132, 220, 198, 0.14), transparent 30%),
    rgba(255, 255, 255, 0.03);
}

.sound-card h3,
.section-head h3 {
  margin: 0;
}

.sound-card .section-head span,
.section-head > span {
  color: var(--muted);
  font-size: 0.84rem;
}

.sound-orb {
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(132, 220, 198, 0.24);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(132, 220, 198, 0.42), rgba(132, 220, 198, 0.08) 44%, transparent 70%),
    rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.sound-orb span {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid var(--text);
  transform: translate(-38%, -50%);
}

.sound-orb.playing span {
  width: 14px;
  height: 16px;
  border: 0;
  border-left: 4px solid var(--text);
  border-right: 4px solid var(--text);
  transform: translate(-50%, -50%);
}

.sound-orb.playing {
  box-shadow: 0 0 28px rgba(132, 220, 198, 0.22);
}

.sound-controls {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.volume-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
}

.volume-control input {
  width: 100%;
  accent-color: var(--accent);
}

.locator-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  margin-top: 14px;
}

.locator-form input[type="search"] {
  width: 100%;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 13px 16px;
  font: inherit;
}

.locator-form input[type="search"]:focus {
  outline: 1px solid rgba(255, 209, 102, 0.45);
  border-color: rgba(255, 209, 102, 0.45);
}

.detail-empty h2,
.detail-view h2,
.modal-head h2 {
  margin: 8px 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
}

.detail-empty p,
.detail-copy,
.meta-line,
.memory-list-hint,
.sky-subtitle,
.upload-field small {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.detail-view {
  display: grid;
  gap: 16px;
}

.detail-photo-wrap {
  overflow: hidden;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.45)),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  aspect-ratio: 4 / 3;
}

.detail-photo-wrap img,
.star-photo,
#photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-pill {
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.88rem;
}

.token-card {
  padding: 16px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 92% 20%, rgba(132, 220, 198, 0.12), transparent 30%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(132, 220, 198, 0.16);
}

.token-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.token-card p {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  line-height: 1.55;
}

.voice-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 209, 102, 0.1), transparent 26%),
    rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.voice-card-disabled {
  opacity: 0.72;
}

.voice-upload {
  display: grid;
  gap: 8px;
}

.voice-upload span {
  font-weight: 700;
}

.voice-upload input[type="file"] {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 12px;
  font: inherit;
}

.voice-upload small,
.comfort-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.84rem;
}

.voice-player {
  width: 100%;
}

.comfort-thread {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
}

.comfort-message {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.comfort-message.user {
  background: rgba(255, 209, 102, 0.08);
}

.comfort-message.assistant {
  background: rgba(132, 220, 198, 0.08);
}

.comfort-message span {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.comfort-message p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.comfort-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.comfort-form textarea {
  min-width: 0;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 12px;
  font: inherit;
}

.comfort-form textarea:focus {
  outline: 1px solid rgba(255, 209, 102, 0.45);
  border-color: rgba(255, 209, 102, 0.45);
}

.comfort-form button:disabled,
.comfort-form textarea:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

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

.memory-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.memory-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.memory-item.active {
  border-color: rgba(255, 209, 102, 0.42);
  background: rgba(255, 209, 102, 0.08);
}

.memory-swatch {
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 3px;
  box-shadow: 0 0 12px currentColor;
}

.memory-item strong,
.memory-item span {
  display: block;
}

.memory-item strong {
  margin-bottom: 2px;
  font-size: 0.96rem;
}

.memory-item span {
  color: var(--muted);
  font-size: 0.83rem;
}

.sky-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 50% 48%, rgba(253, 234, 187, 0.08), transparent 18%),
    radial-gradient(circle at 18% 20%, rgba(143, 199, 255, 0.08), transparent 18%),
    radial-gradient(circle at 82% 72%, rgba(255, 175, 121, 0.08), transparent 16%),
    rgba(6, 15, 25, 0.88);
}

.sky-subtitle {
  margin-top: 6px;
}

.sky-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.sky-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.legend-empty {
  background: rgba(255, 255, 255, 0.22);
}

.legend-filled {
  background: var(--warm);
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.65);
}

.legend-hidden {
  background: rgba(168, 191, 209, 0.34);
  box-shadow: 0 0 10px rgba(168, 191, 209, 0.24);
}

.view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.view-btn {
  min-width: 0;
  border: 0;
  border-radius: 999px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.view-btn.active {
  background: rgba(132, 220, 198, 0.12);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(132, 220, 198, 0.22);
}

.sky-grid {
  --pan-x: 0px;
  --pan-y: 0px;
  position: relative;
  min-height: 760px;
  padding: 16px;
  overflow: hidden;
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 52%, rgba(250, 238, 209, 0.1), transparent 11%),
    radial-gradient(circle at 50% 52%, rgba(73, 122, 181, 0.06), transparent 22%),
    linear-gradient(180deg, rgba(6, 12, 18, 0.2), rgba(5, 11, 18, 0.62));
  isolation: isolate;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.sky-grid.dragging {
  cursor: grabbing;
}

.sky-grid.earth-view {
  background:
    radial-gradient(ellipse at 50% 118%, rgba(83, 152, 205, 0.38), transparent 28%),
    radial-gradient(ellipse at 50% 115%, rgba(27, 78, 112, 0.58), transparent 34%),
    radial-gradient(circle at 50% 52%, rgba(250, 238, 209, 0.08), transparent 11%),
    linear-gradient(180deg, rgba(4, 10, 18, 0.18), rgba(5, 11, 18, 0.68));
}

.sky-grid.solar-view {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 209, 102, 0.08), transparent 18%),
    radial-gradient(circle at 50% 50%, rgba(132, 220, 198, 0.05), transparent 42%),
    linear-gradient(180deg, rgba(6, 12, 18, 0.24), rgba(5, 11, 18, 0.72));
}

.solar-system-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transform: translate(var(--pan-x), var(--pan-y));
}

.sun,
.orbit,
.planet {
  position: absolute;
  border-radius: 999px;
}

.sun {
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  background: var(--warm);
  box-shadow: 0 0 42px rgba(255, 209, 102, 0.7);
}

.orbit {
  left: 50%;
  top: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transform: translate(-50%, -50%);
}

.orbit-1 {
  width: 96px;
  height: 96px;
}

.orbit-2 {
  width: 160px;
  height: 160px;
}

.orbit-3 {
  width: 232px;
  height: 232px;
}

.orbit-4 {
  width: 316px;
  height: 316px;
}

.orbit-5 {
  width: 440px;
  height: 440px;
}

.orbit-6 {
  width: 600px;
  height: 600px;
}

.planet {
  left: 50%;
  top: -4px;
  width: 8px;
  height: 8px;
  transform: translateX(-50%);
  background: var(--muted);
}

.venus {
  background: #f2c96d;
}

.earth {
  width: 10px;
  height: 10px;
  background: #84dcc6;
  box-shadow: 0 0 14px rgba(132, 220, 198, 0.5);
}

.mars {
  background: #f4978e;
}

.jupiter {
  width: 13px;
  height: 13px;
  background: #d8b17b;
}

.saturn {
  width: 12px;
  height: 12px;
  background: #d8c690;
  box-shadow: 0 0 0 4px rgba(216, 198, 144, 0.16);
}

.sky-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 245, 219, 0.88), transparent 7%),
    radial-gradient(circle at 50% 52%, rgba(255, 201, 107, 0.26), transparent 12%),
    radial-gradient(circle at 55% 47%, rgba(151, 211, 255, 0.1), transparent 19%);
  filter: blur(18px);
  opacity: 0.95;
  pointer-events: none;
}

.sky-grid::after {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 59% 41%, rgba(255, 223, 157, 0.18), transparent 10%),
    radial-gradient(ellipse at 67% 34%, rgba(142, 196, 255, 0.11), transparent 12%),
    radial-gradient(ellipse at 73% 39%, rgba(255, 223, 157, 0.12), transparent 11%),
    radial-gradient(ellipse at 34% 58%, rgba(255, 223, 157, 0.15), transparent 12%),
    radial-gradient(ellipse at 25% 65%, rgba(142, 196, 255, 0.1), transparent 12%),
    radial-gradient(ellipse at 58% 67%, rgba(255, 223, 157, 0.1), transparent 11%),
    radial-gradient(ellipse at 43% 36%, rgba(142, 196, 255, 0.08), transparent 12%),
    linear-gradient(90deg, transparent 0%, rgba(255, 241, 210, 0.08) 30%, rgba(255, 241, 210, 0.18) 50%, rgba(142, 196, 255, 0.08) 70%, transparent 100%);
  transform: rotate(-24deg) scale(1.08);
  filter: blur(28px);
  mix-blend-mode: screen;
  opacity: 0.7;
  pointer-events: none;
}

.constellation-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  transform: translate(var(--pan-x), var(--pan-y));
}

.constellation-lines line {
  stroke: rgba(255, 221, 157, 0.28);
  stroke-width: 0.18;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(255, 209, 102, 0.22));
}

.star-cell {
  --field-scale: 1;
  position: absolute;
  display: grid;
  place-items: center;
  z-index: 1;
  left: var(--star-x);
  top: var(--star-y);
  width: var(--field-size, 88px);
  height: var(--field-size, 88px);
  padding: 0;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: visible;
  transform: translate(calc(-50% + var(--pan-x)), calc(-50% + var(--pan-y))) scale(var(--field-scale));
  transition:
    opacity 180ms ease,
    filter 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.star-cell::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: calc(var(--field-size, 88px) * 0.72);
  height: calc(var(--field-size, 88px) * 0.72);
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  opacity: 0;
  transition: opacity 180ms ease;
}

.star-cell:hover {
  filter: brightness(1.12);
}

.star-cell.selected {
  filter: brightness(1.08);
}

.star-cell.matched {
  box-shadow: 0 0 0 1px rgba(132, 220, 198, 0.18), 0 0 24px rgba(132, 220, 198, 0.16);
}

.star-cell.dimmed {
  opacity: 0.3;
  --field-scale: 0.96;
}

.star-cell.hidden-star {
  opacity: 0;
  filter: grayscale(1);
  pointer-events: none;
}

.star-cell.private .pixel-star {
  color: rgba(168, 191, 209, 0.42) !important;
}

.star-cell.flash-target {
  animation: flash-target 1.2s ease;
}

.star-cell:hover::before,
.star-cell.selected::before,
.star-cell.matched::before {
  opacity: 1;
}

.star-cell.empty .star-name {
  color: rgba(240, 238, 230, 0.5);
}

.star-aura {
  position: absolute;
  inset: 50% auto auto 50%;
  width: calc(var(--field-size, 88px) * 0.7);
  height: calc(var(--field-size, 88px) * 0.7);
  transform: translate(-50%, -58%);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.3), transparent 70%);
  opacity: 0.28;
  filter: blur(10px);
  animation: aura-pulse var(--aura-duration, 3.8s) ease-in-out infinite;
  animation-delay: var(--twinkle-delay, 0ms);
}

.star-photo-frame {
  position: absolute;
  inset: 10% 8% auto auto;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transition: opacity 180ms ease;
}

.pixel-star {
  position: relative;
  width: 8px;
  height: 8px;
  background: currentColor;
  color: var(--warm);
  animation: twinkle var(--twinkle-duration, 2.8s) ease-in-out infinite;
  animation-delay: var(--twinkle-delay, 0ms);
  box-shadow:
    0 -8px 0 currentColor,
    0 -16px 0 currentColor,
    0 8px 0 currentColor,
    0 16px 0 currentColor,
    -8px 0 0 currentColor,
    -16px 0 0 currentColor,
    8px 0 0 currentColor,
    16px 0 0 currentColor,
    -8px -8px 0 currentColor,
    8px -8px 0 currentColor,
    -8px 8px 0 currentColor,
    8px 8px 0 currentColor,
    -24px 0 0 rgba(255, 255, 255, 0.22),
    24px 0 0 rgba(255, 255, 255, 0.22),
    0 24px 0 rgba(255, 255, 255, 0.18),
    0 -24px 0 rgba(255, 255, 255, 0.18);
}

.star-cell.empty .pixel-star {
  color: rgba(250, 242, 224, 0.36);
}

.star-name {
  position: absolute;
  left: 50%;
  bottom: 6%;
  z-index: 1;
  display: block;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(5, 15, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 180ms ease;
  backdrop-filter: blur(10px);
}

.star-token {
  position: absolute;
  left: 50%;
  top: 6%;
  z-index: 1;
  display: block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(5, 15, 24, 0.72);
  border: 1px solid rgba(132, 220, 198, 0.14);
  color: var(--accent);
  font-size: 0.72rem;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 180ms ease;
  backdrop-filter: blur(10px);
}

.star-cell:hover .star-name,
.star-cell.selected .star-name,
.star-cell.matched .star-name {
  opacity: 1;
}

.star-cell:hover .star-token,
.star-cell.selected .star-token,
.star-cell.matched .star-token {
  opacity: 1;
}

.star-cell.filled:hover .star-photo-frame,
.star-cell.filled.selected .star-photo-frame,
.star-cell.filled.matched .star-photo-frame {
  opacity: 1;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 7, 12, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100svh - 48px);
  overflow: auto;
  border-radius: 28px;
  padding: 26px;
  background: var(--panel-strong);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
}

.memory-form {
  display: grid;
  gap: 16px;
}

.memory-form label,
.color-fieldset {
  display: grid;
  gap: 8px;
}

.visibility-toggle {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.visibility-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.memory-form label > span,
.color-fieldset legend {
  font-weight: 700;
}

.memory-form input[type="text"],
.memory-form textarea,
.upload-field input[type="file"] {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
}

.token-generate-btn {
  justify-self: start;
}

.memory-form input[type="text"]:focus,
.memory-form textarea:focus,
.upload-field input[type="file"]:focus {
  outline: 1px solid rgba(255, 209, 102, 0.45);
  border-color: rgba(255, 209, 102, 0.45);
}

.memory-form textarea {
  resize: vertical;
  min-height: 110px;
}

.two-col > * {
  flex: 1 1 0;
}

.color-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.color-options {
  display: flex;
  gap: 12px;
}

.color-chip {
  position: relative;
  cursor: pointer;
}

.color-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.color-chip span {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--chip);
  box-shadow: 0 0 20px color-mix(in srgb, var(--chip) 44%, transparent);
  border: 2px solid transparent;
}

.color-chip input:checked + span {
  border-color: rgba(255, 255, 255, 0.94);
  transform: scale(1.08);
}

.upload-field small {
  font-size: 0.82rem;
}

.photo-preview {
  width: min(260px, 100%);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

@keyframes twinkle {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.82;
  }
  45% {
    transform: scale(1.08);
    opacity: 1;
  }
  70% {
    transform: scale(0.94);
    opacity: 0.78;
  }
}

@keyframes aura-pulse {
  0%,
  100% {
    opacity: 0.18;
    transform: translate(-50%, -58%) scale(0.94);
  }
  45% {
    opacity: 0.36;
    transform: translate(-50%, -58%) scale(1.08);
  }
}

@keyframes flash-target {
  0% {
    box-shadow: 0 0 0 rgba(132, 220, 198, 0);
  }
  40% {
    box-shadow: 0 0 34px rgba(132, 220, 198, 0.34);
  }
  100% {
    box-shadow: 0 0 0 rgba(132, 220, 198, 0);
  }
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .intro-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
    align-items: start;
  }

  .eyebrow,
  .site-title,
  .site-subtitle,
  .lead,
  .toolbar,
  .backup-status {
    grid-column: 1;
  }

  .detail-card,
  .sound-card,
  .locator-card,
  .stats-card,
  .memory-list-card {
    grid-column: 2;
  }

  .detail-card {
    grid-row: 1 / span 5;
  }
}

@media (max-width: 720px) {
  body::before {
    background-size: 22px 22px;
    opacity: 0.22;
  }

  .page-glow {
    width: 280px;
    height: 280px;
    filter: blur(64px);
  }

  .shell {
    padding: 12px;
    gap: 12px;
  }

  .intro-panel,
  .sky-panel,
  .modal-card {
    border-radius: 20px;
  }

  .intro-panel,
  .sky-panel {
    padding: 16px;
  }

  .intro-panel {
    display: flex;
    gap: 16px;
  }

  h1 {
    font-size: 2.5rem;
  }

  .site-subtitle {
    margin-top: -6px;
  }

  .lead {
    font-size: 0.94rem;
    line-height: 1.65;
  }

  .toolbar,
  .sky-header,
  .section-head,
  .sound-controls,
  .stats-card,
  .two-col,
  .form-actions,
  .locator-form,
  .comfort-form {
    flex-direction: column;
  }

  .toolbar > *,
  .form-actions > *,
  .sound-controls > *,
  .locator-form > *,
  .comfort-form > * {
    width: 100%;
  }

  .sky-header,
  .section-head {
    align-items: flex-start;
  }

  .primary-btn,
  .ghost-btn {
    padding: 12px 14px;
    text-align: center;
  }

  .detail-card,
  .memory-list-card,
  .locator-card,
  .sound-card {
    padding: 16px;
    border-radius: 18px;
  }

  .stats-card {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  .stats-card strong {
    font-size: 1.28rem;
  }

  .sound-controls {
    grid-template-columns: 1fr;
  }

  .locator-form {
    grid-template-columns: 1fr;
  }

  .comfort-form {
    grid-template-columns: 1fr;
  }

  .sky-grid {
    min-height: min(620px, 72svh);
    padding: 10px;
    border-radius: 22px;
  }

  .star-cell {
    width: var(--field-size-mobile, 74px);
    height: var(--field-size-mobile, 74px);
  }

  .star-name {
    max-width: 104px;
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .star-token {
    max-width: 132px;
    padding: 5px 8px;
    font-size: 0.66rem;
  }

  .star-photo-frame {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .view-switch {
    border-radius: 18px;
  }

  .view-btn {
    border-radius: 14px;
    padding: 10px 8px;
    font-size: 0.86rem;
    line-height: 1.25;
  }

  .sky-legend {
    gap: 10px;
  }

  .sky-legend .line-toggle {
    width: 100%;
  }

  .modal-shell {
    align-items: start;
    padding: 10px;
    overflow: auto;
  }

  .modal-card {
    width: 100%;
    max-height: none;
    padding: 18px;
  }

  .modal-head {
    gap: 12px;
  }

  .detail-empty h2,
  .detail-view h2,
  .modal-head h2 {
    font-size: 1.38rem;
    line-height: 1.2;
  }

  .memory-form textarea {
    min-height: 96px;
  }
}

@media (max-width: 420px) {
  .shell {
    padding: 8px;
  }

  .intro-panel,
  .sky-panel {
    padding: 14px;
  }

  h1 {
    font-size: 2.2rem;
  }

  .site-subtitle {
    font-size: 1.05rem;
  }

  .sky-grid {
    min-height: 70svh;
  }

  .orbit-5 {
    width: 380px;
    height: 380px;
  }

  .orbit-6 {
    width: 500px;
    height: 500px;
  }
}
