/* Usetopia Account. Colors follow usetopia.com. */
:root {
  --bg: #050817;
  --bg-raised: #0b1129;
  --card: rgba(74, 96, 255, 0.075);
  --card-strong: rgba(92, 104, 255, 0.13);
  --border: rgba(120, 139, 255, 0.18);
  --border-strong: rgba(140, 158, 255, 0.34);
  --text: #f5f7ff;
  --muted: #a8b2d4;
  --accent: #2563eb;
  --accent-2: #7c3aed;
  --cyan: #25dcff;
  --ok: #34d399;
  --danger: #f87171;
  --radius: 18px;
  --radius-sm: 12px;
  --focus: 0 0 0 3px rgba(37, 220, 255, 0.55);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(ellipse 64% 42% at 14% -7%, rgba(25, 111, 255, 0.22), transparent 70%),
    radial-gradient(ellipse 54% 38% at 88% 7%, rgba(128, 45, 255, 0.18), transparent 72%),
    radial-gradient(ellipse 45% 35% at 50% 100%, rgba(48, 60, 200, 0.09), transparent 74%);
}
a { color: #8fe5ff; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: clamp(26px, 4vw, 34px); letter-spacing: -0.6px; }
h2 { font-size: 18px; }
h3 { font-size: 14px; color: var(--muted); margin-top: 8px; }
p { margin: 0; }
.icon { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; align-self: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 30; padding: 8px 14px; border-radius: 999px; background: var(--accent); color: #fff; }
.skip:focus { top: 12px; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.noscript { padding: 40px; text-align: center; }

/* Layout */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.wrap, .wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.danger-zone { border-color: rgba(248, 113, 113, 0.32); background: rgba(248, 113, 113, 0.05); }
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.08); }
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

/* Controls */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 18px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, transform .12s, border-color .15s;
}
.button:hover:not(:disabled) { background: var(--card-strong); transform: translateY(-1px); }
.button.primary { border: 0; color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 24px rgba(72, 84, 255, 0.24); }
.button.primary:hover:not(:disabled) { background: linear-gradient(120deg, #2f6ee5, #8a4dff); }
.button.ghost { background: transparent; }
.button.danger { border-color: rgba(248, 113, 113, 0.55); background: rgba(248, 113, 113, 0.14); color: #fecaca; }
.button:disabled, .icon-button:disabled, .switch:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.icon-button {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-button:hover:not(:disabled) { color: var(--text); background: var(--card-strong); }
.icon-button[aria-pressed="true"] { color: #ff8fb3; }
.icon-button.watch[aria-pressed="true"] { color: var(--cyan); }
.link { background: none; border: 0; padding: 0; color: #8fe5ff; font: inherit; cursor: pointer; text-align: start; }
.link:hover { text-decoration: underline; }
.link:disabled { opacity: .5; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: rgba(5, 8, 23, 0.6); color: var(--text); font: inherit;
}
.input:focus { border-color: var(--cyan); box-shadow: var(--focus); outline: none; }
select.input { appearance: none; padding-inline-end: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
[dir="rtl"] select.input { background-position: 20px 55%, 15px 55%; }
input[type="color"].input { padding: 4px; height: 44px; cursor: pointer; }
.password { position: relative; }
.password .input { padding-inline-end: 48px; }
.password .reveal { position: absolute; inset-inline-end: 4px; top: 2px; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 999px; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--danger); }
.switch {
  position: relative; width: 52px; height: 30px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: rgba(168, 178, 212, 0.18); cursor: pointer; padding: 0; flex: none;
}
.switch .knob { position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #dfe5ff; transition: inset-inline-start .15s; }
.switch[aria-checked="true"] { background: linear-gradient(120deg, var(--accent), var(--accent-2)); border-color: transparent; }
.switch[aria-checked="true"] .knob { inset-inline-start: 25px; }
.picker { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.picker .input { width: auto; min-width: 160px; }
.language { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.language .input { width: auto; min-height: 36px; padding-block: 6px; }

/* Sign-in */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 18px; }
.auth-card {
  width: 100%; max-width: 440px; padding: 30px; border-radius: 24px; border: 1px solid var(--border);
  background: rgba(10, 16, 38, 0.72); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  display: flex; flex-direction: column; gap: 22px; box-shadow: 0 30px 80px rgba(8, 12, 40, 0.6);
}
.auth-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auth-logo { border-radius: 18px; box-shadow: 0 14px 40px rgba(30, 112, 255, 0.3), 0 6px 26px rgba(132, 57, 255, 0.22); }
.auth-head h1 { background: linear-gradient(100deg, #f5f7ff 20%, #72dcff 52%, #a57aff 82%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-foot { display: flex; gap: 18px; align-items: center; font-size: 13px; }
.auth-foot a { color: var(--muted); }

/* Shell */
.shell { max-width: 1180px; margin: 0 auto; padding: 0 20px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 0; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 17px; }
.brand img { border-radius: 9px; }
.brand span { background: linear-gradient(100deg, var(--cyan), #6f8cff 48%, var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who { color: var(--muted); font-size: 13px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs {
  position: sticky; top: 0; z-index: 10; display: flex; gap: 4px; padding: 6px; overflow-x: auto; scrollbar-width: none;
  background: rgba(5, 8, 23, 0.78); border: 1px solid var(--border); border-radius: 999px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--text); background: var(--card); }
.tab[aria-current="page"] { color: #fff; background: linear-gradient(120deg, rgba(37, 99, 235, .9), rgba(124, 58, 237, .9)); }
.progress { height: 3px; margin-top: 8px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: slide 1s linear infinite; }
@keyframes slide { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.content { padding-top: 26px; outline: none; }
.content:focus { box-shadow: none; }
.footer { margin-top: 48px; text-align: center; font-size: 13px; }
.footer a { color: var(--muted); }
.hero { display: flex; flex-direction: column; gap: 6px; }
.hero.row { flex-direction: row; }
.loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 80px 0; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--cyan); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Overview */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: var(--radius); text-decoration: none;
  border: 1px solid var(--border); background: var(--card); color: var(--text); transition: background .15s, transform .12s;
}
.stat:hover { background: var(--card-strong); transform: translateY(-1px); }
.stat .icon { color: var(--cyan); }
.stat strong { font-size: 28px; letter-spacing: -0.5px; }
.stat span { color: var(--muted); font-size: 13px; }
.meter { height: 10px; border-radius: 999px; background: rgba(168, 178, 212, 0.16); overflow: hidden; }
.meter-fill { height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--accent-2)); }

/* Profiles */
.profiles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.profile { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 8px; border-radius: var(--radius-sm); border: 1px solid transparent; flex-wrap: wrap; }
.profile.selected { border-color: var(--border-strong); background: var(--card-strong); }
.profile-pick { display: flex; align-items: center; gap: 12px; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-align: start; padding: 4px; border-radius: 10px; flex: 1; min-width: 0; }
.profile-text { display: flex; flex-direction: column; min-width: 0; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: none; }
form.inline { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.profile form.inline { flex-basis: 100%; padding: 4px; }
form.inline .field { flex: 1; min-width: 180px; }

/* Library */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.chip[aria-selected="true"] { color: var(--text); border-color: var(--border-strong); background: var(--card-strong); }
.chip .count { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: rgba(168, 178, 212, 0.16); }
.search { max-width: 420px; }
.titles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.title-card { display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); }
.poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; background: var(--bg-raised); display: block; }
.poster.placeholder { display: grid; place-items: center; font-size: 36px; font-weight: 700; color: var(--muted); background: linear-gradient(160deg, rgba(37, 99, 235, .25), rgba(124, 58, 237, .25)); }
.title-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.title-actions { gap: 2px; margin-top: auto; }
.collection { display: flex; flex-direction: column; gap: 12px; }
.progress-list, .devices, .addons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.progress-row, .device { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); }
.progress-row .poster { width: 56px; flex: none; border-radius: 8px; }
.progress-row .poster.placeholder { font-size: 20px; }
.bar { height: 6px; border-radius: 999px; background: rgba(168, 178, 212, 0.16); overflow: hidden; max-width: 320px; }
.bar div { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--accent-2)); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 16px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; }

/* Add-ons and devices */
.addon { display: flex; gap: 16px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); }
.addon.available { background: transparent; border-style: dashed; }
.addon-mark, .device-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; font-weight: 800; font-size: 20px; flex: none; background: linear-gradient(135deg, rgba(37, 220, 255, .22), rgba(124, 58, 237, .32)); color: #dff8ff; }
.addon-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; flex: 1; }

/* Banners and recovery keys */
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--card-strong); }
.banner .icon { color: var(--cyan); }
.link-banner { color: var(--text); text-decoration: none; }
.link-banner:hover { border-color: var(--cyan); }
.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.5px; }
.recovery-key { display: block; margin-top: 14px; padding: 14px; border-radius: var(--radius-sm); border: 1px dashed var(--cyan); background: rgba(5, 8, 23, 0.6);
  font: 600 15px/1.6 "SF Mono", ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; word-break: break-all; user-select: all; }

/* Notices and dialogs */
.notices { position: fixed; inset-block-end: 18px; inset-inline-end: 18px; z-index: 40; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 36px)); }
.notice { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: rgba(11, 17, 41, 0.95); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.notice span { flex: 1; }
.notice.success .icon:first-child { color: var(--ok); }
.notice.error { border-color: rgba(248, 113, 113, 0.55); }
.notice.error .icon:first-child { color: var(--danger); }
.dialog { max-width: 440px; width: calc(100vw - 32px); padding: 24px; border-radius: 20px; border: 1px solid var(--border-strong); background: #0b1129; color: var(--text); }
.dialog::backdrop { background: rgba(2, 4, 12, 0.7); backdrop-filter: blur(4px); }
.dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .shell { padding: 0 14px 32px; }
  .who { display: none; }
  .card { padding: 18px; }
  .titles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .auth-card { padding: 24px 20px; }
  .tab { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
