* { box-sizing: border-box; }
:root {
  --teal: #0f6b6e;
  --teal-dark: #0b5254;
  --mint: #d1f2dd;
  --bg: #f4f7f8;
  --ink: #1c2b2d;
  --muted: #5b7073;
  --line: #e3ecec;
}
body {
  margin: 0;
  font-family: "Hiragino Sans", "PingFang SC", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
}
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--teal); color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.top a { color: #fff; text-decoration: none; }
.top nav { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand { font-weight: 700; }
.me { opacity: .9; font-size: .85rem; }
main { max-width: 1020px; margin: 0 auto; padding: 16px 14px 70px; }
h1 { font-size: 1.35rem; margin: 10px 0; }
h2 { font-size: 1.02rem; border-left: 4px solid var(--teal); padding-left: 8px; margin-top: 4px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.card {
  background: #fff; border-radius: 12px; padding: 16px 18px; margin: 14px 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.center { text-align: center; }
.card.notice { background: #fff8e6; border: 1px solid #f0d48a; }

label { display: block; margin: 12px 0 4px; font-size: .92rem; }
input, select {
  width: 100%; padding: 10px; border: 1px solid #c6d4d6; border-radius: 8px;
  font-size: 1rem; background: #fff;
}
.inline-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 8px; }
.inline-form label { margin: 0; }
.inline-form input, .inline-form select { width: auto; }

button, .btn {
  padding: 10px 16px; border: none; border-radius: 8px; cursor: pointer;
  font-size: .93rem; background: #e7eeef; color: var(--ink); text-decoration: none;
  display: inline-block; line-height: 1.2;
}
button.primary, .btn.primary { background: var(--teal); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--teal-dark); }
button.danger { background: #c0392b; color: #fff; }
button.ghost { background: transparent; border: 1px solid #c6d4d6; }
button.ghost.small { padding: 4px 10px; font-size: .78rem; }
.danger-text { color: #c0392b; }
button.big { font-size: 1.15rem; padding: 14px 34px; }
button.off { background: #f0b429; }
button:disabled { opacity: .5; cursor: default; }

.flash {
  background: #e8f6ef; border: 1px solid #9fd8bb; color: #14532d;
  padding: 10px 14px; border-radius: 10px; margin-bottom: 12px;
}
.hint { color: var(--muted); font-size: .88rem; }
.sub { color: var(--muted); font-size: .82rem; }

/* 予約リスト（PCでは3カラム、スマホでは縦積み） */
.lesson-list { list-style: none; margin: 8px 0 0; padding: 0; }
.lesson-list li {
  display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 8px; align-items: center;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.lesson-list li:last-child { border-bottom: none; }
.lesson-when strong { display: block; }
.lesson-actions { display: flex; gap: 8px; align-items: center; }
.lesson-actions form { margin: 0; }

/* カレンダー */
.cal { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.cal-day {
  display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: start;
  padding: 10px 6px; border-bottom: 1px solid var(--line);
}
.cal-day:last-child { border-bottom: none; }
.cal-day.day-off { background: #f7f2f2; opacity: .75; }
.cal-date { display: flex; flex-direction: column; gap: 6px; }
.date-label { font-weight: 600; }
.date-label em {
  font-style: normal; background: var(--mint); color: var(--teal-dark);
  border-radius: 10px; font-size: .72rem; padding: 2px 8px; margin-left: 6px;
}
.date-label small { display: block; font-weight: 400; }
.cal-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-form { margin: 0; display: inline; }
.slot {
  display: inline-block; padding: 8px 14px; border-radius: 18px; font-size: .9rem;
  border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink);
  cursor: pointer;
}
.slot.open { border-color: var(--teal); color: var(--teal-dark); background: #f0fafa; font-weight: 600; }
.slot.open:hover { background: var(--teal); color: #fff; }
.slot.booked { background: var(--teal); color: #fff; border-color: var(--teal); }
.slot.off { background: #f3f4f4; color: #9aa8aa; text-decoration: line-through; }
.slot.past { background: #f3f4f4; color: #b7c2c3; cursor: default; }
.no-slot { color: #b7c2c3; font-size: .85rem; padding: 8px 0; }

/* 毎週の空き時間エディタ */
.week-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 10px;
}
.week-col {
  background: #f8fbfb; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; min-height: 90px;
}
.week-name { font-weight: 700; text-align: center; margin-bottom: 8px; color: var(--teal-dark); }
.rule-chip {
  display: flex; justify-content: space-between; align-items: center; gap: 4px;
  background: #fff; border: 1px solid var(--teal); border-radius: 8px;
  padding: 5px 6px 5px 10px; margin-bottom: 6px;
}
.rule-chip small { color: var(--muted); margin-left: 4px; }
.rule-chip button {
  padding: 0 7px; background: transparent; color: #c0392b; font-size: 1rem; border-radius: 6px;
}
.rule-chip button:hover { background: #fdeeec; }

/* レッスン室 */
.lesson-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.quality { font-size: 1rem; padding: 4px 12px; border-radius: 20px; background: #e7eeef; flex-shrink: 0; }
.quality.good { background: var(--mint); color: #14532d; }
.quality.fair { background: #fdeec4; color: #7a5b06; }
.quality.bad { background: #fad9d4; color: #7f1d1d; }
.room { margin-top: 10px; }
.videos { position: relative; }
.video-box.remote { width: 100%; aspect-ratio: 16 / 9; background: #14282a; border-radius: 12px; overflow: hidden; position: relative; }
.video-box.local {
  position: absolute; right: 12px; bottom: 12px; width: 27%; aspect-ratio: 16 / 9;
  background: #0d1e20; border-radius: 8px; overflow: hidden; border: 2px solid #fff;
}
.video-surface { width: 100%; height: 100%; }
.video-label {
  position: absolute; left: 8px; bottom: 6px; color: #fff; font-size: .8rem;
  text-shadow: 0 1px 3px rgba(0,0,0,.8); pointer-events: none;
}
.controls { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.stats { text-align: center; color: var(--muted); font-size: .84rem; margin-top: 8px; }

/* ---- スマホ ---- */
@media (max-width: 700px) {
  body { font-size: 14.5px; }
  main { padding: 12px 10px 60px; }
  .me { display: none; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input, .inline-form select { width: 100%; }
  .lesson-list li { grid-template-columns: 1fr; gap: 4px; }
  .lesson-actions { margin-top: 4px; }
  .cal-day { grid-template-columns: 1fr; gap: 6px; }
  .cal-date { flex-direction: row; justify-content: space-between; align-items: center; }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .video-box.local { width: 34%; }
  .controls button { flex: 1 1 40%; }
}
