:root {
  --ink: #12221f;
  --ink-soft: #3a4f4a;
  --muted: #6b7f79;
  --line: rgba(18, 34, 31, 0.1);
  --paper: rgba(255, 252, 247, 0.86);
  --paper-solid: #fffaf2;
  --teal: #0f3d3e;
  --teal-mid: #1f6b63;
  --teal-soft: #d7ece7;
  --amber: #c47a1a;
  --amber-soft: #f7e6c8;
  --good: #1f7a4c;
  --good-soft: #d9f0e3;
  --bad: #b23a3a;
  --bad-soft: #f6dede;
  --shadow: 0 18px 50px rgba(15, 61, 62, 0.12);
  --radius: 18px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Heiti SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 10% -10%, #cfe8e2 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #f3dfc0 0%, transparent 45%),
    linear-gradient(160deg, #eef5f2 0%, #f7f1e8 48%, #e8f0ed 100%);
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  animation: float 12s ease-in-out infinite;
}
.orb-a {
  width: 280px; height: 280px;
  left: -80px; top: 20%;
  background: #9fd3c7;
}
.orb-b {
  width: 320px; height: 320px;
  right: -100px; bottom: 10%;
  background: #efd2a3;
  animation-delay: -4s;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

.app {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

/* 答题 / 成绩 / 回顾：题卡在页面中居中，读题更轻松 */
.app-centered {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px 0 36px;
  box-sizing: border-box;
}
.app-centered > .topbar,
.app-centered > .panel {
  width: min(740px, 100%);
}
.app-centered > .topbar {
  margin-bottom: 14px;
}
.app-centered > .panel {
  margin: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.topbar-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.countdown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.95);
  border: 1px solid rgba(18, 34, 31, 0.08);
  box-shadow: none;
  color: var(--teal);
  white-space: nowrap;
  box-sizing: border-box;
}
.study-time {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.95);
  border: 1px solid rgba(18, 34, 31, 0.08);
  color: var(--teal);
  white-space: nowrap;
  box-sizing: border-box;
  cursor: default;
}
.study-time-tip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  min-width: max-content;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(18, 34, 31, 0.92);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.55;
  text-align: left;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(15, 61, 62, 0.18);
  pointer-events: none;
}
.study-time-tip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: rgba(18, 34, 31, 0.92);
}
.study-time:hover .study-time-tip {
  display: block;
}
.study-time-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}
.study-time-num {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--teal-mid);
  line-height: 1;
  min-width: 1em;
  text-align: center;
}
.study-time-unit {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}
.countdown-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}
.countdown-num {
  font-size: 0.95rem;
  font-weight: 700;
  color: #c47a1a;
  line-height: 1;
  min-width: 1em;
  text-align: center;
}
.countdown-unit {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}
.countdown.today .countdown-num {
  color: var(--bad);
}
@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
  }
  .topbar-meta {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
}
.brand-mark {
  font-size: clamp(1.45rem, 3.6vw, 1.9rem);
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.brand-wish {
  font-size: clamp(0.88rem, 2.1vw, 1.02rem);
  font-weight: 600;
  color: var(--amber);
  letter-spacing: 0.02em;
  line-height: 1.45;
  max-width: 28em;
  animation: wishIn .55s ease both;
}
@keyframes wishIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}
.brand-sub {
  font-size: 0.82rem;
  color: var(--muted);
}
.icon-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  height: 36px;
  padding: 0 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform .15s ease, background .15s ease;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn:hover { transform: translateY(-1px); background: #fff; }
.share-btn {
  gap: 6px;
  background: var(--teal);
  color: #fff;
  border-color: transparent;
}
.share-btn:hover { background: var(--teal-mid); color: #fff; }
.share-icon { display: block; flex-shrink: 0; }
.btn .share-icon {
  display: inline-block;
  vertical-align: -4px;
  margin-right: 4px;
}

.panel {
  background: var(--paper);
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 22px;
  animation: rise .35s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-title {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--teal);
}
.hero-desc {
  margin: 0 0 18px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.subject-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 640px) {
  .subject-grid { grid-template-columns: 1fr; }
}

.subject-card {
  text-align: left;
  border: 1px solid rgba(18, 34, 31, 0.12);
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.subject-card:hover {
  transform: translateY(-2px);
  border-color: rgba(196, 122, 26, 0.35);
  box-shadow: 0 10px 24px rgba(15, 61, 62, 0.08);
}
.subject-card:not(.active) {
  opacity: 0.72;
  background: #f7f8f7;
  border-color: rgba(18, 34, 31, 0.08);
}
.subject-card:not(.active) h3 {
  color: var(--muted);
}
.subject-card:not(.active):hover {
  opacity: 0.9;
}
/* 选中：与每日一练同款浅琥珀底 */
.subject-card.active {
  opacity: 1;
  color: var(--ink);
  border-color: var(--amber);
  background: linear-gradient(180deg, #f8ecd8 0%, #fff 75%);
  box-shadow: 0 8px 18px rgba(154, 77, 18, 0.1);
}
.subject-card h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--teal);
}
.subject-card.active h3 {
  color: #8a5410;
}
.subject-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.subject-card.active p,
.subject-card.active .mini {
  color: var(--ink-soft);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0 18px;
}
@media (max-width: 640px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
.stat {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.stat b {
  display: block;
  font-size: 1.25rem;
  color: var(--teal);
  margin-bottom: 2px;
  line-height: 1.2;
}
.stat span { color: var(--muted); font-size: 0.8rem; }
.stat-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
  min-height: 1.5em;
}
.stat-top b {
  margin-bottom: 0;
}
.stat-side {
  flex: 0 0 auto;
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.stat-btn {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.stat-btn:hover {
  border-color: rgba(196, 122, 26, 0.45);
  background: linear-gradient(180deg, #f8ecd8 0%, #fff 85%);
  transform: translateY(-1px);
}
.stat-btn .stat-side { color: var(--amber); }

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 720px) {
  .mode-grid { grid-template-columns: 1fr; }
}

.mode-btn {
  border: 1px solid rgba(18, 34, 31, 0.1);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  background: linear-gradient(180deg, #f8ecd8 0%, #fff 75%);
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
  box-shadow: none;
}
.mode-btn:hover {
  transform: translateY(-2px);
}
/* 四种近似莫兰迪浅底，风格对齐选中科目卡 */
.mode-btn.mode-daily {
  border-color: rgba(196, 122, 26, 0.35);
  background: linear-gradient(180deg, #f8ecd8 0%, #fff 75%);
}
.mode-btn.mode-daily:hover {
  border-color: rgba(196, 122, 26, 0.5);
  background: linear-gradient(180deg, #f3e2c8 0%, #fff 75%);
}
.mode-btn.mode-daily strong { color: #8a5410; }

.mode-btn.mode-big {
  border-color: rgba(31, 107, 99, 0.28);
  background: linear-gradient(180deg, #dceae6 0%, #fff 75%);
}
.mode-btn.mode-big:hover {
  border-color: rgba(31, 107, 99, 0.45);
  background: linear-gradient(180deg, #d0e3de 0%, #fff 75%);
}
.mode-btn.mode-big strong { color: var(--teal-mid); }

.mode-btn.mode-mini {
  border-color: rgba(90, 120, 70, 0.3);
  background: linear-gradient(180deg, #e4eadc 0%, #fff 75%);
}
.mode-btn.mode-mini:hover {
  border-color: rgba(90, 120, 70, 0.45);
  background: linear-gradient(180deg, #d9e2d0 0%, #fff 75%);
}
.mode-btn.mode-mini strong { color: #4f6a3a; }

.mode-btn.mode-wrong {
  border-color: rgba(160, 100, 90, 0.3);
  background: linear-gradient(180deg, #efe4df 0%, #fff 75%);
}
.mode-btn.mode-wrong:hover {
  border-color: rgba(160, 100, 90, 0.45);
  background: linear-gradient(180deg, #e8d9d2 0%, #fff 75%);
}
.mode-btn.mode-wrong strong { color: #8a5a4e; }

.mode-btn strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
}
.mode-btn small {
  opacity: 1;
  line-height: 1.4;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}
select, .field {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  color: var(--ink);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 600;
}
.chip-gp { background: #e7eef8; color: #274a7a; }
.chip-jj { background: var(--amber-soft); color: #8a5410; }
.chip-wl { background: #e8f0ea; color: #2f5d45; }
.chip-bd { background: #f3e8ff; color: #6b3fa0; }
.chip-yg { background: #ffe8e0; color: #a04828; }

.source-box {
  margin: 4px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.55);
}
.source-title {
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 10px;
}
.source-title span {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.85rem;
}
.source-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 720px) {
  .source-grid { grid-template-columns: 1fr; }
}
.source-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: grid;
  gap: 2px;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.source-card:hover { transform: translateY(-1px); border-color: rgba(31,107,99,.35); }
.source-card.active {
  border-color: var(--teal-mid);
  background: linear-gradient(180deg, #e8f6f2 0%, #fff 75%);
  box-shadow: inset 0 0 0 1px rgba(31,107,99,.12);
}
.source-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.source-grid-flex {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.source-card strong { color: var(--teal); }
.source-card small { color: var(--muted); font-size: 0.8rem; }
.source-card em {
  font-style: normal;
  font-weight: 700;
  color: var(--ink-soft);
  margin-top: 4px;
}
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  cursor: pointer;
}
.check-line + .check-line { margin-top: 8px; }
.check-line b { color: var(--teal); }
.subject-card .mini {
  margin-top: 6px !important;
  font-size: 0.8rem !important;
  color: var(--teal-mid) !important;
}

.progress-bar {
  height: 8px;
  background: rgba(18,34,31,0.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 16px;
}
.progress-bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal-mid), #3aa58f);
  transition: width .25s ease;
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  padding-right: 36px;
}

.q-card {
  position: relative;
}
.copy-btn {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--teal-mid);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}
.copy-btn:hover {
  background: var(--teal-soft);
  color: var(--teal);
  border-color: rgba(31, 107, 99, 0.35);
  transform: translateY(-1px);
}
.copy-btn:active {
  transform: scale(0.96);
}
.list-item .copy-btn {
  top: 10px;
  right: 10px;
}
.copy-icon {
  display: block;
}
.chip-case { background: #efe6d8; color: #6b5344; }
.case-material {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #f7f3ec;
  border: 1px solid #e6ddd0;
  border-radius: 12px;
}
.case-kicker {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #8a7464;
  margin-bottom: 6px;
}
.case-material p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--ink);
}

.options {
  display: grid;
  gap: 10px;
}
.option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.option:hover:not(:disabled) {
  border-color: rgba(31, 107, 99, 0.4);
  transform: translateX(2px);
}
.option .key {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 700;
  font-size: 0.85rem;
}
.option .text { flex: 1; line-height: 1.5; padding-top: 3px; }
.option.selected {
  border-color: var(--teal-mid);
  background: #eef8f5;
}
.option.correct {
  border-color: var(--good);
  background: var(--good-soft);
}
.option.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
}
.option:disabled { cursor: default; }
div.option { cursor: default; }
.chip-ok { background: var(--good-soft); color: var(--good); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-mid { background: var(--amber-soft); color: #8a5410; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-amber {
  background: var(--amber);
  color: #fff;
}

.feedback {
  position: relative;
  margin-top: 14px;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
  animation: rise .25s ease both;
}
.feedback.ok { background: var(--good-soft); border-color: rgba(31,122,76,.25); }
.feedback.mid { background: var(--amber-soft); border-color: rgba(196,122,26,.28); }
.feedback.bad { background: var(--bad-soft); border-color: rgba(178,58,58,.25); }
.feedback-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.feedback h4 {
  margin: 0;
  font-weight: 700;
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 4px;
  line-height: 1.4;
}
.feedback p {
  margin: 0;
  line-height: 1.65;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

.wrong-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.wrong-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 8px;
  font: inherit;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.wrong-tab em {
  font-style: normal;
  margin-left: 4px;
  color: var(--muted);
  font-weight: 700;
}
.wrong-tab.active {
  border-color: var(--amber);
  background: linear-gradient(180deg, #f8ecd8 0%, #fff 80%);
  color: #8a5410;
}
.wrong-tab.active em {
  color: var(--amber);
}
@media (max-width: 560px) {
  .wrong-tabs { grid-template-columns: 1fr; }
}
.list-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  padding-right: 48px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
  position: relative;
}
.list-item:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 107, 99, 0.35);
}
.list-item h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
}
.list-item .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.empty {
  text-align: center;
  padding: 36px 12px;
  color: var(--muted);
}

.footer-note {
  margin-top: 16px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  z-index: 80;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.btn-notes {
  flex: 0 0 auto;
  margin: -2px 0 0;
  padding: 4px 9px;
  border: 1px solid rgba(15, 61, 62, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--teal);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-notes:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

body.notes-open { overflow: hidden; }
.notes-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
}
.notes-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 34, 31, 0.42);
  backdrop-filter: blur(2px);
}
.notes-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--paper-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: notes-pop .2s ease both;
}
.notes-card-pdf {
  width: min(860px, 100%);
  max-height: min(92vh, 900px);
  height: min(92vh, 900px);
}
@keyframes notes-pop {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.notes-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #e7f3ef 0%, #fffaf2 90%);
}
.notes-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--teal-mid);
  margin-bottom: 4px;
}
.notes-head h3 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.35;
}
.notes-chapter {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.notes-head-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 0 0 auto;
}
.notes-open-ext {
  padding: 8px 12px;
  text-decoration: none;
  font-size: 0.85rem;
}
.notes-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(18, 34, 31, 0.06);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.notes-hits {
  padding: 8px 16px 0;
  font-size: 0.8rem;
  color: var(--teal-mid);
}
.notes-hits.muted { color: var(--muted); }
.notes-bridge {
  margin: 8px 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(31, 107, 99, 0.08);
  border: 1px solid rgba(31, 107, 99, 0.14);
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.notes-bridge.muted {
  background: rgba(18, 34, 31, 0.04);
  border-color: var(--line);
  color: var(--muted);
}
.notes-bridge strong { color: var(--teal); font-weight: 700; }
.notes-bridge-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.notes-bridge-row + .notes-bridge-row { margin-top: 4px; }
.notes-bridge-label {
  flex: 0 0 auto;
  min-width: 4.2em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--teal-mid);
  letter-spacing: 0.04em;
}
.notes-bridge-stem {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(31, 107, 99, 0.18);
  color: var(--muted);
  font-size: 0.78rem;
}
.notes-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex: 0 0 auto;
}
.notes-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 12px 6px 8px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.notes-tab em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(18, 34, 31, 0.06);
  color: var(--muted);
}
.notes-tab.kind-best em {
  background: rgba(196, 122, 26, 0.16);
  color: #8a5410;
}
.notes-tab.kind-related em {
  background: rgba(31, 107, 99, 0.12);
  color: var(--teal-mid);
}
.notes-tab.kind-chapter em {
  background: rgba(18, 34, 31, 0.1);
  color: var(--ink-soft);
}
.notes-tab.hot { border-color: rgba(31, 107, 99, 0.35); }
.notes-tab.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.notes-tab.active em {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.notes-pdf-wrap {
  flex: 1 1 auto;
  min-height: 0;
  background: #2b3331;
  border-top: 1px solid var(--line);
}
.notes-pdf {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #2b3331;
}
@media (max-width: 640px) {
  .notes-modal { padding: 8px; }
  .notes-card-pdf {
    width: 100%;
    height: min(94vh, 100%);
    max-height: 94vh;
    border-radius: 14px;
  }
  .notes-head h3 { font-size: 1rem; }
}

body.checkin-open { overflow: hidden; }
.cal-card {
  width: min(720px, 100%);
  max-height: min(90vh, 880px);
  display: flex;
  flex-direction: column;
}
.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 0;
}
.cal-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 0;
  font-size: 0.75rem;
  color: var(--muted);
}
.cal-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(18, 34, 31, 0.08);
}
.cal-body {
  padding: 12px 16px 18px;
  overflow: auto;
  display: grid;
  gap: 16px;
}
.cal-month-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--teal);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  min-height: 58px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  padding: 5px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.cal-cell.empty {
  border-color: transparent;
  background: transparent;
}
.cal-cell.today {
  outline: 2px solid var(--teal-mid);
  outline-offset: 0;
}
.cal-cell.has-data {
  border-color: rgba(140, 110, 100, 0.22);
  color: #4f4542;
}
.cal-empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}
.cal-day {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.1;
}
.cal-rate {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.1;
}
.cal-rate.muted {
  color: var(--muted);
  font-weight: 500;
}
.cal-count {
  font-size: 0.65rem;
  opacity: 0.85;
}
@media (max-width: 560px) {
  .cal-cell { min-height: 50px; padding: 3px 2px; }
  .cal-rate { font-size: 0.7rem; }
  .cal-count { font-size: 0.6rem; }
}

body.stats-open { overflow: hidden; }
.stats-card {
  width: min(560px, 100%);
  max-height: min(90vh, 820px);
  display: flex;
  flex-direction: column;
}
.stats-predict {
  margin: 12px 16px 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f7f8f7;
  text-align: center;
}
.stats-predict.locked {
  border-color: var(--line);
  background: #f7f8f7;
}
.stats-predict.tier-low {
  border-color: rgba(178, 58, 58, 0.35);
  background: linear-gradient(180deg, #f8e4e4 0%, #fff 80%);
}
.stats-predict.tier-low .stats-predict-score {
  color: #a33a3a;
}
.stats-predict.tier-low .stats-predict-tip {
  color: #a33a3a;
}
.stats-predict.tier-ok {
  border-color: rgba(196, 122, 26, 0.4);
  background: linear-gradient(180deg, #f8ecd8 0%, #fff 80%);
}
.stats-predict.tier-ok .stats-predict-score {
  color: #8a5410;
}
.stats-predict.tier-ok .stats-predict-tip {
  color: #8a5410;
}
.stats-predict.tier-strong {
  border-color: rgba(31, 122, 76, 0.4);
  background: linear-gradient(180deg, #dcefe4 0%, #fff 80%);
}
.stats-predict.tier-strong .stats-predict-score {
  color: #1f7a4c;
}
.stats-predict.tier-strong .stats-predict-tip {
  color: #1f7a4c;
}
.stats-predict-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}
.stats-predict-score {
  margin-top: 4px;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}
.stats-predict-score span {
  margin-left: 2px;
  font-size: 1rem;
  font-weight: 600;
}
.stats-predict-tip {
  margin: 6px 0 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}
.stats-predict-note {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.4;
}
.stats-predict-need {
  margin-top: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.45;
}
.stats-predict-need small {
  font-weight: 500;
  color: var(--muted);
}
.stats-ch-body {
  padding: 12px 16px 18px;
  overflow: auto;
  display: grid;
  gap: 10px;
}
.stats-ch-row {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.stats-ch-row:hover {
  border-color: var(--teal-mid);
  background: #fff;
  transform: translateY(-1px);
}
.stats-ch-row:focus-visible {
  outline: 2px solid var(--teal-mid);
  outline-offset: 2px;
}
.stats-ch-row.dim {
  opacity: 0.55;
}
.stats-ch-row.dim:hover {
  opacity: 0.9;
}
.stats-ch-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.stats-ch-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
}
.stats-ch-meta {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--teal-mid);
  white-space: nowrap;
}
.stats-ch-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(18, 34, 31, 0.08);
  overflow: hidden;
}
.stats-ch-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  min-width: 0;
}

body.share-open { overflow: hidden; }
.share-modal { z-index: 50; }
.share-sheet {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: notes-pop .2s ease both;
}
.share-preview {
  width: 100%;
  max-height: min(72vh, 640px);
  object-fit: contain;
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(15, 61, 62, 0.12);
  background: #fffaf2;
}
.share-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.share-sheet-actions .btn { min-width: 108px; }


.paper-box {
  margin: 12px 0 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.55);
}
.paper-list { display: grid; gap: 10px; }
.paper-card {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.paper-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.paper-card-yg {
  border-color: rgba(160, 72, 40, 0.28);
  background: linear-gradient(180deg, #fff5f0 0%, #fff 70%);
}
.paper-card-bd {
  border-color: rgba(31, 107, 99, 0.22);
}
.paper-card-main { display: grid; gap: 2px; }
.paper-card-yg .paper-card-main strong { color: #a04828; }
.paper-card-main strong { color: var(--teal); }
.paper-card-main small { color: var(--muted); font-size: 0.85rem; }
.paper-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.paper-sheet {
  border: 1px dashed rgba(160, 72, 40, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
}
.paper-sheet-bd {
  border-color: rgba(31, 107, 99, 0.28);
}
.paper-sheet-yg {
  border-color: rgba(160, 72, 40, 0.35);
  background: rgba(255, 244, 238, 0.65);
}
.paper-sheet.compact {
  margin: 0 0 12px;
}
.paper-sheet-toggle {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}
.paper-sheet-yg .paper-sheet-toggle span { color: #a04828; font-weight: 700; }
.paper-sheet-bd .paper-sheet-toggle span { color: var(--teal); font-weight: 700; }
.paper-sheet-toggle small { color: var(--muted); font-size: 0.8rem; flex: 1; }
.paper-sheet-toggle em {
  font-style: normal;
  font-size: 0.8rem;
  color: var(--teal-mid);
  font-weight: 600;
}
.paper-sheet-panel {
  padding: 0 12px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.paper-sheet-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 8px 0;
}
.paper-sheet-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: -1px;
}
.paper-sheet-legend .lg-todo { background: #d8dde6; }
.paper-sheet-legend .lg-ok { background: #3d9a6a; }
.paper-sheet-legend .lg-bad { background: #c45c5c; }
.paper-sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
}
.paper-no {
  height: 36px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: #4a5568;
  background: #d8dde6;
}
.paper-no:hover { filter: brightness(0.96); transform: translateY(-1px); }
.paper-no.ok { background: #3d9a6a; color: #fff; }
.paper-no.bad { background: #c45c5c; color: #fff; }
.paper-no.todo { background: #d8dde6; color: #4a5568; }
.paper-no.current {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}
.chip-paper { background: #efe6ff; color: #5b3d91; }
.chip-yg { background: #ffe8e0; color: #a04828; }
.chip-bd { background: #e5f4f1; color: #1f6b63; }
