:root {
  --bg: #101014;
  --card: #1a1a22;
  --text: #f5f5f7;
  --muted: #b8b8c4;
  --line: rgba(255, 255, 255, 0.14);
  --button: #2a2a36;
  --button-hover: #353545;
  --primary: #ffffff;
  --primary-text: #111111;
  --focus: #6ec6ff;
  --warning: #ffd37a;
}

* { box-sizing: border-box; }

html { background: #000000; }

body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #272733 0, #101014 45%, #050507 100%);
  color: var(--text);
  line-height: 1.5;
}

button, input { font: inherit; }
a { color: var(--text); }

.skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 100000;
  padding: 10px 14px;
  border-radius: 12px;
  background: #ffffff;
  color: #000000;
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.topbar {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
}

.brand img { border-radius: 8px; }

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 650;
}

.topbar nav a:hover { color: var(--text); }

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

.hero {
  text-align: center;
  padding: 28px 0 18px;
}

.hero.compact { padding-bottom: 6px; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

h2 { line-height: 1.15; }

.intro {
  max-width: 680px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 13px 18px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--line);
  font-weight: 750;
}

.primary-link { background: #ffffff; color: #111111; }
.secondary-link { background: rgba(255, 255, 255, 0.06); color: var(--text); }

.card, .seo-section {
  margin-top: 22px;
  padding: 22px;
  background: rgba(26, 26, 34, 0.86);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(14px);
}

.card h2, .seo-section h2 {
  margin: 0 0 16px;
  font-size: 1.35rem;
}

.card p, .seo-section p, .text-card li { color: var(--muted); }

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

button {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--button);
  color: var(--text);
  padding: 13px 14px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border 0.12s ease;
}

button:hover {
  background: var(--button-hover);
  transform: translateY(-1px);
}

button.active, button[aria-pressed="true"] {
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.field { margin-top: 18px; }

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

input[type="color"] {
  width: 100%;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--button);
  padding: 6px;
}

input[type="range"] { width: 100%; }

.hint {
  margin: 14px 0 0;
  font-size: 0.95rem;
}

.warning {
  color: var(--warning) !important;
  font-size: 0.95rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
}

.checkbox input {
  width: 20px;
  height: 20px;
}

.actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.primary {
  width: min(100%, 420px);
  padding: 18px 22px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 750;
  font-size: 1.08rem;
}

.primary:hover { background: #f0f0f0; }

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

.status-message {
  min-height: 1.5em;
  margin-bottom: 0;
}

.qr-wrap {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.05);
  text-align: center;
}

.qr-wrap img {
  width: 180px;
  height: 180px;
  max-width: 100%;
  background: #ffffff;
  padding: 10px;
  border-radius: 12px;
}

.seo-section { margin-top: 32px; }

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

.faq-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
}

.faq-grid h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.faq-grid p {
  margin: 0;
  font-size: 0.96rem;
}

.text-card h3 { margin-top: 22px; }
.text-card ol { padding-left: 1.4rem; }

.panel {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  background: #ffffff;
}

.panel.active { display: block; }

.countdown {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: #000000;
  color: #ffffff;
  font-size: clamp(5rem, 28vw, 15rem);
  font-weight: 800;
  z-index: 10001;
}

.countdown.active { display: grid; }

.exit {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 10000;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 2rem;
  line-height: 1;
}

.exit:hover { background: rgba(0, 0, 0, 0.34); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

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

@media (max-width: 600px) {
  .topbar, .app { width: min(100% - 22px, 920px); }
  .topbar { padding-top: 14px; }
  .brand span {
    max-width: 190px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .app { padding-top: 18px; }
  .card, .seo-section {
    padding: 18px;
    border-radius: 18px;
  }
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
}


/* v1.2 layout and effects */
.topbar nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.early-action {
  margin-top: 18px;
}

.callout-card {
  text-align: center;
}

.wide-link {
  margin-top: 10px;
  width: min(100%, 320px);
}

.sticky-start {
  display: none;
}

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

.effect-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.effect-card h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.effect-card p {
  margin: 0 0 16px;
}

.effect-button {
  width: 100%;
}

.effect-countdown {
  margin-top: 18px;
}

.effect-panel {
  overflow: hidden;
}

.aurora-canvas {
  position: fixed;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
}

.panel.aurora-active .aurora-canvas {
  display: block;
}

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

@media (max-width: 600px) {
  body.has-sticky-start {
    padding-bottom: 88px;
  }

  .sticky-start {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 9000;
    display: block;
    min-height: 56px;
    border-radius: 999px;
    background: #ffffff;
    color: #111111;
    font-weight: 800;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
  }

  body.panel-open .sticky-start {
    display: none;
  }

  .topbar nav {
    gap: 10px;
    font-size: 0.92rem;
  }
}


/* v1.3.1 fix: make effect exit button reliably clickable */
.aurora-canvas {
  pointer-events: none;
  z-index: 9998;
}

.effect-panel .exit,
.panel .exit {
  z-index: 10050;
  pointer-events: auto;
  touch-action: manipulation;
}


/* v1.3.6: stable inline app code and clearer color picker */
.field-help {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel .exit {
  z-index: 10080;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.42);
  border-color: rgba(255, 255, 255, 0.46);
}

/* v1.5.2 emergency fix: safe iPhone UI, stable light panel behavior */
.topbar {
  padding-top: max(16px, calc(env(safe-area-inset-top) + 12px));
  padding-left: max(18px, calc(env(safe-area-inset-left) + 18px));
  padding-right: max(18px, calc(env(safe-area-inset-right) + 18px));
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  min-height: 40px;
}

.topbar nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}

.nav-separator {
  color: rgba(255, 255, 255, 0.42);
  font-weight: 400;
  line-height: 1;
  user-select: none;
}

.sticky-start {
  display: none !important;
}

body.has-sticky-start {
  padding-bottom: 0 !important;
}

.start-panel-actions {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.2rem;
  max-width: 460px;
}

.start-panel-actions .primary {
  width: 100%;
  min-height: 58px;
}

.countdown-choice {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.25;
}

.countdown-choice input {
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 auto;
  accent-color: #ffffff;
}

.panel .exit,
.panel-close {
  position: fixed;
  top: auto !important;
  right: auto !important;
  left: 50% !important;
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 18px)) !important;
  transform: translateX(-50%) !important;
  z-index: 10080;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 112px;
  min-height: 52px;
  width: auto;
  height: 52px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.exit-label {
  font-size: 0.96rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.01em;
}

@media (min-width: 760px) {
  .panel .exit,
  .panel-close {
    left: auto !important;
    right: max(22px, calc(env(safe-area-inset-right) + 22px)) !important;
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 22px)) !important;
    transform: none !important;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding-top: max(28px, calc(env(safe-area-inset-top) + 22px));
    padding-bottom: 14px;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .topbar nav {
    width: 100%;
    justify-content: flex-start;
  }

  .start-panel-actions {
    max-width: none;
  }
}

