:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --bg-hover: #eef1f5;
  --fg: #17202b;
  --fg-2: #445063;
  --fg-3: #5f6b7c;
  --rule: #d5dbe4;
  --ctl: #7f8c9e;
  --accent: #25405f;
  --on-accent: #f5f7fa;
  --error: #b32a2a;
  --focus: #25405f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171e;
    --surface: #171e27;
    --bg-hover: #1b222c;
    --fg: #e8edf3;
    --fg-2: #b4bfcd;
    --fg-3: #8e9aab;
    --rule: #262f3b;
    --ctl: #5d6b7e;
    --accent: #a9c1de;
    --on-accent: #12171e;
    --error: #f08a8a;
    --focus: #a9c1de;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #12171e;
  --surface: #171e27;
  --bg-hover: #1b222c;
  --fg: #e8edf3;
  --fg-2: #b4bfcd;
  --fg-3: #8e9aab;
  --rule: #262f3b;
  --ctl: #5d6b7e;
  --accent: #a9c1de;
  --on-accent: #12171e;
  --error: #f08a8a;
  --focus: #a9c1de;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1,
h2,
p {
  margin: 0;
}

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

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

/* Buttons */

.btn {
  appearance: none;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  background: var(--fg);
  border-color: var(--fg);
}

.btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.btn-quiet {
  min-height: 34px;
  padding: 4px 14px;
  border-color: var(--ctl);
  background: transparent;
  color: var(--fg-2);
  font-size: 14px;
}

.btn-quiet:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--ctl);
  color: var(--fg);
}

/* Gate */

.gate-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 100vh;
  padding: 24px 16px;
}

.gate-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 6px;
}

.gate-title {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
}

.gate-lead {
  margin-top: 6px;
  color: var(--fg-2);
}

.gate-input {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 20px;
  padding: 8px 12px;
  border: 1px solid var(--ctl);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

.gate-input[aria-invalid="true"] {
  border-color: var(--error);
}

.gate-error {
  margin-top: 10px;
  color: var(--error);
  font-size: 14px;
}

.gate-card .btn {
  width: 100%;
  margin-top: 16px;
}

.gate-back {
  font-size: 14px;
}

.gate-back a,
.gate-back a:visited {
  color: var(--fg-2);
}

.gate-back a:hover {
  color: var(--fg);
}

.plain-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  color: var(--fg-2);
  text-align: center;
}

/* Picker */

.picker {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 16px 40px;
}

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.picker-title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}

.card:hover {
  background: var(--bg-hover);
  border-color: var(--ctl);
  border-top-color: var(--accent);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.card-desc {
  color: var(--fg-2);
  font-size: 14px;
}

.card-date {
  margin-top: auto;
  padding-top: 4px;
  color: var(--fg-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.foot {
  margin-top: 32px;
  color: var(--fg-3);
  font-size: 13px;
}
