:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.12);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --focus: rgba(0, 113, 227, 0.24);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.08);
  --nav-height: 48px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% -18%, rgba(255, 255, 255, 0.94), transparent 42%),
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 58%, #eeeeef 100%);
  color: var(--text);
  letter-spacing: 0;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-height);
  padding: 0 max(22px, calc((100vw - 1080px) / 2));
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(251, 251, 253, 0.76);
  backdrop-filter: blur(18px) saturate(1.6);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
}

.brand-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14);
}

.nav-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.language-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding-left: 10px;
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 245, 247, 0.78));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 6px 18px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(14px) saturate(1.45);
}

.language-icon {
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 50%;
  background: #1d1d1f;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.language-picker select {
  min-height: 32px;
  width: auto;
  border: 0;
  border-radius: 0 999px 999px 0;
  padding: 0 28px 0 0;
  background-color: transparent;
  background-position:
    calc(100% - 15px) 14px,
    calc(100% - 10px) 14px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.language-picker select:focus {
  outline: none;
}

.language-picker:focus-within {
  border-color: var(--blue);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 0 0 4px var(--focus);
}

.app-shell {
  min-height: calc(100vh - var(--nav-height));
  padding: 58px 22px 104px;
}

.hero {
  width: min(100%, 1080px);
  margin: 0 auto;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(58px, 10vw, 118px);
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: 0;
}

.intro {
  max-width: 680px;
  margin: 20px auto 34px;
  color: var(--text);
  font-size: clamp(24px, 4vw, 42px);
  font-weight: 650;
  line-height: 1.1;
}

.intro span {
  display: inline;
}

.score-panel {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.55);
}

.score-form {
  display: grid;
  gap: 12px;
}

.access-label,
.field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-align: left;
}

.bind-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0;
}

input {
  padding: 0 15px;
}

select {
  appearance: none;
  padding: 0 38px 0 15px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 19px) 21px,
    calc(100% - 14px) 21px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

input::placeholder {
  color: #a1a1a6;
}

input:focus,
select:focus {
  border-color: var(--blue);
  outline: 4px solid var(--focus);
}

.field {
  display: grid;
  gap: 7px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 24px;
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
}

.primary-button {
  min-width: 104px;
  background: var(--blue);
  color: white;
  box-shadow: 0 8px 22px rgba(0, 113, 227, 0.24);
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-hover);
  box-shadow: 0 10px 26px rgba(0, 113, 227, 0.3);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 5px 16px rgba(0, 113, 227, 0.22);
}

.status-box {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  margin-top: 14px;
  padding: 0 13px;
  border-radius: 8px;
  background: rgba(245, 245, 247, 0.86);
  color: var(--muted);
  text-align: left;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.12);
}

#statusText {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.site-footer {
  width: min(100%, 1080px);
  margin: -58px auto 0;
  padding: 0 22px 28px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.site-footer p {
  margin: 3px 0;
}

.score-result {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 0;
}

.score-result img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.12);
}

.score-dialog {
  width: min(94vw, 1160px);
  max-width: 1160px;
  max-height: min(88vh, 940px);
  margin: auto;
  padding: 64px 14px 14px;
  border: 0;
  border-radius: 8px;
  background: rgba(245, 245, 247, 0.94);
  color: var(--text);
  overflow: auto;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.24);
  animation: dialog-in 180ms ease-out both;
}

.score-dialog:focus {
  outline: none;
}

.score-dialog::backdrop {
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(22px) saturate(1.35);
  animation: backdrop-in 180ms ease-out both;
}

.score-dialog.is-closing {
  animation: dialog-out 180ms ease-in both;
}

.score-dialog.is-closing::backdrop {
  animation: backdrop-out 180ms ease-in both;
}

.dialog-toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.dialog-button {
  display: inline-grid;
  width: 56px;
  min-width: 56px;
  min-height: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  padding: 0;
  font: inherit;
  font-size: 22px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  pointer-events: auto;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease,
    filter 140ms ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 10px 26px rgba(0, 0, 0, 0.14);
}

.dialog-button:focus,
.dialog-button:focus-visible {
  outline: none;
}

.dialog-button--close {
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  backdrop-filter: blur(18px) saturate(1.45);
}

.dialog-button--close:hover {
  background: rgba(255, 255, 255, 0.96);
}

.dialog-button--download {
  background: var(--blue);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 10px 26px rgba(0, 113, 227, 0.28);
}

.dialog-button--download:hover {
  background: var(--blue-hover);
}

.dialog-button:active {
  transform: scale(0.94);
  filter: brightness(0.96);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.12),
    0 4px 14px rgba(0, 0, 0, 0.12);
}

.dialog-button--download:active {
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.18),
    0 4px 14px rgba(0, 113, 227, 0.18);
}

.score-dialog .score-result img {
  max-height: none;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: scale(0.985) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes dialog-out {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }

  to {
    opacity: 0;
    transform: scale(0.985) translateY(8px);
  }
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes backdrop-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@media (max-width: 820px) {
  h1 {
    font-size: clamp(52px, 15vw, 84px);
  }

  .intro {
    font-size: clamp(24px, 6vw, 34px);
  }
}

@media (max-width: 700px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .site-nav {
    position: relative;
    top: auto;
    min-height: calc(var(--nav-height) + env(safe-area-inset-top));
    padding: 0 16px;
    padding-top: env(safe-area-inset-top);
  }

  .nav-note {
    display: none;
  }

  .language-picker select {
    max-width: 110px;
  }

  .app-shell {
    min-height: calc(100dvh - var(--nav-height) - env(safe-area-inset-top));
    max-height: calc(100dvh - var(--nav-height) - env(safe-area-inset-top));
    overflow: hidden;
    padding: 40px 16px 112px;
  }

  .site-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 6;
    width: auto;
    margin: 0;
    padding: 18px 18px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(245, 245, 247, 0), rgba(245, 245, 247, 0.96) 34%);
    backdrop-filter: blur(14px) saturate(1.35);
  }

  .intro {
    margin-bottom: 28px;
  }

  .intro span {
    display: block;
  }

  .score-panel {
    padding: 14px;
  }

  .bind-row {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }

  .score-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 28px);
    padding: 58px 10px 10px;
  }

  .dialog-toolbar {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .dialog-button {
    width: 52px;
    min-width: 52px;
    min-height: 36px;
    height: 36px;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding: 34px 12px 108px;
  }

  .score-panel {
    padding: 12px;
  }

  input,
  select,
  button {
    min-height: 46px;
    font-size: 15px;
  }

  #statusText {
    font-size: 13px;
  }
}
