@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Tektur;
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("./tektur-cyrillic.woff2") format("woff2");
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Tektur;
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("./tektur-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --background: #141a22;
  --panel: #1b232d;
  --control: #212b37;
  --line: #2c3845;
  --control-border: #687a8f;
  --ink: #e3eaf1;
  --muted: #aab7c4;
  --accent: #46e0ef;
  --accent-text: #6fe9f5;
  --accent-fill: #05222a;
  --warning: #ffc36e;
  --success: #5fd08a;
  --danger: #ff8cc2;
  --display: Tektur, Onest, system-ui, sans-serif;
  --cut: 14px;
  --corner-shape: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%,
    var(--cut) 100%, 0 calc(100% - var(--cut)));
  font: 16px/1.5 Onest, system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 76% 0, #46e0ef12, transparent 45rem),
    radial-gradient(#8cafcd19 0.8px, transparent 0.8px) 0 0 / 20px 20px;
}

.masthead { background: #141a22e8; border-bottom: 1px solid var(--line); }
.masthead-inner, main {
  width: min(100% - clamp(2rem, 8vw, 6rem), 68rem);
  margin-inline: auto;
}
.masthead-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font: 600 clamp(1.38rem, 4vw, 1.7rem)/1 var(--display);
  text-decoration: none;
}
.brand img { width: 37px; height: 37px; flex: none; }
.platform { color: var(--muted); font: 500 .9rem/1.25 var(--display); }
.platform:hover { color: var(--accent-text); }

main { padding: clamp(2rem, 7vw, 5rem) 0 4rem; }
.intro { margin-bottom: clamp(1.25rem, 3vw, 1.8rem); }
h1, h2, legend { font-family: var(--display); font-weight: 600; line-height: 1.12; }
h1 { margin: 0; font-size: clamp(2.15rem, 5vw, 4.25rem); max-width: 16ch; text-wrap: balance; }
h2 { margin: 0 0 .75rem; font-size: 1.45rem; }
legend { padding: 0; margin-bottom: .8rem; font-size: 1.18rem; }

#sign-in, #result {
  position: relative;
  isolation: isolate;
  background: var(--line);
  padding: clamp(1.1rem, 4vw, 1.8rem);
  clip-path: var(--corner-shape);
}
#sign-in::before, #result::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 1px;
  clip-path: var(--corner-shape);
  background: linear-gradient(145deg, var(--panel), var(--background));
}
#sign-in:focus-within { background: var(--accent); }
#sign-in .fields { display: grid; align-items: start; }
#sign-in button { justify-self: start; }
#result { max-width: 40rem; }

.fields { display: flex; align-items: end; flex-wrap: wrap; gap: .8rem; }
.fields label { flex: 1 1 14rem; min-width: 0; }
label { display: grid; gap: .38rem; min-width: 0; }
.consent { display: flex; align-items: center; gap: .6rem; margin-top: .8rem; }
.consent input { min-height: 0; width: 1rem; height: 1rem; accent-color: var(--accent); }
input, select, button { min-height: 46px; font: inherit; }
input:not([type="radio"], [type="checkbox"]), select {
  width: 100%;
  border: 1px solid var(--control-border);
  background: var(--control);
  color: inherit;
  padding: .68rem .85rem;
}
select {
  appearance: none;
  padding-right: 2.25rem;
  background-image: linear-gradient(45deg, transparent 51%, var(--muted) 51%),
    linear-gradient(135deg, var(--muted) 51%, transparent 51%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
input::placeholder { color: var(--muted); }
button {
  border: 0;
  padding: .72rem 1.1rem;
  background: var(--accent);
  color: var(--accent-fill);
  font-family: var(--display);
  font-weight: 700;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
}
button:hover:not(:disabled), button:focus-visible { background: var(--accent-text); }
button:focus-visible { box-shadow: inset 0 0 0 3px var(--accent-fill), inset 0 0 0 5px var(--accent-text); }
button:disabled { background: var(--control); color: var(--muted); cursor: default; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }

fieldset { min-inline-size: 0; border: 0; padding: 0; margin: 0 0 1.5rem; }
#catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(10rem, calc(50% - .5rem)), 1fr)); gap: .8rem; }
.character { position: relative; }
.character input { position: absolute; z-index: 1; inset: 0; height: 100%; width: 100%; margin: 0; opacity: 0; cursor: pointer; }
.character span {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: .2rem;
  height: 100%;
  background: var(--panel);
  padding: .55rem .55rem .75rem;
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: var(--corner-shape);
  transition: background-color 150ms;
}
.character input:hover + span { background: var(--control); }
.character input:focus-visible + span, .character input:checked + span {
  background: var(--control);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.character input:checked + span strong { color: var(--accent-text); }
.character img { width: 100%; aspect-ratio: 1; object-fit: cover; margin-bottom: .3rem; clip-path: var(--corner-shape); }
.character strong { font-family: var(--display); font-weight: 600; overflow-wrap: anywhere; }
.character small, p { color: var(--muted); }
.character small { min-height: 2.8em; overflow-wrap: anywhere; }
#status:empty { display: none; }
#status, #delivery[data-state="failed"] { color: var(--danger); }
#channel-note { color: var(--warning); }
#delivery[data-state="sent"] { color: var(--success); }

@media (min-width: 790px) {
  main:has(#sign-in:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(18rem, .9fr);
    align-items: center;
    gap: 1rem clamp(2.5rem, 7vw, 6rem);
    padding-top: clamp(4rem, 13vh, 9rem);
  }
  main:has(#sign-in:not([hidden])) .intro { margin-bottom: 0; }
  main:has(#sign-in:not([hidden])) #status { grid-column: 2; margin-top: 0; }
}
@media (max-width: 520px) {
  .masthead-inner { min-height: 60px; }
  #sign-in button, #activation .fields button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .character span { transition: none; }
}
