:root { --bg: #f5f4f0; --card: #ffffff; --text: #1d2129; --muted: #6a6f79; --line: #e2e0da; --accent: #2b5fb4; --know: #2f7d4f; --learn: #c0613a; --danger: #b23a3a; }
@media (prefers-color-scheme: dark) { :root { --bg: #15171a; --card: #22252a; --text: #ebe9e4; --muted: #989ca5; --line: #33363c; --accent: #7aa7f0; --know: #5bbd84; --learn: #e08a63; --danger: #e07070; } }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, sans-serif; }
#topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); }
#home-link { flex: 1; font-weight: 650; color: var(--text); text-decoration: none; }
#topbar-actions { display: flex; gap: 8px; }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 60px; }
h1 { font-size: 24px; margin: 4px 0 4px; }
.muted { color: var(--muted); font-size: 14px; }
button, .button { font: inherit; font-size: 15px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.set-list { display: grid; gap: 10px; margin-top: 14px; }
.set-tile { display: block; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; }
.set-tile strong { display: block; font-size: 17px; }
.card-table { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 10px; }
.card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 10px 14px; background: var(--card); }
.edit-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: start; padding: 8px; background: var(--card); }
input[type=text], textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
textarea { resize: vertical; min-height: 42px; }
.title-input { font-size: 20px; font-weight: 600; }
.toggle-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.study-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.progress { width: 100%; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress div { height: 100%; background: var(--accent); transition: width .2s; }
.counts { display: flex; justify-content: space-between; width: 100%; font-weight: 600; }
.counts .learn { color: var(--learn); } .counts .know { color: var(--know); }
.flashcard { position: relative; width: 100%; height: min(58vh, 440px); perspective: 1200px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.flashcard-inner { position: absolute; inset: 0; transition: transform .35s; transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 28px; font-size: clamp(22px, 6vw, 38px); background: var(--card); border: 1px solid var(--line); border-radius: 18px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 6px 24px rgba(0,0,0,.06); white-space: pre-wrap; overflow-wrap: anywhere; }
.face.back { transform: rotateY(180deg); }
.swipe-hint { position: absolute; top: 14px; font-size: 14px; font-weight: 700; opacity: 0; padding: 4px 10px; border-radius: 6px; z-index: 2; }
.swipe-hint.learn { left: 14px; color: var(--learn); border: 2px solid var(--learn); }
.swipe-hint.know { right: 14px; color: var(--know); border: 2px solid var(--know); }
.study-buttons { display: flex; gap: 10px; width: 100%; }
.study-buttons button { flex: 1; justify-content: center; padding: 14px; }
.empty { padding: 30px 0; text-align: center; }
