/* ── tokens: light (default) ───────────────────────────────── */
:root {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --panel: rgba(255, 255, 255, 0.98);
  --panel-edge: rgba(0, 0, 0, 0.1);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --link: #0071e3;
  --shadow: 0 26px 78px rgba(0, 0, 0, 0.12);

  --input-border: rgba(0, 0, 0, 0.2);
  --input-bg: rgba(0, 0, 0, 0.03);
  --hr-color: rgba(0, 0, 0, 0.12);
  --footer-border: rgba(0, 0, 0, 0.08);
  --card-border: rgba(0, 0, 0, 0.08);
  --card-bg: rgba(0, 0, 0, 0.02);
  --card-text: #6e6e73;
  --icon-color: #6e6e73;
  --btn-secondary-bg: rgba(0, 0, 0, 0.05);
  --btn-secondary-border: rgba(0, 0, 0, 0.15);
  --dots-color: rgba(0, 0, 0, 0.5);
  --focus-border: #0071e3;
}

/* ── tokens: dark ──────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1d1f;
    --bg-elevated: #232326;
    --panel: rgba(31, 31, 34, 0.98);
    --panel-edge: rgba(255, 255, 255, 0.035);
    --text: #f5f5f7;
    --muted: #acacb4;
    --link: #2997ff;
    --shadow: 0 26px 78px rgba(0, 0, 0, 0.5);

    --input-border: rgba(255, 255, 255, 0.22);
    --input-bg: rgba(255, 255, 255, 0.04);
    --hr-color: rgba(255, 255, 255, 0.14);
    --footer-border: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.05);
    --card-bg: rgba(255, 255, 255, 0.015);
    --card-text: #bdbdc5;
    --icon-color: #83838b;
    --btn-secondary-bg: rgba(255, 255, 255, 0.06);
    --btn-secondary-border: rgba(255, 255, 255, 0.14);
    --dots-color: rgba(255, 255, 255, 0.88);
    --focus-border: #5cb3ff;
  }
}

*,
[hidden] {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  html {
    background:
      radial-gradient(circle at top, rgba(255, 255, 255, 0.02), transparent 24%),
      linear-gradient(180deg, #1d1d1f 0%, #1d1d1f 100%);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar,
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-apple {
  color: var(--text);
  flex-shrink: 0;
}

.brand-icloud {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffffff, #d7e1ff 48%, #9baefc);
  color: #101116;
  font-size: 0.92rem;
  font-weight: 800;
}

.brand-copy {
  display: grid;
}

.brand-copy strong {
  font-size: 1rem;
  letter-spacing: -0.04em;
}

.footer,
.support-copy {
  color: var(--muted);
}

.dots-button {
  border: 0;
  background: transparent;
  display: inline-flex;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
}

.dots-button span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--dots-color);
}

.stage {
  display: grid;
  place-items: center;
  padding: 12px 24px 28px;
}

.panel {
  width: min(642px, 100%);
  min-height: 758px;
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: 36px clamp(22px, 5vw, 54px) 40px;
}

.glow {
  position: absolute;
  inset: -26% 12% auto;
  height: 260px;
  background: radial-gradient(circle, rgba(98, 105, 255, 0.1), transparent 60%);
  filter: blur(36px);
  pointer-events: none;
}

.orbit {
  width: 200px;
  height: 200px;
  margin: 0 auto 30px;
  animation: drift 9s ease-in-out infinite;
}

.orbit-svg {
  width: 100%;
  height: 100%;
}

.copy {
  text-align: center;
}

.tk-intro {
  margin: 0;
  font-size: 21px;
  line-height: 1.381002381;
  font-weight: 400;
  letter-spacing: 0.011em;
  font-family: "SF Pro Display", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.lede {
  margin: 18px auto 0;
  max-width: 33ch;
  line-height: 1.58;
  color: var(--text);
  font-size: 0.99rem;
  font-weight: 400;
}

.code-form {
  margin-top: 22px;
}

.code-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}

.digit {
  display: inline-block;
  width: 40px;
  height: 40px;
}

.digit input {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  text-align: center;
  font-size: 1.08rem;
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.digit input:focus {
  border-color: var(--focus-border);
  background: rgba(41, 151, 255, 0.06);
  transform: translateY(-1px);
}

.links {
  margin-top: 28px;
  display: grid;
  gap: 7px;
  text-align: center;
}

.links a {
  color: var(--link);
  font-size: 0.95rem;
}

hr {
  margin: 38px 0 30px;
  border: 0;
  border-top: 1px solid var(--hr-color);
}

.support-copy {
  max-width: 39ch;
  margin: 0 auto;
  text-align: center;
  line-height: 1.55;
  font-size: 0.95rem;
}

.actions {
  margin-top: 38px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.action-card {
  min-height: 108px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 14px;
  text-align: center;
  color: var(--card-text);
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  font-size: 0.95rem;
}

.action-card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 141, 255, 0.36);
  background: rgba(124, 141, 255, 0.06);
}

.action-icon {
  font-size: 1.75rem;
  color: var(--icon-color);
}

.action-icon-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.action-icon-svg svg {
  width: 37px;
  height: auto;
  fill: currentColor;
}

.footer {
  border-top: 1px solid var(--footer-border);
  font-size: 0.76rem;
}

.footer nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.footer p {
  margin: 0;
  text-align: right;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


@keyframes drift {
  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-8px);
  }
}

/* ── login ─────────────────────────────────────────────────── */
.field-wrap {
  position: relative;
  margin-bottom: 10px;
}

.field-wrap label {
  position: absolute;
  top: 9px;
  left: 16px;
  font-size: 0.72rem;
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
}

.field-wrap input {
  width: 100%;
  padding: 26px 16px 8px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.field-wrap input:focus {
  border-color: var(--focus-border);
}

.create-account {
  display: block;
  margin-top: 10px;
  font-size: 0.93rem;
  color: var(--link);
  text-align: left;
}

.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  gap: 12px;
}

.keep-session {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.keep-session input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--link);
  cursor: pointer;
  flex-shrink: 0;
}

.forgot-link {
  font-size: 0.88rem;
  color: var(--link);
  white-space: nowrap;
}

.btn-group--full {
  display: block;
}

.btn-group--full .btn {
  width: 100%;
}

.pin-error {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: #ff3b30;
  text-align: left;
}

.privacy-block {
  margin-top: 26px;
  text-align: center;
}

.privacy-icon {
  display: block;
  width: 37px;
  height: 29px;
  margin: 10px auto 8px;
  flex-shrink: 0;
}

.privacy-text {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

.privacy-link {
  color: var(--link);
}

.btn-group {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.btn {
  padding: 13px 32px;
  border-radius: 12px;
  border: none;
  font-size: 0.93rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.18s ease;
}

.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: #0071e3;
  color: white;
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  border: 1px solid var(--btn-secondary-border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn-secondary-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.btn-secondary-wrap .btn {
  flex: unset;
  width: 100%;
}

.device-note {
  margin: 6px 0 0;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

/* ── quick-access ──────────────────────────────────────────── */
.quick-access {
  margin-inline: 15px;
  padding-block-start: 30px;
}

.quick-access-label {
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.55;
  text-align: center;
  max-width: 54ch;
  margin: 0 auto 24px;
}

.quick-access-buttons {
  display: flex;
  justify-content: center;
  gap: 48px;
}

.quick-access-button {
  display: contents;
}

ui-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 130px;
  padding: 14px 10px;
  text-align: center;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  position: relative;
  transition: opacity 0.18s ease;
}

ui-button:hover {
  opacity: 0.75;
}

ui-button > button {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

ui-button .title {
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.3;
}

.layout-box {
  fill: currentColor;
  color: var(--text);
  flex-shrink: 0;
}

.cloudos-menu-item-opens-in-new-tab {
  fill: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .topbar,
  .footer {
    padding-inline: 16px;
  }

  .panel {
    min-height: auto;
    border-radius: 26px;
    padding-inline: 18px;
  }

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

  .quick-access-buttons {
    gap: 24px;
  }

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