:root {
  --bg: #111214;
  --panel: #1b1d21;
  --line: #2c2f35;
  --text: #e9e9ea;
  --muted: #9a9ca3;
  --again: #b3473f;
  --hard: #9a7b2f;
  --good: #3e8a4f;
  --easy: #3a6ea8;
  color-scheme: dark;
}
* { box-sizing: border-box; transition: none !important; animation: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 19px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; border: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

#bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.counts { display: flex; gap: 12px; font-size: 16px; color: var(--muted); }
.counts b { color: var(--text); font-size: 19px; }
.counts .due b { color: #f0a37a; }
.counts .new b { color: #7ab3f0; }
.tools { display: flex; gap: 8px; align-items: center; }
.tool { background: #2a2d33; padding: 10px 14px; border-radius: 10px; min-height: 44px; font-size: 16px; }
.tool:disabled { opacity: .4; }
#pending { font-size: 14px; color: #f0c674; }

#main { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 12px; }
#review { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 10px; }
#card {
  flex: 1; overflow-y: auto; background: var(--panel); border-radius: 14px; padding: 20px 16px;
  outline: none; user-select: text;
}
.side { font-size: 22px; overflow-wrap: anywhere; }
#back { color: #f2f2f2; }
#divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
#tap-hint { color: var(--muted); font-size: 15px; margin-top: 28px; text-align: center; }
#source { font-size: 14px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; min-height: 20px; }
#source a { color: #8fb7e8; }

#answers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rate { min-height: 76px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 600; }
.rate small { font-weight: 400; font-size: 14px; opacity: .85; }
.again { background: var(--again); } .hard { background: var(--hard); } .good { background: var(--good); } .easy { background: var(--easy); }

.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: #0d1117; padding: 1px 5px; border-radius: 5px; }
code.hljs { display: inline; padding: 1px 5px; }
.katex { font-size: 1.05em; }
.katex-display { overflow-x: auto; overflow-y: hidden; }

#login form { max-width: 360px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; }
#login h1 { margin: 0 0 8px; font-weight: 600; }
#login input { font: inherit; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.big { background: var(--good); padding: 14px; border-radius: 10px; min-height: 52px; font-weight: 600; }
.msg { color: var(--muted); font-size: 15px; white-space: pre-line; }
#empty { text-align: center; margin-top: 15vh; }
