:root {
  --panel: rgba(255, 255, 255, 0.1);
  --panel-strong: rgba(255, 255, 255, 0.16);
  --text: #f6f2ff;
  --muted: rgba(238, 232, 255, 0.78);
  --brand: #8d6bff;
  --brand-dark: #4e34b8;
  --accent: #d8cbff;
  --line: rgba(255, 255, 255, 0.16);
  --shadow: 0 24px 60px rgba(18, 8, 52, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(160, 120, 255, 0.28), transparent 28%),
    radial-gradient(circle at bottom right, rgba(99, 64, 219, 0.35), transparent 24%),
    linear-gradient(135deg, #120c35 0%, #26145e 44%, #4d29a6 100%);
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 0 0 32px;
}

.screen {
  min-height: calc(100vh - 52px);
  display: grid;
  place-items: center;
}

.intro-screen {
  align-items: start;
  min-height: auto;
}

.screen-card {
  width: min(100%, 980px);
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card,
.choice-card,
.map-card,
.ar-card {
  padding: 28px;
}

.hero-card {
  min-height: auto;
  display: grid;
  align-content: start;
  gap: 18px;
  position: relative;
  overflow: hidden;
  padding-top: 8px;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(216, 203, 255, 0.18), rgba(141, 107, 255, 0.16));
  filter: blur(6px);
  pointer-events: none;
}

.brand-plate {
  width: min(100%, 420px);
  padding: 14px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.compact-plate {
  margin-bottom: 4px;
}

.brand-illustration {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 22px;
}

.choice-card {
  max-width: 720px;
  min-height: 60vh;
  display: grid;
  align-content: center;
  gap: 20px;
}

.register-card {
  max-width: 760px;
}

.arrival-card {
  min-height: 56vh;
  display: grid;
  place-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top center, rgba(216, 203, 255, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
}

.arrival-copy {
  display: grid;
  gap: 14px;
  max-width: 30rem;
  width: min(100%, 460px);
  padding: 30px 24px;
  border-radius: 28px;
  background: rgba(22, 14, 56, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 22px 48px rgba(18, 8, 52, 0.28);
}

.arrival-icon-wrap {
  display: flex;
  justify-content: center;
}

.arrival-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(141, 107, 255, 0.95), rgba(216, 203, 255, 0.8));
  color: #ffffff;
  font-size: 2rem;
  font-weight: 800;
  box-shadow: 0 14px 32px rgba(86, 53, 188, 0.36);
}

.arrival-progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.arrival-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(141, 107, 255, 0.95), rgba(216, 203, 255, 0.95));
  animation: arrivalProgress 3s linear forwards;
}

.stamp-card {
  max-width: 860px;
}

.message-card {
  max-width: 860px;
  gap: 18px;
}

.user-info-card {
  max-width: 760px;
}

.map-card,
.ar-card {
  display: grid;
  gap: 20px;
}

.message-wall-shell {
  position: relative;
  height: 220px;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top left, rgba(216, 203, 255, 0.16), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  padding: 18px 14px;
}

.message-wall-shell::before,
.message-wall-shell::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 46px;
  z-index: 2;
  pointer-events: none;
}

.message-wall-shell::before {
  top: 0;
  background: linear-gradient(180deg, rgba(34, 20, 90, 0.96), rgba(34, 20, 90, 0));
}

.message-wall-shell::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(34, 20, 90, 0.96), rgba(34, 20, 90, 0));
}

.message-form textarea {
  width: 100%;
  min-height: 108px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 16px 18px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.user-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.user-info-item {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  padding: 18px;
}

.user-info-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.user-info-value {
  font-size: 1.2rem;
  font-weight: 800;
  word-break: break-word;
}

.message-form textarea::placeholder {
  color: var(--muted);
}

.message-actions {
  justify-content: space-between;
}

.message-marquee-track {
  position: relative;
  display: grid;
  align-content: center;
  gap: 14px;
  min-height: 100%;
}

.message-lane {
  overflow: visible;
}

.message-lane-track {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  width: max-content;
  --message-track-width: 0px;
  --message-shell-width: 0px;
}

.message-marquee-track.is-scrolling .lane-1 .message-lane-track {
  animation: messageMarqueeLane1 20s linear infinite;
}

.message-marquee-track.is-scrolling .lane-2 .message-lane-track {
  animation: messageMarqueeLane2 24s linear infinite;
}

.message-marquee-track.is-scrolling .lane-3 .message-lane-track {
  animation: messageMarqueeLane3 18s linear infinite;
}

.message-entry {
  border-radius: 999px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 20px rgba(18, 8, 52, 0.14);
  width: max-content;
  max-width: min(62vw, 280px);
  flex: 0 0 auto;
}

.message-size-1 {
  transform: translateY(-4px);
  max-width: min(56vw, 220px);
}

.message-size-2 {
  transform: translateY(6px);
  max-width: min(62vw, 260px);
}

.message-size-3 {
  transform: translateY(-2px);
  max-width: min(60vw, 240px);
}

.message-lane .message-entry:nth-child(4n + 1) {
  background: rgba(255, 230, 161, 0.22);
}

.message-lane .message-entry:nth-child(4n + 2) {
  background: rgba(172, 233, 255, 0.18);
}

.message-lane .message-entry:nth-child(4n + 3) {
  background: rgba(255, 196, 220, 0.18);
}

.message-lane .message-entry:nth-child(4n + 4) {
  background: rgba(202, 255, 199, 0.16);
}

.message-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
  font-size: 0.76rem;
}

.message-user {
  font-weight: 700;
}

.message-time {
  color: var(--muted);
  font-size: 0.7rem;
}

.message-body,
.message-empty {
  color: var(--text);
  line-height: 1.35;
  font-size: 0.82rem;
}

.message-empty {
  text-align: center;
  padding: 48px 12px;
  width: 100%;
}

.eyebrow,
.section-kicker,
.narration-label {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

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

h1 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.02;
  max-width: 10ch;
}

.hero-title {
  display: grid;
  gap: 8px;
  max-width: 100%;
}

.hero-title-intro {
  display: block;
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(246, 242, 255, 0.86);
}

.hero-title-brand {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.8rem, 7vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.hero-text,
.screen-text,
.status-text,
.status-card p:last-child,
.narration-card p,
.arrival-banner {
  color: var(--muted);
  line-height: 1.7;
}

.field-group,
.select-field {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.select-field span {
  font-weight: 700;
}

select {
  width: min(280px, 100%);
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 14px 16px;
  background: var(--panel-strong);
  color: var(--text);
}

input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 14px 16px;
  background: var(--panel-strong);
  color: var(--text);
}

input::placeholder {
  color: rgba(238, 232, 255, 0.48);
}

input:focus,
select:focus {
  outline: 2px solid rgba(141, 107, 255, 0.55);
  outline-offset: 2px;
}

.register-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-choice-actions {
  justify-content: flex-start;
}

.auth-requirements {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

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

.leaderboard-list {
  display: grid;
  gap: 10px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 90px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.leaderboard-row.rank-top-1,
.leaderboard-row.rank-top-2,
.leaderboard-row.rank-top-3 {
  border-color: rgba(216, 203, 255, 0.44);
  box-shadow: 0 16px 28px rgba(62, 33, 150, 0.18);
}

.leaderboard-row.rank-top-1 {
  background: linear-gradient(135deg, rgba(255, 219, 110, 0.22), rgba(141, 107, 255, 0.18));
}

.leaderboard-row.rank-top-2 {
  background: linear-gradient(135deg, rgba(220, 228, 243, 0.2), rgba(141, 107, 255, 0.14));
}

.leaderboard-row.rank-top-3 {
  background: linear-gradient(135deg, rgba(223, 158, 112, 0.2), rgba(141, 107, 255, 0.12));
}

.leaderboard-row-head {
  background: rgba(141, 107, 255, 0.14);
  font-weight: 700;
  color: rgba(246, 242, 255, 0.92);
}

.leaderboard-rank {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.leaderboard-count {
  justify-self: end;
  font-weight: 700;
}

.leaderboard-empty {
  text-align: center;
  color: var(--muted);
}

.leaderboard-actions {
  justify-content: flex-end;
}

.page-back-row {
  justify-content: flex-end;
  margin-top: 2px;
}

.stamp-actions {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: space-between;
  align-items: center;
}

.stamp-slot {
  display: grid;
  gap: 12px;
  padding: 22px 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}

.stamp-collected {
  background: linear-gradient(180deg, rgba(141, 107, 255, 0.22), rgba(255, 255, 255, 0.08));
  border-color: rgba(216, 203, 255, 0.48);
  box-shadow: 0 16px 30px rgba(78, 52, 184, 0.22);
}

.stamp-badge {
  width: 112px;
  height: 112px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 10px 20px rgba(19, 10, 50, 0.2);
}

.stamp-badge-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.button-row,
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.role-actions {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: space-between;
}

.auth-actions {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: space-between;
}

.intro-actions {
  margin-top: 0;
  justify-content: center;
  padding-top: 0;
}

.intro-cta-btn {
  min-width: min(100%, 320px);
  justify-content: center;
  padding-inline: 28px;
}

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

.choice-chip,
.primary-btn,
.ghost-btn {
  border-radius: 999px;
  padding: 14px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.choice-chip {
  min-height: 72px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 700;
  border-color: rgba(255, 255, 255, 0.12);
}

.choice-chip.active {
  background: var(--brand);
  color: #fff;
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(78, 52, 184, 0.28);
}

.ghost-btn {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.choice-chip:hover,
.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.ghost-btn:disabled,
.choice-chip:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.section-heading,
.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.map-stage {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(141, 107, 255, 0.14), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.06);
  min-height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.leaflet-map {
  width: 100%;
  height: 100%;
  display: block;
  min-height: 420px;
}

.leaflet-container {
  background: rgba(255, 255, 255, 0.08);
  font-family: "Noto Sans SC", sans-serif;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #201451;
  color: #f6f2ff;
}

.leaflet-popup-content {
  margin: 12px 14px;
  line-height: 1.6;
}

.map-user-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #9fe0ff;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 8px rgba(159, 224, 255, 0.22);
}

.map-poi-chip {
  min-width: 42px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(99, 58, 222, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 10px 24px rgba(28, 12, 72, 0.28);
}

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

.distance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.distance-item.in-range {
  background: rgba(141, 107, 255, 0.18);
  border-color: rgba(184, 159, 255, 0.48);
  box-shadow: 0 12px 28px rgba(73, 45, 163, 0.22);
}

.distance-code {
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(246, 242, 255, 0.95);
}

.distance-value {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--muted);
}


.narration-card,
.arrival-banner {
  border-radius: 24px;
  padding: 20px;
}

.map-status-line {
  margin: 2px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
  max-width: 72ch;
}

.map-actions {
  gap: 10px;
  align-items: center;
}

.compact-btn {
  padding: 12px 16px;
  min-height: 46px;
  font-size: 0.95rem;
}

.guide-stage {
  position: relative;
  min-height: 48vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(141, 107, 255, 0.22), transparent 28%),
    linear-gradient(180deg, rgba(17, 9, 48, 0.96), rgba(10, 7, 28, 0.98));
}

.guide-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.guide-backdrop {
  background:
    linear-gradient(180deg, rgba(9, 6, 24, 0.18), rgba(9, 6, 24, 0.42)),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.06), transparent 36%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 72px
    );
}

.guide-stage-content {
  position: relative;
  z-index: 1;
  width: min(100%, 720px);
  display: grid;
  gap: 14px;
  padding: 34px 30px;
  text-align: center;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(23, 15, 60, 0.82), rgba(18, 12, 46, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 38px rgba(9, 6, 24, 0.24);
  backdrop-filter: blur(8px);
}

.guide-stage-title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.12;
}

.guide-stage-image-shell {
  width: min(100%, 340px);
  margin: 4px auto 0;
  padding: 10px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.guide-stage-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: cover;
  border-radius: 18px;
}

.narration-card {
  background: rgba(23, 15, 60, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.2);
}

.centered-narration {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: 100%;
  margin: -12px auto 0;
  padding: 18px 20px;
}

.guide-controls {
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.guide-control-btn {
  padding: 10px 14px;
  min-height: 42px;
  min-width: 180px;
  font-size: 0.92rem;
  white-space: nowrap;
}


.scan-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.scan-title {
  margin-top: 4px;
  font-size: 1.2rem;
}

.scan-text {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.65;
}

.scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(10, 7, 28, 0.84);
  backdrop-filter: blur(10px);
}

.scan-shell {
  width: min(100% - 24px, 720px);
  display: grid;
  gap: 14px;
}

.scan-camera-wrap {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #0d0a21;
  min-height: 62vh;
}

#scanVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scan-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(84vw, 460px);
  height: min(34vh, 220px);
  transform: translate(-50%, -50%);
  border: 3px solid rgba(216, 203, 255, 0.95);
  border-radius: 24px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.24);
  background: linear-gradient(180deg, rgba(141, 107, 255, 0.08), rgba(255, 255, 255, 0.02));
}

.scan-frame::before,
.scan-frame::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(216, 203, 255, 0.95), transparent);
  animation: scanPulse 1.9s ease-in-out infinite;
}

.scan-frame::before {
  top: 28%;
}

.scan-frame::after {
  top: 72%;
}

.scan-overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.scan-overlay-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.scan-debug-text {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(216, 203, 255, 0.92);
  line-height: 1.5;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

.app-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(calc(100% - 24px), 360px);
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(15, 20, 28, 0.92);
  border: 1px solid rgba(120, 255, 192, 0.28);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translate(-50%, calc(-50% - 12px)) scale(0.98);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

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

.app-toast.is-info {
  border-color: rgba(216, 203, 255, 0.28);
}

.app-toast-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #2fd37a, #1d9f5b);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.app-toast.is-info .app-toast-icon {
  background: linear-gradient(135deg, #8d6bff, #4e34b8);
}

.app-toast-message {
  margin: 0;
  color: #f7fbff;
  line-height: 1.5;
  font-size: 0.93rem;
}

@keyframes avatarFloat {
  0%,
  100% {
    transform: translate(-50%, -50%);
  }
  50% {
    transform: translate(-50%, calc(-50% - 10px));
  }
}

@keyframes scanPulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scaleX(0.94);
  }
  50% {
    opacity: 0.9;
    transform: scaleX(1);
  }
}

@keyframes arrivalProgress {
  0% {
    transform: scaleX(0);
  }
  100% {
    transform: scaleX(1);
  }
}

@keyframes messageMarquee {
  from {
    transform: translateX(calc(-1 * var(--message-track-width)));
  }
  to {
    transform: translateX(var(--message-shell-width));
  }
}

@keyframes messageMarqueeLane1 {
  from {
    transform: translateX(calc(-1 * var(--message-track-width)));
  }
  to {
    transform: translateX(var(--message-shell-width));
  }
}

@keyframes messageMarqueeLane2 {
  from {
    transform: translateX(calc(-1 * var(--message-track-width) - 120px));
  }
  to {
    transform: translateX(calc(var(--message-shell-width) + 60px));
  }
}

@keyframes messageMarqueeLane3 {
  from {
    transform: translateX(calc(-1 * var(--message-track-width) - 48px));
  }
  to {
    transform: translateX(calc(var(--message-shell-width) + 120px));
  }
}

@keyframes avatarSway {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(-1.5deg);
  }
  50% {
    transform: translate(-50%, calc(-50% - 6px)) rotate(1.5deg);
  }
}

@keyframes avatarBounce {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, calc(-50% - 12px)) scale(1.03);
  }
}

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

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

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

  .leaderboard-row {
    grid-template-columns: 58px minmax(0, 1fr) 72px;
    padding: 12px 14px;
    font-size: 0.92rem;
  }

  .leaderboard-actions {
    justify-content: flex-end;
  }

  .guide-stage {
    min-height: 780px;
  }

  .avatar-card {
    width: min(56vw, 320px);
    height: 360px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 12px, 1180px);
    padding-top: 0;
    padding-bottom: 0;
  }

  .screen {
    min-height: calc(100vh - 20px);
  }

  .intro-screen {
    min-height: auto;
  }

  .hero-card,
  .choice-card,
  .map-card,
  .ar-card {
    padding: 18px;
  }

  .hero-card {
    padding-top: 12px;
    gap: 14px;
  }

  .screen-card {
    border-radius: 20px;
  }

  .eyebrow,
  .section-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.07em;
  }

  h1 {
    font-size: clamp(2rem, 8vw, 2.6rem);
    max-width: 100%;
  }

  .hero-title {
    gap: 6px;
  }

  .hero-title-intro {
    font-size: 0.98rem;
  }

  .hero-title-brand {
    font-size: clamp(2.4rem, 11vw, 3.2rem);
    line-height: 0.94;
  }

  h2 {
    font-size: clamp(1.3rem, 5vw, 1.7rem);
  }

  h3 {
    font-size: 1rem;
  }

  .hero-text,
  .screen-text,
  .status-text,
  .map-status-line,
  .scan-text,
  .scan-overlay-text,
  .scan-debug-text {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .brand-plate {
    width: 100%;
    padding: 10px;
    border-radius: 22px;
  }

  .brand-illustration {
    border-radius: 16px;
  }

  select,
  input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
  }

  .section-heading,
  .camera-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .button-row {
    gap: 10px;
  }

  .role-actions {
    grid-template-columns: auto auto;
  }

  .auth-actions {
    grid-template-columns: auto auto;
  }

  .intro-actions {
    justify-content: center;
  }

  .intro-cta-btn {
    min-width: min(100%, 280px);
  }

  .stamp-actions {
    grid-template-columns: auto auto;
  }

  .page-back-row {
    justify-content: flex-end;
  }

  .choice-chip,
  .primary-btn,
  .ghost-btn {
    min-height: 48px;
    padding: 12px 15px;
    font-size: 0.95rem;
  }

  .choice-chip {
    min-height: 62px;
  }

  .map-stage {
    min-height: 260px;
    border-radius: 18px;
  }

  .leaflet-map {
    min-height: 260px;
  }

  .map-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .distance-panel {
    grid-template-columns: 1fr;
  }

  .compact-btn {
    width: 100%;
    justify-content: center;
  }

  .guide-stage {
    min-height: 360px;
    padding: 18px;
    border-radius: 20px;
  }

  .guide-stage-content {
    padding: 24px 18px;
    border-radius: 18px;
  }

  .guide-stage-title {
    font-size: 1.6rem;
  }

  .guide-stage-image-shell {
    width: min(100%, 260px);
    padding: 8px;
    border-radius: 18px;
  }

  .centered-narration {
    width: 100%;
    margin-top: -2px;
    padding: 14px 14px;
  }

  .guide-controls {
    gap: 8px;
  }

  .guide-control-btn {
    padding: 8px 10px;
    min-height: 40px;
    min-width: 100%;
    font-size: 0.84rem;
  }

  .scan-panel,
  .stamp-slot,
  .narration-card {
    padding: 16px;
    border-radius: 18px;
  }

  .stamp-badge {
    width: 88px;
    height: 88px;
  }

  .scan-shell {
    width: calc(100% - 12px);
    gap: 10px;
  }

  .scan-camera-wrap {
    min-height: 52vh;
    border-radius: 18px;
  }

  .scan-frame {
    width: min(88vw, 340px);
    height: min(26vh, 170px);
    border-radius: 18px;
  }

  .scan-overlay-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
    border-radius: 16px;
  }

  .app-toast {
    width: min(calc(100% - 24px), 320px);
    padding: 12px 14px;
    border-radius: 16px;
  }
}


/* Cartoon Intro Theme Overrides */
:root {
  --panel: rgba(119, 86, 220, 0.88);
  --panel-strong: rgba(173, 143, 255, 0.28);
  --text: #fffaf6;
  --muted: rgba(255, 244, 236, 0.86);
  --brand: #ffb238;
  --brand-dark: #ff7d47;
  --accent: #ffe27f;
  --line: rgba(45, 18, 88, 0.82);
  --shadow: 0 18px 0 rgba(45, 18, 88, 0.58), 0 28px 50px rgba(34, 15, 74, 0.3);
}

body {
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 236, 128, 0.18), transparent 18%),
    radial-gradient(circle at 86% 22%, rgba(255, 174, 96, 0.18), transparent 16%),
    radial-gradient(circle at 78% 82%, rgba(255, 255, 255, 0.1), transparent 18%),
    linear-gradient(145deg, #261060 0%, #4b249d 48%, #6e36c9 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 10%, rgba(255,255,255,0.85) 0 2px, transparent 3px),
    radial-gradient(circle at 86% 16%, rgba(255,255,255,0.8) 0 1.8px, transparent 3px),
    radial-gradient(circle at 72% 74%, rgba(255,255,255,0.7) 0 2px, transparent 3px),
    radial-gradient(circle at 18% 78%, rgba(255,255,255,0.75) 0 1.8px, transparent 3px);
  opacity: 0.7;
}

.app-shell {
  width: min(1180px, calc(100% - 20px));
  padding: 16px 0 28px;
}

.screen-card {
  position: relative;
  border: 4px solid rgba(45, 18, 88, 0.88);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(161, 126, 255, 0.22), rgba(255, 255, 255, 0.04)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(0px);
}

.screen-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 2px solid rgba(255, 241, 195, 0.32);
  border-radius: 24px;
  pointer-events: none;
}

.hero-card,
.choice-card,
.map-card,
.ar-card,
.navigation-card {
  padding: 26px;
}

.hero-card,
.choice-card,
.map-card,
.ar-card,
.navigation-card,
.arrival-card,
.stamp-card {
  background:
    radial-gradient(circle at top center, rgba(255, 240, 180, 0.2), transparent 26%),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
    var(--panel);
}

.brand-plate,
.map-stage,
.narration-card,
.scan-panel,
.arrival-copy,
.navigation-target-card,
.navigation-readout,
.stamp-slot,
.leaderboard-row,
.distance-item {
  border: 3px solid rgba(45, 18, 88, 0.82);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.04)),
    rgba(140, 102, 238, 0.86);
  box-shadow: 0 10px 0 rgba(45, 18, 88, 0.36);
}

.brand-plate {
  padding: 12px;
}

.brand-illustration,
.stamp-badge,
.stamp-badge-image {
  border-radius: 20px;
}

.eyebrow,
.section-kicker,
.narration-label {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 3px solid rgba(45, 18, 88, 0.82);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe68b, #ffbf59);
  color: #3c1d79;
  font-weight: 800;
  box-shadow: 0 6px 0 rgba(45, 18, 88, 0.26);
}

h1,
h2,
h3 {
  color: #fff9f4;
  text-shadow: 0 3px 0 rgba(45, 18, 88, 0.45);
}

.hero-title-brand {
  font-size: clamp(3rem, 8vw, 5.4rem);
  line-height: 0.9;
}

.hero-title-intro {
  color: rgba(255, 247, 236, 0.94);
  font-weight: 700;
}

select,
input {
  border-radius: 20px;
  border: 3px solid rgba(45, 18, 88, 0.82);
  background: rgba(255, 248, 240, 0.16);
  color: var(--text);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.12);
}

.choice-chip,
.primary-btn,
.ghost-btn {
  border-radius: 24px;
  border: 3px solid rgba(45, 18, 88, 0.84);
  font-weight: 800;
  min-height: 58px;
  box-shadow: 0 8px 0 rgba(45, 18, 88, 0.32);
}

.choice-chip {
  background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.08)), rgba(118, 84, 217, 0.94);
}

.choice-chip.active,
.primary-btn {
  color: #3c1d79;
  background: linear-gradient(180deg, #ffe383, #ff9d42);
}

.ghost-btn {
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05)), rgba(112, 79, 204, 0.94);
  color: #fff8f2;
}

.choice-chip:hover,
.primary-btn:hover,
.ghost-btn:hover,
.distance-item:hover {
  transform: translateY(-2px) scale(1.01);
}

.arrival-icon {
  border: 3px solid rgba(45, 18, 88, 0.84);
  background: linear-gradient(180deg, #ffe47f, #ff9655);
  color: #3c1d79;
  box-shadow: 0 10px 0 rgba(45, 18, 88, 0.28);
}

.arrival-progress,
.arrival-progress-bar {
  border-radius: 999px;
}

.arrival-progress {
  border: 3px solid rgba(45, 18, 88, 0.78);
  background: rgba(255,255,255,0.14);
}

.arrival-progress-bar {
  background: linear-gradient(90deg, #ffe27f, #ff8d4f);
}

.map-poi-chip,
.distance-code {
  color: #3c1d79;
  background: linear-gradient(180deg, #fff0ad, #ffc75d);
  border-radius: 999px;
}

.distance-code {
  padding: 6px 10px;
}

.distance-item.in-range {
  background: linear-gradient(180deg, rgba(255,235,162,0.36), rgba(255,255,255,0.06)), rgba(145, 112, 244, 0.92);
  border-color: rgba(255, 233, 160, 0.88);
}

.leaderboard-row.rank-top-1,
.leaderboard-row.rank-top-2,
.leaderboard-row.rank-top-3,
.stamp-collected {
  border-color: rgba(255, 233, 160, 0.88);
}

.guide-stage,
.navigation-stage {
  border: 4px solid rgba(45, 18, 88, 0.84);
  border-radius: 30px;
  box-shadow: inset 0 0 0 3px rgba(255, 244, 201, 0.12);
}

.avatar-card {
  border: 3px solid rgba(45, 18, 88, 0.76);
  background: rgba(255,255,255,0.06);
}

.navigation-ring,
.navigation-ground-line::before,
.navigation-ground-line::after,
.navigation-arrow-shaft,
.navigation-arrow-head {
  filter: drop-shadow(0 10px 18px rgba(52, 24, 110, 0.22));
}

.status-text,
.map-status-line,
.scan-text,
.navigation-direction,
.navigation-distance,
.distance-value,
.leaderboard-empty,
.leaderboard-count {
  color: rgba(255, 246, 238, 0.92);
}

@media (max-width: 640px) {
  .screen-card {
    border-width: 3px;
    border-radius: 26px;
  }

  .screen-card::before {
    inset: 10px;
    border-radius: 18px;
  }

  .eyebrow,
  .section-kicker,
  .narration-label {
    padding: 7px 12px;
    border-width: 2px;
  }

  .choice-chip,
  .primary-btn,
  .ghost-btn {
    min-height: 52px;
    border-width: 2px;
    box-shadow: 0 6px 0 rgba(45, 18, 88, 0.28);
  }

  .brand-plate,
  .map-stage,
  .narration-card,
  .scan-panel,
  .arrival-copy,
  .navigation-target-card,
  .navigation-readout,
  .stamp-slot,
  .leaderboard-row,
  .distance-item {
    border-width: 2px;
    box-shadow: 0 8px 0 rgba(45, 18, 88, 0.28);
  }
}
.hub-card {
  max-width: 760px;
  min-height: 52vh;
  display: grid;
  align-content: center;
  gap: 22px;
  position: relative;
  overflow: hidden;
}

.hub-card::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 28px;
  border: 3px dashed rgba(255, 222, 89, 0.48);
  pointer-events: none;
}

.hub-card h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  text-align: center;
  font-size: clamp(2rem, 4vw, 3rem);
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  position: relative;
  z-index: 1;
}

.hub-chip {
  min-height: 110px;
  width: 100%;
  justify-content: center;
  font-size: 1.08rem;
  font-weight: 800;
  color: #3a206d;
  background: linear-gradient(180deg, #ffe98e 0%, #ffc94f 100%);
  border: 3px solid #fff1b4;
  box-shadow:
    0 14px 0 rgba(129, 77, 0, 0.24),
    0 22px 38px rgba(38, 12, 87, 0.2);
  transform: translateY(0);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.hub-chip:hover,
.hub-chip:focus-visible {
  transform: translateY(-4px) scale(1.01);
  filter: brightness(1.03);
  box-shadow:
    0 18px 0 rgba(129, 77, 0, 0.2),
    0 28px 44px rgba(38, 12, 87, 0.26);
}

.hub-chip:active {
  transform: translateY(4px);
  box-shadow:
    0 8px 0 rgba(129, 77, 0, 0.22),
    0 14px 24px rgba(38, 12, 87, 0.18);
}

.hub-card .page-back-row {
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  .hub-card {
    min-height: auto;
    gap: 16px;
  }

  .hub-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hub-chip {
    min-height: 84px;
    font-size: 1rem;
  }

  .hub-card::before {
    inset: 10px;
    border-radius: 22px;
  }

  .message-wall-shell {
    height: 180px;
    padding: 14px 10px;
  }

  .message-entry {
    max-width: 56vw;
    border-radius: 18px;
    padding: 8px 12px;
  }

  .message-marquee-track {
    gap: 10px;
  }

  .message-lane-track {
    gap: 10px;
  }

  .message-size-1,
  .message-size-2,
  .message-size-3 {
    max-width: 54vw;
  }

  .user-info-grid {
    grid-template-columns: 1fr;
  }
}
