/* StudyLoop — mobile-first, no framework */
:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-light: #eef2ff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #ffffff;
  --bg-soft: #f9fafb;
  --good: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.demo-banner {
  background: repeating-linear-gradient(45deg, #fef3c7, #fef3c7 12px, #fde68a 12px, #fde68a 24px);
  color: #92400e;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  padding: 6px 10px;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
  flex-wrap: wrap;
}
.brand { font-size: 1.15rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.brand span { color: var(--brand); }
.main-nav { display: flex; gap: 14px; overflow-x: auto; flex: 1; }
.main-nav a { color: var(--ink); font-weight: 500; white-space: nowrap; padding: 4px 2px; }
.main-nav a.active { color: var(--brand); border-bottom: 2px solid var(--brand); }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.lang-toggle {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 0.9rem;
}
.lang-toggle:hover { background: var(--brand-light); }

.view { max-width: 1000px; margin: 0 auto; padding: 20px 16px 60px; min-height: 60vh; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 16px 40px;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

/* generic UI */
h1 { font-size: 1.6rem; margin: 0.4em 0; }
h2 { font-size: 1.25rem; margin: 1em 0 0.4em; }
.hero {
  text-align: center;
  padding: 36px 8px 28px;
}
.hero h1 { font-size: 1.9rem; line-height: 1.25; }
.hero p { color: var(--muted); max-width: 560px; margin: 10px auto; }
.tiles { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 18px; }
.tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg);
  display: block;
  color: var(--ink);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.tile:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 2px 10px rgba(79,70,229,0.08); }
.tile .tile-icon { font-size: 1.6rem; }
.tile h3 { margin: 6px 0 4px; }
.tile p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--brand-light); }
.btn.small { padding: 5px 12px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  background: var(--bg);
}
.muted { color: var(--muted); }
.pill {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}
.empty-state { text-align: center; color: var(--muted); padding: 40px 10px; }

input, select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
}
label { font-size: 0.88rem; font-weight: 600; display: block; margin: 10px 0 4px; }
.form-row { margin-bottom: 8px; }

table.data { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
table.data th, table.data td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; }
table.data th { background: var(--bg-soft); }

.notice { background: var(--brand-light); border-radius: 8px; padding: 10px 14px; font-size: 0.9rem; }
.notice.warn { background: #fef3c7; color: #92400e; }
.notice.err { background: #fee2e2; color: #991b1b; }

.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.paper-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

@media (min-width: 640px) {
  .filter-grid { grid-template-columns: repeat(4, 1fr); }
  .tiles { grid-template-columns: 1fr 1fr; }
  .site-header { padding: 12px 24px; }
}
@media (min-width: 900px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
