@font-face {
  font-family: Inter;
  src: url('/assets/inter-regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: dark;
  font-family: Inter, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #dfdfe2;
  background: #0b0b0c;
  --accent: #ff009d;
  --muted: #929296;
  --line: #262628;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .5; }
button, a { color: inherit; }
a { text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 1px solid var(--accent); outline-offset: 5px; }
[hidden] { display: none !important; }
::selection { color: #fff; background: #a40066; }

main {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 48px 28px 96px;
  outline: none;
}
.view { width: 100%; }
.brand { display: block; position: relative; padding: 0; margin: 0; }
.brand img { display: block; width: 100%; height: auto; opacity: 0; }
.brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  -webkit-mask: url('/assets/wordmark.png') center / contain no-repeat;
  mask: url('/assets/wordmark.png') center / contain no-repeat;
  pointer-events: none;
}
.brand:focus { outline: none; }
a.brand:focus-visible { outline: 1px solid var(--accent); outline-offset: 12px; }
.home-view { width: 272px; max-width: 100%; }
.home-brand { width: 100%; }
.home-links { display: flex; align-items: center; justify-content: center; gap: 34px; margin-top: 26px; }
.text-control {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 400;
  line-height: 1.5;
  transition: color 140ms ease;
}
.text-control:hover { color: #eaeaec; }
.text-control.accent { color: var(--accent); }
.text-control.accent:hover { color: #ff7ccb; }

.form-view { max-width: 320px; }
.form-brand { width: 220px; max-width: 85%; margin: 0 auto 46px; }
.input-line { display: flex; align-items: center; border-bottom: 1px solid #424246; transition: border-color 140ms ease; }
.input-line:focus-within { border-color: var(--accent); }
input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 14px 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: #eaeaec;
  font-size: 1rem;
  line-height: 1.4;
  box-shadow: none;
}
input::placeholder { color: #929296; font-size: .875rem; opacity: 1; }
#access-key { font-family: Consolas, 'Courier New', monospace; font-size: .8125rem; }
#access-key::placeholder { font-size: .75rem; letter-spacing: -.035em; }
input:-webkit-autofill { -webkit-text-fill-color: #eaeaec; -webkit-box-shadow: 0 0 0 100px #0b0b0c inset; }
.input-line:has([aria-invalid=true]) { border-color: #ff65b8; }
.reveal-control { background: none; border: 0; color: var(--muted); padding: 12px 0 12px 16px; min-height: 44px; font-size: .75rem; }
.reveal-control:hover { color: #dfdfe2; }
.form-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 17px; }
.field-error { color: #ff87c9; font-size: .8125rem; line-height: 1.6; margin: 13px 0 0; }
.field-error:empty { display: none; }

.dashboard-view { max-width: 440px; }
.account-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 32px; }
.account-brand { width: 178px; max-width: 60%; }
.account-details { margin: 0; }
.detail-row { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--line); line-height: 1.5; font-size: .875rem; }
.detail-row dt { color: var(--muted); flex-shrink: 0; }
.detail-row dd { margin: 0; min-width: 0; text-align: right; overflow-wrap: anywhere; }
.detail-row:last-child { border-bottom: none; }
.uuid-control { border: 0; padding: 0; background: transparent; text-align: inherit; line-height: inherit; }
.uuid-control { font-family: Consolas, 'Courier New', monospace; font-size: .8125rem; letter-spacing: -.04em; overflow-wrap: anywhere; }
.uuid-control:hover { color: #fff; }
.hardware-status { color: var(--muted); }
.hardware-status.bound { color: var(--accent); }
.download-status, .section-note { color: var(--muted); font-size: .8125rem; line-height: 1.7; }
.download-status { margin: 16px 0 0; }
.account-footer { display: flex; justify-content: flex-end; margin-top: 14px; }

dialog { width: min(300px, calc(100% - 48px)); padding: 26px 28px 17px; border: 1px solid #303034; border-radius: 2px; background: #101012; color: #dfdfe2; }
dialog::backdrop { background: #0009; }
dialog h2 { margin: 0; font-size: 1rem; font-weight: 400; line-height: 1.5; }
dialog p { font-size: .875rem; line-height: 1.6; color: var(--muted); margin: 12px 0 0; }
dialog form > button { display: flex; margin: 14px 0 0 auto; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); max-width: calc(100% - 48px); color: #e9a8d0; background: #181216; border: 1px solid #38222f; padding: 10px 15px; font-size: .8125rem; line-height: 1.5; }
.skip-link { position: fixed; left: 16px; top: -70px; z-index: 9; background: #0b0b0c; color: var(--accent); padding: 12px; }
.skip-link:focus { top: 12px; }
.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; }
.noscript { text-align: center; color: var(--muted); font-size: .875rem; }

@media (max-width: 480px) {
  main { padding: 36px 28px 76px; }
  .home-view { width: 238px; }
  .home-links { margin-top: 23px; gap: 32px; }
  .form-brand { width: 202px; margin-bottom: 40px; }
  .account-brand { width: 162px; }
  .account-header { margin-bottom: 26px; }
  .detail-row { gap: 20px; padding: 18px 0; }
  .uuid-row { flex-direction: column; gap: 9px; }
  .uuid-row dd { text-align: left; }
  .uuid-control { font-size: .8125rem; letter-spacing: 0; }
}
@media (max-width: 360px) {
  #key-form .input-line { position: relative; margin-bottom: 33px; }
  #key-form .reveal-control { position: absolute; top: 100%; right: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

main:has(.admin-view:not([hidden])) { align-items: start; padding-top: clamp(48px, 9vh, 100px); }
.admin-view { max-width: 960px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 52px; }
.admin-header-actions { display: flex; align-items: center; gap: 24px; flex-shrink: 0; }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.admin-heading h1 { font-size: 1rem; line-height: 1.5; font-weight: 400; margin: 0; outline: none; }
#admin-key-count { color: var(--muted); font-size: .8125rem; margin-left: 9px; }
.admin-search { display: flex; align-items: center; border-bottom: 1px solid #424246; margin-bottom: 26px; }
.admin-search:focus-within { border-color: var(--accent); }
.admin-search input { font-size: .875rem; min-height: 44px; }
.admin-search input::-webkit-search-cancel-button { display: none; }
.key-table { width: 100%; border-collapse: collapse; text-align: left; table-layout: fixed; font-size: .8125rem; line-height: 1.5; }
.key-table th { font-weight: 400; color: var(--muted); padding: 0 14px 13px 0; font-size: .75rem; }
.key-table th:nth-child(1) { width: 40%; }
.key-table th:nth-child(2) { width: 17%; }
.key-table th:nth-child(3) { width: 13%; }
.key-table th:nth-child(4) { width: 20%; }
.key-table th:nth-child(5) { width: 10%; }
.key-table td { border-top: 1px solid var(--line); padding: 15px 14px 15px 0; overflow-wrap: anywhere; vertical-align: middle; }
.key-table th:last-child, .key-table td:last-child { padding-right: 0; text-align: right; }
.key-code { font-family: Consolas, 'Courier New', monospace; font-size: .8125rem; color: #cfcfd3; overflow-wrap: anywhere; }
.key-row.is-selected .key-code { color: var(--accent); }
.key-table .text-control { font-size: .8125rem; min-height: 36px; padding: 6px 0; }
.key-status-paused, .key-unused { color: var(--muted); }
.key-detail-row > td { padding: 14px 0 28px !important; text-align: left !important; border-top: 0; }
.key-detail-content { padding: 4px 0 4px 22px; border-left: 1px solid #4c2040; }
.key-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 40px; margin: 0; }
.key-detail-grid dt { color: var(--muted); font-size: .75rem; margin-bottom: 6px; }
.key-detail-grid dd { margin: 0; font-size: .8125rem; overflow-wrap: anywhere; line-height: 1.7; }
.key-detail-actions { display: flex; gap: 26px; margin-top: 18px; flex-wrap: wrap; }
.key-detail-actions .text-control { font-size: .8125rem; }
.admin-empty { color: var(--muted); font-size: .875rem; padding: 40px 0; margin: 0; text-align: center; }
#delete-dialog { width: min(390px, calc(100% - 48px)); }
#one-time-key-dialog { width: min(440px, calc(100% - 48px)); }
#one-time-key { font-size: .8125rem; margin-top: 12px; user-select: all; }
#delete-description { font-family: Consolas, 'Courier New', monospace; font-size: .8125rem; overflow-wrap: anywhere; }
.delete-actions { display: flex; justify-content: space-between; gap: 24px; margin-top: 18px; }
.releases-section { margin-top: 42px; padding-top: 26px; border-top: 1px solid var(--line); }
.releases-section h2 { font-size: 1rem; font-weight: 400; margin: 0; }
.section-note { margin: 12px 0 18px; }
.release-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); padding: 14px 0; }
.release-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.release-meta { font-size: .75rem; color: var(--muted); line-height: 1.6; }
.connection-status { position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 20px; margin: 0; background: #181216; color: #e9a8d0; text-align: center; font-size: .75rem; }
@media (max-width: 680px) {
  .admin-header { margin-bottom: 35px; }
  .key-table thead { display: none; }
  .key-table, .key-table tbody { display: block; }
  .key-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 20px; padding: 19px 0; border-top: 1px solid var(--line); align-items: center; }
  .key-row td { padding: 0; border: 0; }
  .key-row td:first-child { grid-column: 1 / -1; }
  .key-row td:nth-child(4) { display: none; }
  .key-row td:nth-child(3) { font-size: .75rem; }
  .key-table .key-code { font-size: .75rem; }
  .key-detail-row { display: block; }
  .key-detail-row td { display: block; width: 100%; }
  .key-detail-content { padding-left: 16px; }
  .key-detail-grid { grid-template-columns: 1fr; gap: 15px; }
}
