:root {
  color-scheme: light dark;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #17211b;
  --muted: #5b6a61;
  --accent: #1f6f4a;
  --warn: #b45309;
  --border: #d9e2dc;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101613;
    --card: #1a221d;
    --text: #eef4f0;
    --muted: #a7b8ad;
    --accent: #4cc38a;
    --warn: #f0a35e;
    --border: #2c3a31;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
:root { --theme: #1f6f4a; }
.app-header {
  background: var(--accent);
  color: #fff;
  padding: 20px 16px 14px;
}
.app-header h1 { margin: 0; font-size: 22px; }
.updated { margin: 6px 0 0; font-size: 12px; opacity: .85; }
main { padding: 14px; display: grid; gap: 14px; max-width: 720px; margin: 0 auto; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.card h2 { margin: 0 0 10px; font-size: 16px; }
.list { display: grid; gap: 8px; }
.item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.item .title { font-weight: 600; }
.item .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.badge {
  display: inline-block;
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
  background: var(--accent);
  color: #fff;
  vertical-align: 1px;
}
.badge.warn { background: var(--warn); }
.empty { color: var(--muted); font-size: 14px; }
.timetable { display: grid; gap: 10px; }
.day h3 { margin: 0 0 6px; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
button, .file-label {
  display: inline-block;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  margin: 4px 6px 4px 0;
}
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.file-label input { display: none; }

.add-deadline { margin-top: 16px; border-top: 1px solid #e5e7eb; padding-top: 12px; }
.add-deadline h3 { font-size: 14px; margin: 0 0 8px; }
.add-deadline input { display: block; width: 100%; box-sizing: border-box; margin-bottom: 8px; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; }
.delete-btn { margin-top: 6px; padding: 4px 12px; font-size: 12px; background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; border-radius: 999px; }

.slide-reset { position: relative; margin-top: 12px; height: 48px; border: 1px solid #d1d5db; border-radius: 999px; background: #f9fafb; overflow: hidden; touch-action: none; }
.slide-track { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.slide-label { font-size: 14px; color: #6b7280; }
.slide-handle { position: absolute; top: 2px; left: 2px; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 1px solid #d1d5db; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #374151; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }


.app-header { display: flex; align-items: center; gap: 12px; }
.menu-btn { background: transparent; border: none; color: #fff; font-size: 26px; padding: 4px 8px; cursor: pointer; }
.header-text h1 { margin: 0; }
.view { display: none; }
.view.active { display: block; }
.drawer { position: fixed; top: 0; left: 0; height: 100%; width: 240px; background: #fff; color: #111827; box-shadow: 2px 0 12px rgba(0,0,0,.2); transform: translateX(-100%); transition: transform .25s; z-index: 50; padding-top: 70px; }
.drawer.open { transform: translateX(0); }
.drawer-item { display: block; width: 100%; text-align: left; padding: 16px 20px; font-size: 16px; background: none; border: none; border-bottom: 1px solid #e5e7eb; cursor: pointer; color: #111827; }
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 40; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.theme-colors { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #d1d5db; cursor: pointer; padding: 0; }


@media (prefers-color-scheme: dark) {
  .drawer { background: #1f2937; color: #f9fafb; }
  .drawer-item { color: #f9fafb; border-bottom-color: #374151; }
}

.accordion-head { width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: none; font-size: 18px; font-weight: 700; color: var(--text); padding: 4px 0; cursor: pointer; }
.accordion-body { display: none; margin-top: 8px; }
.accordion-body.open { display: block; }
.chev { transition: transform .2s; font-size: 14px; color: var(--muted); }
.accordion-head.open .chev { transform: rotate(180deg); }

.course-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.refresh-btn { margin-left: auto; background: transparent; border: none; color: #fff; font-size: 26px; padding: 4px 8px; cursor: pointer; }
.refresh-btn:disabled { opacity: .6; }
