:root {
  --surface: #ffffff;
  --surface-alt: #f7f8fa;
  --text: #1f2937;
  --line: #d6dbe3;
  --accent: #1d4ed8;

  --jp: #fee2e2;
  --math: #dbeafe;
  --eng: #ede9fe;
  --soc: #fef9c3;
  --sci: #dcfce7;
  --other: #e5e7eb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface-alt);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.app-header { padding: 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
h1, h2, h3, p { margin: 0 0 8px; }
.subtitle { color: #4b5563; }

.tab-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.tab-btn, .btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
}
.tab-btn.active, .btn.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

main { padding: 12px; max-width: 1080px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.week-controls { display: flex; gap: 8px; margin-bottom: 12px; }
.week-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
.day-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px;
}
.day-title { font-weight: 700; margin-bottom: 10px; }
.day-alert { color: #dc2626; font-weight: 700; font-size: 0.92em; }
.period-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.period-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  justify-content: space-between;
}

.subject-list { display: grid; gap: 8px; }
.subject-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}

.link-list { padding-left: 20px; }
.site-notice {
  margin-top: 14px;
  color: #374151;
  line-height: 1.6;
}
a { color: #1e40af; }

.modal {
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(600px, 92vw);
}
.modal::backdrop { background: rgba(31, 41, 55, 0.25); }
.modal article { padding: 14px; }

.admin-wrap { max-width: 680px; }
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 14px;
  margin-bottom: 12px;
}
.hidden { display: none; }
.form-grid { display: grid; gap: 10px; }
input, select {
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 14px;
}
.message { min-height: 22px; color: #334155; }
.admin-list { margin: 0; padding-left: 20px; }

.bg-jp { background: var(--jp); }
.bg-math { background: var(--math); }
.bg-eng { background: var(--eng); }
.bg-soc { background: var(--soc); }
.bg-sci { background: var(--sci); }
.bg-other { background: var(--other); }

@media (min-width: 768px) {
  .week-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .week-grid { grid-template-columns: repeat(5, 1fr); }
}
