:root {
  --bg: #eef1f4;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --pill: rgba(255, 255, 255, 0.7);
  --border: rgba(15, 23, 42, 0.06);
  --ring: rgba(59, 130, 246, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220;
    --card: #111b2e;
    --text: #e5e7eb;
    --muted: #a1a8b3;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    --pill: rgba(17, 27, 46, 0.75);
    --border: rgba(148, 163, 184, 0.14);
    --ring: rgba(96, 165, 250, 0.45);
  }
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --card: #111b2e;
  --text: #e5e7eb;
  --muted: #a1a8b3;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --pill: rgba(17, 27, 46, 0.75);
  --border: rgba(148, 163, 184, 0.14);
  --ring: rgba(96, 165, 250, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
}

.page {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 28px 18px 40px;
  position: relative;
}

.theme-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--border);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme-btn:active {
  transform: scale(0.98);
}

.theme-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.theme-btn__icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
}

:root .theme-btn__icon--sun {
  display: none;
}

/* Explicit overrides */
:root[data-theme="dark"] .theme-btn__icon--sun {
  display: block;
}
:root[data-theme="dark"] .theme-btn__icon--moon {
  display: none;
}
:root[data-theme="light"] .theme-btn__icon--sun {
  display: none;
}
:root[data-theme="light"] .theme-btn__icon--moon {
  display: block;
}

/* Follow system when no explicit theme is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn__icon--sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-btn__icon--moon {
    display: none;
  }
}

.share-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--border);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.share-btn:active {
  transform: scale(0.98);
}

.share-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.share-btn__icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  opacity: 0.9;
}

.toast {
  position: fixed;
  bottom: 10vh;
  left: 50%;
  right: auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translate(-50%, 6px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast--left {
  left: 50%;
  right: auto;
}

.toast--right {
  left: 50%;
  right: auto;
}

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

.hero {
  text-align: center;
  padding-top: 6px;
}

.logo-wrap {
  width: 110px;
  height: 110px;
  margin: 0 auto 14px;
  background: var(--card);
  border-radius: 999px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.logo {
  width: 86px;
  height: 86px;
  object-fit: contain;
  border-radius: 999px;
}

.handle {
  margin: 0;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.welcome {
  margin: 10px auto 14px;
  max-width: 25ch;
  font-size: 16px;
  line-height: 1.45;
  color: var(--muted);
  font-weight: 500;
}

.flag {
  display: inline-block;
  transform: translateY(1px);
}

.social {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 12px 0 18px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px auto 18px;
  padding: 6px;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--border);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}

.segmented-btn {
  height: 40px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.segmented-btn[aria-selected="true"] {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
}

.segmented-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.social-btn {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
  -webkit-tap-highlight-color: transparent;
}

.social-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  opacity: 0.9;
}

.social-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
}

.social-btn:active {
  transform: scale(0.98);
}

.cards {
  display: grid;
  gap: 14px;
  margin-top: 6px;
}

.cards[hidden] {
  display: none !important;
}

.bottom-tip {
  margin: 14px 6px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.card-row {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}

.card-row:active {
  transform: scale(0.995);
}

.card-link {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.card-link:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: calc(var(--radius) - 6px);
}

.card-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
}

.card-logo--text {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  user-select: none;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.copy-link-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--border);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.copy-link-btn:active {
  transform: scale(0.98);
}

.copy-link-btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.kebab {
  text-align: right;
  color: rgba(15, 23, 42, 0.45);
  font-size: 20px;
  line-height: 1;
  user-select: none;
}

@media (max-width: 360px) {
  .handle {
    font-size: 30px;
  }
  .welcome {
    font-size: 15px;
  }
}
