:root {
  --background: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.72);

  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #9a9a9f;

  --border: rgba(0, 0, 0, 0.07);

  --accent: #ff3b30;

  --shadow:
    0 1px 2px rgba(0, 0, 0, 0.03),
    0 16px 50px rgba(0, 0, 0, 0.07);

  --radius-large: 32px;
  --radius-medium: 20px;
}

/* RESET */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;

  font-family:
    "DM Sans",
    "Noto Sans SC",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color: var(--text);
  background: var(--background);

  overflow-x: hidden;
}

body.history-open {
  overflow: hidden;
}

button,
a {
  font: inherit;
}

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

/* BACKGROUND */

.noise {
  position: fixed;
  inset: 0;

  z-index: 10;

  pointer-events: none;

  opacity: 0.025;

  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='.7'/%3E%3C/svg%3E");
}

/* PAGE */

.page {
  position: relative;
  z-index: 2;

  width: min(100% - 40px, 720px);
  min-height: 100vh;

  margin: 0 auto;

  display: flex;
  flex-direction: column;

  padding:
    max(48px, env(safe-area-inset-top))
    0
    max(28px, env(safe-area-inset-bottom));
}

/* HERO */

.hero {
  padding-top: clamp(30px, 8vh, 90px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;

  gap: 9px;

  margin-bottom: 26px;

  color: var(--text-secondary);

  font-size: 12px;
  font-weight: 600;

  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;

  border-radius: 50%;

  background: var(--accent);

  box-shadow:
    0 0 0 5px
    rgba(255, 59, 48, 0.09);
}

.hero-title {
  max-width: 650px;

  font-size:
    clamp(52px, 11vw, 92px);

  font-weight: 600;

  line-height: 0.93;
  letter-spacing: -0.065em;
}

.kinetic-word {
  display: inline-flex;

  color: var(--accent);

  font-family:
    "Noto Sans SC",
    sans-serif;

  letter-spacing: -0.08em;
}

.kinetic-word span {
  display: inline-block;

  animation:
    kineticFloat
    4s
    cubic-bezier(0.4, 0, 0.2, 1)
    infinite;
}

.kinetic-word span:nth-child(2) {
  animation-delay: 0.18s;
}

.kinetic-word span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes kineticFloat {
  0%,
  100% {
    transform:
      translateY(0)
      rotate(0deg);
  }

  45% {
    transform:
      translateY(-7px)
      rotate(-2deg);
  }

  65% {
    transform:
      translateY(2px)
      rotate(1deg);
  }
}

.hero-description {
  margin-top: 28px;

  color: var(--text-secondary);

  font-size:
    clamp(16px, 3vw, 19px);

  line-height: 1.55;
  letter-spacing: -0.02em;
}

/* ACCOUNT */

.account-section {
  margin-top:
    clamp(55px, 10vh, 100px);
}

.account-card {
  position: relative;

  padding:
    clamp(24px, 5vw, 38px);

  border:
    1px solid var(--border);

  border-radius:
    var(--radius-large);

  background:
    var(--surface);

  box-shadow:
    var(--shadow);

  backdrop-filter:
    blur(24px);

  -webkit-backdrop-filter:
    blur(24px);

  overflow: hidden;

  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.account-card::before {
  content: "";

  position: absolute;

  width: 180px;
  height: 180px;

  top: -100px;
  right: -80px;

  border-radius: 50%;

  background:
    radial-gradient(
      circle,
      rgba(255, 59, 48, 0.12),
      transparent 68%
    );

  pointer-events: none;
}

.account-card.switching {
  transform:
    scale(0.985)
    translateY(5px);

  opacity: 0.4;
}

/* CARD TOP */

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  margin-bottom: 42px;
}

.card-label {
  color: var(--text-tertiary);

  font-size: 10px;
  font-weight: 700;

  letter-spacing: 0.14em;
}

.random-mark {
  padding: 6px 10px;

  border:
    1px solid
    rgba(255, 59, 48, 0.12);

  border-radius: 100px;

  color: var(--accent);

  background:
    rgba(255, 59, 48, 0.06);

  font-family:
    "Noto Sans SC",
    sans-serif;

  font-size: 11px;
  font-weight: 600;
}

/* IDENTITY */

.identity {
  display: flex;
  flex-direction: column;
}

.identity-block {
  min-width: 0;
}

.field-label {
  display: block;

  margin-bottom: 12px;

  color: var(--text-tertiary);

  font-size: 11px;
  font-weight: 600;

  letter-spacing: 0.08em;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  min-width: 0;
}

.field-value {
  min-width: 0;

  overflow: hidden;
  text-overflow: ellipsis;

  color: var(--text);

  white-space: nowrap;
}

.nick-value {
  font-family:
    "Noto Sans SC",
    "DM Sans",
    sans-serif;

  font-size:
    clamp(30px, 8vw, 48px);

  font-weight: 600;

  letter-spacing: -0.04em;
}

.number-value {
  font-size:
    clamp(21px, 5vw, 30px);

  font-weight: 500;

  letter-spacing: -0.035em;

  font-variant-numeric:
    tabular-nums;
}

.divider {
  width: 100%;
  height: 1px;

  margin: 30px 0;

  background: var(--border);
}

/* COPY */

.copy-button {
  flex: 0 0 auto;

  width: 44px;
  height: 44px;

  display: grid;
  place-items: center;

  border:
    1px solid var(--border);

  border-radius: 50%;

  color: var(--text-secondary);

  background:
    rgba(255, 255, 255, 0.65);

  cursor: pointer;

  transition:
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.copy-button svg {
  width: 18px;
  height: 18px;

  fill: none;

  stroke: currentColor;
  stroke-width: 1.7;

  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-button:hover {
  color: var(--text);
  background: #ffffff;

  transform:
    translateY(-2px);
}

.copy-button:active {
  transform: scale(0.92);
}

/* ACTIONS */

.actions {
  display: grid;

  grid-template-columns:
    auto 1fr;

  gap: 10px;

  margin-top: 38px;
}

.back-button,
.refresh-button {
  min-height: 56px;

  border: 0;

  border-radius:
    var(--radius-medium);

  display: flex;
  align-items: center;
  justify-content: center;

  gap: 9px;

  font-size: 15px;
  font-weight: 600;

  cursor: pointer;

  transition:
    transform 0.2s ease,
    background 0.2s ease,
    opacity 0.2s ease;
}

.back-button {
  padding: 0 20px;

  border:
    1px solid var(--border);

  color: var(--text);

  background:
    rgba(255, 255, 255, 0.65);
}

.refresh-button {
  padding: 0 22px;

  color: #ffffff;
  background: var(--text);
}

.back-button svg,
.refresh-button svg {
  width: 18px;
  height: 18px;

  fill: none;

  stroke: currentColor;
  stroke-width: 1.8;

  stroke-linecap: round;
  stroke-linejoin: round;
}

.refresh-button svg {
  transition:
    transform 0.6s
    cubic-bezier(0.4, 0, 0.2, 1);
}

.refresh-button:hover:not(:disabled) {
  background: #000000;
}

.refresh-button:hover:not(:disabled) svg {
  transform: rotate(180deg);
}

.back-button:hover:not(:disabled) {
  background: #ffffff;
}

.back-button:active:not(:disabled),
.refresh-button:active:not(:disabled) {
  transform: scale(0.97);
}

.back-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

/* REFRESH LOADING & COOLDOWN */

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.refresh-button.loading svg {
  animation: spin 0.8s linear infinite !important;
}

.refresh-button.cooldown {
  background: var(--text-secondary) !important;
  cursor: not-allowed !important;
  opacity: 0.8 !important;
  transform: none !important;
}

.refresh-button.cooldown:hover {
  background: var(--text-secondary) !important;
}

.refresh-button.cooldown:active {
  transform: none !important;
}

/* HISTORY BUTTON */

.history-button {
  width: 100%;
  min-height: 54px;

  margin-top: 10px;
  padding: 0 18px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  border:
    1px solid var(--border);

  border-radius: var(--radius-medium);

  color: var(--text-secondary);

  background:
    rgba(255, 255, 255, 0.48);

  cursor: pointer;

  transition:
    color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.history-button-left {
  display: flex;
  align-items: center;

  gap: 10px;

  font-size: 13px;
  font-weight: 600;
}

.history-button svg {
  width: 18px;
  height: 18px;

  fill: none;

  stroke: currentColor;
  stroke-width: 1.7;

  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-arrow {
  width: 16px !important;
  height: 16px !important;

  transition:
    transform 0.2s ease;
}

.history-button:hover {
  color: var(--text);
  background: #ffffff;
}

.history-button:hover
.history-arrow {
  transform:
    translateX(3px);
}

.history-button:active {
  transform: scale(0.985);
}

/* DOODLES */

.doodle {
  position: fixed;

  z-index: 0;

  pointer-events: none;
}

.doodle-circle {
  width: 210px;
  height: 210px;

  top: 9%;
  right: -110px;

  border:
    2px solid
    rgba(255, 59, 48, 0.16);

  border-radius:
    46% 54% 57% 43% /
    45% 45% 55% 55%;

  transform: rotate(18deg);

  animation:
    doodleRotate
    22s
    linear
    infinite;
}

.doodle-line {
  width: 160px;
  height: 70px;

  left: -70px;
  bottom: 18%;

  border-top:
    2px solid
    rgba(29, 29, 31, 0.1);

  border-radius: 50%;

  transform: rotate(-18deg);
}

.doodle-star {
  top: 22%;
  left: 7%;

  color:
    rgba(255, 59, 48, 0.24);

  font-size: 32px;

  animation:
    starFloat
    5s
    ease-in-out
    infinite;
}

@keyframes doodleRotate {
  to {
    transform: rotate(378deg);
  }
}

@keyframes starFloat {
  0%,
  100% {
    transform:
      translateY(0)
      rotate(0);
  }

  50% {
    transform:
      translateY(-10px)
      rotate(15deg);
  }
}

/* HISTORY OVERLAY */

.history-overlay {
  position: fixed;
  inset: 0;

  z-index: 50;

  background:
    rgba(0, 0, 0, 0.24);

  backdrop-filter:
    blur(5px);

  -webkit-backdrop-filter:
    blur(5px);

  opacity: 0;
  visibility: hidden;

  transition:
    opacity 0.35s ease,
    visibility 0.35s;
}

.history-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* HISTORY SHEET */

.history-sheet {
  position: fixed;

  left: 50%;
  bottom: 0;

  z-index: 60;

  width:
    min(100%, 720px);

  max-height:
    min(82vh, 760px);

  display: flex;
  flex-direction: column;

  padding:
    12px
    20px
    max(
      24px,
      env(safe-area-inset-bottom)
    );

  border:
    1px solid
    rgba(0, 0, 0, 0.07);

  border-bottom: 0;

  border-radius:
    32px 32px 0 0;

  background:
    rgba(250, 250, 252, 0.96);

  box-shadow:
    0 -20px 80px
    rgba(0, 0, 0, 0.16);

  backdrop-filter:
    blur(30px);

  -webkit-backdrop-filter:
    blur(30px);

  transform:
    translate(-50%, 105%);

  visibility: hidden;

  transition:
    transform
    0.42s
    cubic-bezier(
      0.32,
      0.72,
      0,
      1
    ),
    visibility 0.42s;
}

.history-sheet.open {
  transform:
    translate(-50%, 0);

  visibility: visible;
}

.sheet-handle {
  width: 38px;
  height: 5px;

  margin:
    0 auto
    20px;

  border-radius: 100px;

  background:
    rgba(0, 0, 0, 0.13);
}

.history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 20px;

  padding:
    0 4px
    22px;
}

.history-eyebrow {
  display: block;

  margin-bottom: 8px;

  color: var(--accent);

  font-size: 9px;
  font-weight: 700;

  letter-spacing: 0.14em;
}

.history-header h2 {
  font-size:
    clamp(27px, 7vw, 38px);

  font-weight: 600;

  letter-spacing: -0.045em;
}

.history-header p {
  margin-top: 7px;

  color: var(--text-secondary);

  font-size: 13px;
}

.close-history {
  width: 40px;
  height: 40px;

  flex: 0 0 auto;

  display: grid;
  place-items: center;

  border: 0;

  border-radius: 50%;

  color: var(--text-secondary);

  background:
    rgba(0, 0, 0, 0.055);

  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.close-history svg {
  width: 18px;
  height: 18px;

  fill: none;

  stroke: currentColor;
  stroke-width: 1.8;

  stroke-linecap: round;
}

.close-history:hover {
  background:
    rgba(0, 0, 0, 0.09);
}

.close-history:active {
  transform: scale(0.92);
}

/* HISTORY LIST */

.history-list {
  min-height: 160px;

  overflow-y: auto;

  padding:
    2px 4px
    10px;

  overscroll-behavior:
    contain;

  scrollbar-width: thin;
}

.history-item {
  padding: 18px;

  border:
    1px solid var(--border);

  border-radius: 20px;

  background:
    rgba(255, 255, 255, 0.72);

  box-shadow:
    0 5px 18px
    rgba(0, 0, 0, 0.025);
}

.history-item +
.history-item {
  margin-top: 10px;
}

.history-item-top,
.history-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 14px;
}

.history-item-bottom {
  margin-top: 10px;
  padding-top: 10px;

  border-top:
    1px solid var(--border);
}

.history-nick {
  min-width: 0;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-family:
    "Noto Sans SC",
    "DM Sans",
    sans-serif;

  font-size: 19px;
  font-weight: 600;
}

.history-number {
  min-width: 0;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: var(--text-secondary);

  font-size: 13px;
  font-weight: 500;

  font-variant-numeric:
    tabular-nums;
}

.history-copy {
  width: 34px;
  height: 34px;

  flex: 0 0 auto;

  display: grid;
  place-items: center;

  border:
    1px solid var(--border);

  border-radius: 50%;

  color: var(--text-secondary);

  background:
    rgba(255, 255, 255, 0.7);

  cursor: pointer;

  transition:
    color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.history-copy svg {
  width: 15px;
  height: 15px;

  fill: none;

  stroke: currentColor;
  stroke-width: 1.7;

  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-copy:hover {
  color: var(--text);
  background: #ffffff;
}

.history-copy:active {
  transform: scale(0.9);
}

/* EMPTY HISTORY */

.empty-history {
  min-height: 190px;

  display: flex;
  align-items: center;
  justify-content: center;

  flex-direction: column;

  text-align: center;

  color: var(--text-secondary);
}

.empty-history-icon {
  width: 52px;
  height: 52px;

  margin-bottom: 14px;

  display: grid;
  place-items: center;

  border-radius: 18px;

  color: var(--accent);

  background:
    rgba(255, 59, 48, 0.07);
}

.empty-history-icon svg {
  width: 23px;
  height: 23px;

  fill: none;

  stroke: currentColor;
  stroke-width: 1.6;

  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-history strong {
  color: var(--text);

  font-size: 15px;
  font-weight: 600;
}

.empty-history p {
  max-width: 240px;

  margin-top: 5px;

  font-size: 12px;
  line-height: 1.5;
}

/* TOAST */

.toast {
  position: fixed;

  left: 50%;

  bottom:
    max(
      24px,
      calc(
        env(safe-area-inset-bottom)
        + 16px
      )
    );

  z-index: 100;

  display: flex;
  align-items: center;

  gap: 10px;

  padding:
    11px 16px 11px 11px;

  border:
    1px solid
    rgba(255, 255, 255, 0.12);

  border-radius: 100px;

  color: #ffffff;

  background:
    rgba(29, 29, 31, 0.92);

  box-shadow:
    0 12px 35px
    rgba(0, 0, 0, 0.2);

  backdrop-filter:
    blur(16px);

  -webkit-backdrop-filter:
    blur(16px);

  font-size: 13px;
  font-weight: 500;

  opacity: 0;

  transform:
    translateX(-50%)
    translateY(20px)
    scale(0.95);

  visibility: hidden;

  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0.3s;
}

.toast.show {
  opacity: 1;

  transform:
    translateX(-50%)
    translateY(0)
    scale(1);

  visibility: visible;
}

.toast-icon {
  width: 24px;
  height: 24px;

  display: grid;
  place-items: center;

  border-radius: 50%;

  color: #ffffff;
  background: var(--accent);

  font-size: 12px;
}

/* FOOTER */

.footer {
  margin-top: 90px;

  padding-top: 28px;

  border-top:
    1px solid var(--border);
}

.footer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 24px;
}

.footer-brand {
  display: flex;
  align-items: center;

  gap: 12px;
}

.footer-brand-mark {
  width: 42px;
  height: 42px;

  flex: 0 0 auto;

  display: grid;
  place-items: center;

  border:
    1px solid
    rgba(255, 59, 48, 0.1);

  border-radius: 14px;

  color: var(--accent);

  background:
    rgba(255, 59, 48, 0.06);

  font-family:
    "Noto Sans SC",
    sans-serif;

  font-size: 18px;
  font-weight: 600;
}

.footer-brand-name {
  color: var(--text);

  font-size: 14px;
  font-weight: 600;
}

.footer-brand-description {
  margin-top: 2px;

  color: var(--text-tertiary);

  font-size: 11px;
}

.footer-links {
  display: flex;
  align-items: center;

  gap: 8px;
}

.footer-link {
  width: 42px;
  height: 42px;

  display: grid;
  place-items: center;

  border:
    1px solid var(--border);

  border-radius: 50%;

  color: var(--text-secondary);

  background:
    rgba(255, 255, 255, 0.55);

  text-decoration: none;

  transition:
    color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.footer-link svg {
  width: 18px;
  height: 18px;
}

.github-link svg {
  fill: currentColor;
}

.email-link svg {
  fill: none;

  stroke: currentColor;
  stroke-width: 1.7;

  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer-link:hover {
  color: var(--text);
  background: #ffffff;

  transform:
    translateY(-2px);
}

.footer-link:active {
  transform: scale(0.94);
}

.footer-bottom {
  margin-top: 24px;
  padding-top: 18px;

  border-top:
    1px solid var(--border);

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  color: var(--text-tertiary);

  font-size: 11px;
}

.footer-credit a {
  color: var(--text-secondary);

  font-weight: 600;

  text-decoration: none;

  transition:
    color 0.2s ease;
}

.footer-credit a:hover {
  color: var(--accent);
}

/* ERROR */

.account-card.error
.nick-value {
  color: var(--accent);

  font-family:
    "DM Sans",
    sans-serif;

  font-size:
    clamp(26px, 7vw, 42px);
}

.account-card.error
.number-value {
  color: var(--text-secondary);

  font-size: 16px;
}

/* MOBILE */

@media (max-width: 430px) {
  .actions {
    grid-template-columns:
      56px 1fr;
  }

  .back-button {
    width: 56px;
    padding: 0;
  }

  .back-button span {
    display: none;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;

    gap: 6px;
  }

  .history-sheet {
    max-height: 86vh;

    border-radius:
      28px 28px 0 0;
  }
}

/* DESKTOP */

@media (min-width: 768px) {
  .page {
    width:
      min(100% - 80px, 760px);
  }

  .doodle-star {
    left: 12%;
  }
}

/* REDUCED MOTION */

@media (
  prefers-reduced-motion: reduce
) {
  *,
  *::before,
  *::after {
    animation-duration:
      0.01ms !important;

    animation-iteration-count:
      1 !important;

    transition-duration:
      0.01ms !important;
  }
}