:root {
  --bg: #0f1115;
  --card: #171a21;
  --text: #e8eaf0;
  --muted: #a8b0c0;
  --accent: #4f8cff;
  --danger: #ff5a6a;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #10131a;
    --muted: #5d6677;
    --accent: #2a6bff;
    --border: rgba(16, 19, 26, 0.08);
    --shadow: 0 10px 30px rgba(16, 19, 26, 0.12);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue";
  background: var(--bg);
  color: var(--text);
}

.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  padding: 16px 16px 10px;
  position: sticky; top: 0;
  background: linear-gradient(to bottom, var(--bg), rgba(0,0,0,0));
  backdrop-filter: blur(8px);
}
.topbar__title { font-weight: 800; font-size: 18px; letter-spacing: 0.2px; }
.topbar__subtitle { margin-top: 4px; font-size: 12px; color: var(--muted); }

.main { padding: 12px 16px 24px; flex: 1; }
.screen__title { font-size: 16px; font-weight: 800; margin: 10px 0 12px; }
.hidden { display: none; }

.cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card__title { font-weight: 800; font-size: 14px; line-height: 1.25; }
.card__meta { margin-top: 6px; font-size: 12px; color: var(--muted); }

.row { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 12px;
  font-weight: 800;
  flex: 1;
}
.btn--primary { background: var(--accent); border-color: rgba(0,0,0,0); color: white; }
.btn--ghost { background: transparent; }
.btn--danger { background: var(--danger); border-color: rgba(0,0,0,0); color: white; }

.exlist { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.ex {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.ex__name { font-weight: 900; font-size: 14px; line-height: 1.2; }
.ex__hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.ex__sets { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
}
.chip--muted { color: var(--muted); }
.chip--btn { background: transparent; cursor: pointer; }
.chip--btn:active { transform: translateY(1px); }
.ex__actions { margin-top: 10px; display: flex; gap: 10px; }

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.modal.hidden { display: none; }
.modal__sheet {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  max-height: 88vh;
  overflow: auto;
}
.modal__title { font-weight: 900; font-size: 15px; }
.modal__sub { margin-top: 6px; color: var(--muted); font-size: 12px; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field:nth-child(3) { grid-column: 1 / -1; }
.field__label { font-size: 12px; color: var(--muted); font-weight: 800; }
.field__input {
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.field__input:focus { border-color: rgba(79, 140, 255, 0.7); }

.quick { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }

@media (max-width: 420px) {
  .form { grid-template-columns: 1fr; }
  .field:nth-child(3) { grid-column: auto; }
  .row { flex-wrap: wrap; }
  .btn { flex: 1 1 120px; }
}

