:root {
  color-scheme: light;
  --bg: #f8f4ec;
  --bg-deep: #efe4d2;
  --surface: rgba(255, 252, 246, 0.86);
  --surface-strong: #fffaf0;
  --text: #2c2419;
  --muted: #7d6c58;
  --line: rgba(92, 68, 39, 0.14);
  --primary: #f07f3c;
  --primary-dark: #c95721;
  --primary-soft: #ffe0c9;
  --green: #4fa96c;
  --green-soft: #dff4e5;
  --blue: #3e85e6;
  --blue-soft: #dbeaff;
  --danger: #d84a43;
  --danger-soft: #ffe0de;
  --shadow: 0 20px 60px rgba(108, 73, 29, 0.16);
  --shadow-soft: 0 12px 30px rgba(108, 73, 29, 0.11);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 197, 108, 0.34), transparent 28rem),
    radial-gradient(circle at 96% 14%, rgba(111, 177, 139, 0.24), transparent 25rem),
    linear-gradient(160deg, var(--bg), var(--bg-deep));
}

body {
  min-height: 100vh;
  margin: 0;
  background: transparent;
  color: var(--text);
}

button,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.1rem, 12vw, 4.2rem);
  letter-spacing: -0.08em;
  line-height: 0.9;
}

h2 {
  font-size: 1.16rem;
  letter-spacing: -0.03em;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px calc(28px + var(--safe-bottom));
}

.hero-card,
.card,
.tab-bar,
.modal__panel,
.toast {
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.hero-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 248, 234, 0.92), rgba(255, 238, 213, 0.72)),
    radial-gradient(circle at 85% 18%, rgba(255, 159, 91, 0.34), transparent 14rem);
  box-shadow: var(--shadow);
}

.hero-card__glow {
  position: absolute;
  inset: auto -18% -40% 28%;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 176, 80, 0.38), transparent 68%);
  pointer-events: none;
}

.hero-card__content {
  position: relative;
  z-index: 1;
  padding: 24px 22px 20px;
}

.eyebrow,
.section-kicker {
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-card__title-row,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hero-card__subtitle,
.muted,
.helper-text {
  color: var(--muted);
  line-height: 1.65;
}

.hero-card__subtitle {
  margin-top: 12px;
  font-size: 0.96rem;
}

.daily-badge {
  display: grid;
  min-width: 76px;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
  box-shadow: 0 10px 24px rgba(198, 112, 48, 0.14);
}

.daily-badge span {
  color: var(--muted);
  font-size: 0.72rem;
}

.daily-badge strong {
  font-size: 1.2rem;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 18px;
}

.status-pill,
.range-chip,
.bonus-chip {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.52);
  color: #72523a;
}

.tab-bar {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 14px 0;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.72);
  box-shadow: var(--shadow-soft);
}

.tab-button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  padding: 10px 12px;
  transition: 180ms ease;
}

.tab-button.is-active {
  background: var(--text);
  color: #fff8ed;
  box-shadow: 0 8px 20px rgba(44, 36, 25, 0.18);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: grid;
  gap: 14px;
}

.card {
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.intro-card,
.interaction-card {
  display: grid;
  gap: 16px;
}

.action-row,
.action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 850;
  padding: 11px 16px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, opacity 160ms ease;
}

.button:active {
  transform: translateY(1px) scale(0.99);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button--primary {
  background: linear-gradient(135deg, var(--primary), #ffb05f);
  color: #fffaf5;
  box-shadow: 0 12px 24px rgba(240, 127, 60, 0.28);
}

.button--soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.button--ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.38);
  color: var(--text);
}

.button--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button--wide {
  width: 100%;
}

.button--small {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.radar-card {
  overflow: hidden;
}

.range-chip,
.bonus-chip {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--primary-dark);
}

.radar {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  width: min(100%, 420px);
  margin: 18px auto 12px;
  border: 1px solid rgba(77, 57, 34, 0.12);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 250, 234, 0.93) 0 10%, transparent 10.5%),
    radial-gradient(circle, rgba(255, 255, 255, 0.54), rgba(255, 227, 187, 0.6) 58%, rgba(255, 206, 148, 0.42)),
    linear-gradient(135deg, rgba(255, 184, 95, 0.28), rgba(126, 192, 147, 0.25));
  box-shadow: inset 0 0 55px rgba(156, 98, 34, 0.18), 0 18px 36px rgba(115, 78, 34, 0.12);
}

.radar__sweep {
  position: absolute;
  inset: 50% 50% auto auto;
  width: 50%;
  height: 50%;
  border-radius: 100% 0 0 0;
  transform-origin: 100% 100%;
  background: linear-gradient(45deg, rgba(240, 127, 60, 0.26), transparent 62%);
  animation: radarSweep 8s linear infinite;
}

@keyframes radarSweep {
  to {
    transform: rotate(360deg);
  }
}

.radar__ring,
.radar__axis,
.home-dot,
.player-dot,
.radar-point,
.radar__north,
.radar__empty {
  position: absolute;
}

.radar__ring {
  inset: 50%;
  border: 1px dashed rgba(88, 68, 45, 0.22);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.radar__ring--outer {
  width: 92%;
  height: 92%;
}

.radar__ring--middle {
  width: 62%;
  height: 62%;
}

.radar__ring--inner {
  width: 32%;
  height: 32%;
}

.radar__axis {
  background: rgba(88, 68, 45, 0.1);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.radar__axis--vertical {
  width: 1px;
  height: 92%;
}

.radar__axis--horizontal {
  width: 92%;
  height: 1px;
}

.radar__north {
  left: 50%;
  top: 11px;
  transform: translateX(-50%);
  color: rgba(44, 36, 25, 0.42);
  font-size: 0.75rem;
  font-weight: 900;
}

.home-dot {
  left: 50%;
  top: 50%;
  z-index: 5;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: linear-gradient(135deg, #292115, #6b4a27);
  color: #fff8ec;
  font-size: 0.78rem;
  font-weight: 900;
  transform: translate(-50%, -50%);
  box-shadow: 0 12px 20px rgba(48, 31, 14, 0.22);
}

.player-dot {
  z-index: 6;
  width: 22px;
  height: 22px;
  border: 4px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 8px rgba(62, 133, 230, 0.16), 0 12px 20px rgba(62, 133, 230, 0.22);
  transform: translate(-50%, -50%);
}

.is-hidden {
  display: none !important;
}

.radar__points {
  position: absolute;
  inset: 0;
}

.radar-point {
  z-index: 4;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd362, #ff8849);
  color: #fff;
  cursor: pointer;
  font-weight: 950;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 8px rgba(255, 156, 72, 0.16), 0 12px 22px rgba(184, 91, 34, 0.22);
}

.radar-point.is-collected {
  background: linear-gradient(135deg, #98b79e, #628b6a);
  box-shadow: 0 0 0 8px rgba(79, 169, 108, 0.14), 0 12px 22px rgba(67, 118, 82, 0.18);
}

.radar-point.is-selected {
  outline: 3px solid rgba(44, 36, 25, 0.26);
  outline-offset: 3px;
}

.radar__empty {
  inset: 0;
  display: grid;
  place-items: center;
  padding: 36px;
  color: rgba(44, 36, 25, 0.54);
  font-weight: 800;
  text-align: center;
}

.helper-text {
  font-size: 0.84rem;
}

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

.point-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
  padding: 12px;
}

.point-item.is-selected {
  border-color: rgba(240, 127, 60, 0.42);
  background: rgba(255, 224, 201, 0.48);
}

.point-item__mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 950;
}

.point-item.is-collected .point-item__mark {
  background: var(--green-soft);
  color: var(--green);
}

.point-item__main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.point-item__title {
  font-weight: 900;
}

.point-item__meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.interaction-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 240, 215, 0.72)),
    radial-gradient(circle at 95% 0%, rgba(240, 127, 60, 0.18), transparent 14rem);
}

.interaction-prompt {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.7;
}

.bonus-chip.is-ready {
  background: var(--green-soft);
  color: var(--green);
}

.collection-card {
  overflow: hidden;
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.puzzle-piece {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.42);
  color: rgba(44, 36, 25, 0.36);
  display: grid;
  place-items: center;
  font-weight: 950;
  box-shadow: inset 0 0 28px rgba(88, 68, 45, 0.08);
}

.puzzle-piece.is-owned {
  color: #fff;
  box-shadow: 0 12px 20px rgba(106, 70, 27, 0.13), inset 0 0 34px rgba(255, 255, 255, 0.22);
}

.puzzle-piece__emoji {
  font-size: 1.7rem;
  filter: drop-shadow(0 6px 10px rgba(44, 36, 25, 0.18));
}

.memory-card {
  background: linear-gradient(135deg, rgba(255, 251, 242, 0.82), rgba(228, 244, 231, 0.8));
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-weight: 800;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  outline: none;
}

select {
  min-height: 48px;
  padding: 0 14px;
}

.data-card,
.settings-card,
.debug-card {
  display: grid;
  gap: 14px;
}

.file-button input {
  display: none;
}

.data-textarea {
  min-height: 150px;
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
}

.debug-card summary {
  cursor: pointer;
  font-weight: 900;
}

.debug-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.debug-list div {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.debug-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.debug-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.modal.is-open {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(38, 28, 18, 0.42);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 500px);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 28px;
  background: rgba(255, 250, 241, 0.94);
  box-shadow: 0 24px 70px rgba(38, 28, 18, 0.28);
  padding: 22px;
  animation: modalIn 220ms ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
}

.modal__close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(44, 36, 25, 0.08);
  color: var(--text);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.modal__body {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.reward-list {
  display: grid;
  gap: 8px;
}

.reward-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  padding: 10px;
}

.reward-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  font-size: 1.3rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  z-index: 80;
  max-width: min(90vw, 420px);
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(44, 36, 25, 0.9);
  color: #fff8ed;
  font-size: 0.9rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 430px) {
  .status-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
