:root {
  --ink: #17211d;
  --muted: #66736d;
  --line: #dde4df;
  --paper: #f6f7f4;
  --panel: #fff;
  --blue: #16646a;
  --blue-soft: #e9f4f2;
  --accent: #b36a2c;
  --accent-soft: #fff1e5;
  --shadow: 0 10px 24px rgba(38, 54, 48, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fbfcfa 0, var(--paper) 240px);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #fcfdfb;
  border-right: 1px solid var(--line);
  overflow: auto;
}
main {
  width: min(100%, 980px);
  padding: 28px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
  align-content: start;
}
h1 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.2;
}
h2 { margin: 4px 0 0; font-size: 23px; line-height: 1.35; }
h3 { margin: 0 0 10px; font-size: 16px; }
p { color: var(--muted); line-height: 1.65; margin: 0 0 16px; }
label {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
input, textarea, select, button {
  font: inherit;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 106, 115, .14);
  outline: 0;
}
textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.7;
}
.answer-panel textarea {
  min-height: 240px;
}
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 40px;
  padding: 0 13px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}
button:hover { border-color: #78aaa3; }
button:active { transform: translateY(1px); }
button.primary {
  width: 100%;
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  margin-top: 12px;
}
.brand-block {
  margin-bottom: 22px;
}
.auth-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.button-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  padding: 0 12px;
}
.button-link.muted {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.auth-status {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  padding: 0;
  margin: 10px 0;
}
.login-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin: -6px 0 12px;
}
.side-menu {
  display: grid;
  gap: 3px;
  margin-bottom: 22px;
}
.nav-button,
.menu-link {
  width: 100%;
  display: flex;
  align-items: center;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
  text-decoration: none;
  background: transparent;
}
.nav-button {
  border-color: transparent;
}
.nav-button.active,
.menu-link.active {
  background: var(--blue-soft);
  color: #0d5c64;
}
.menu-link:hover,
.nav-button:hover {
  background: #f0f3f1;
  border-color: transparent;
}
.quiet-link {
  display: inline-block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 14px;
  text-decoration: none;
}
.quiet-link:hover {
  text-decoration: underline;
}
.side-meta {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.side-meta label,
.side-meta .stats,
.side-meta .auth-status,
.side-meta .login-hint {
  margin: 0;
}
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  margin-top: 16px;
  padding: 12px 13px;
  border: 0;
  border-radius: 8px;
  background: #f0f3f1;
}
.stats b { font-size: 25px; line-height: 1; }
.stats span { color: var(--muted); font-size: 12px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.view {
  display: none;
}
.view.active {
  display: grid;
  gap: 16px;
}
.flow-label {
  color: #8a6a50;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 10px;
}
.focus-panel {
  border-color: #b8d8d2;
  background: #fff;
  box-shadow: 0 14px 32px rgba(22, 100, 106, .08);
}
.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}
.question-actions {
  justify-content: flex-start;
  margin-top: 16px;
}
.question-actions button {
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
}
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}
.daily-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.answer-panel {
  min-height: 0;
}
.check-panel {
  position: sticky;
  top: 28px;
}
.head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.focus-panel .head {
  align-items: center;
}
.bank-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.bank-controls select {
  width: auto;
  min-width: 150px;
}
.meta {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}
pre {
  white-space: pre-wrap;
  line-height: 1.85;
  font-family: inherit;
  margin: 16px 0 0;
}
.focus-panel pre {
  font-size: 16px;
}
#source {
  border-left: 4px solid #9aa8bb;
  background: #f4f7f6;
  padding: 13px;
  margin-top: 16px;
}
.action-panel {
  border: 1px solid #d6c9bc;
  border-radius: 8px;
  background: #fffaf5;
  padding: 12px;
  margin: 12px 0 16px;
}
.action-panel summary {
  cursor: pointer;
  font-weight: 800;
}
.action-panel:not([open]) {
  background: #fff;
}
.action-panel h3 {
  margin-bottom: 4px;
}
.action-panel p {
  margin: 10px 0;
  font-size: 12px;
}
.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.action-grid label {
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 0;
}
.action-grid input {
  text-align: center;
}
.action-grid span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.action-checks {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.check {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}
.check input { width: 18px; height: 18px; }
.check b { display: block; }
.check span { color: var(--muted); font-size: 13px; line-height: 1.5; }
.check.compact {
  margin: 0;
  padding: 8px;
}
.score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #b7d9d3;
  background: var(--blue-soft);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}
.score b { font-size: 26px; }
details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
details.action-panel {
  border-color: #d6c9bc;
  background: #fffaf5;
  padding: 12px;
}
details.action-panel:not([open]) {
  background: #fff;
}
.records {
  display: grid;
  gap: 8px;
}
.record, .bank-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfb;
  line-height: 1.6;
}
.action-summary {
  color: #0d5c64;
  font-weight: 700;
}
.bank {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.bank-group h4 {
  margin: 0 0 8px;
  font-size: 14px;
}
.bank-item {
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 4px 8px;
  text-align: left;
  margin-bottom: 8px;
  align-items: start;
}
.bank-item span {
  grid-row: 1 / span 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #dce4ef;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}
.bank-item.done span {
  background: #d8eee9;
  color: #176a55;
}
.bank-item b {
  grid-column: 2;
  font-size: 13px;
  line-height: 1.35;
}
.bank-item small {
  grid-column: 2;
  color: var(--muted);
  line-height: 1.35;
}
.bank-item em {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}
@media (max-width: 880px) {
  .app, .grid, .daily-grid, .bank { grid-template-columns: 1fr; }
  aside {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    align-items: start;
  }
  aside h1 {
    margin: 0;
    font-size: 20px;
  }
  aside > p {
    grid-column: 1;
    margin: -4px 0 0;
    font-size: 13px;
  }
  .auth-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
  }
  .button-link {
    min-height: 34px;
    font-size: 13px;
  }
  .side-menu,
  .side-meta {
    grid-column: 1 / -1;
  }
  #studentField {
    grid-column: auto;
  }
  main { padding: 14px; gap: 14px; }
  .head, .bank-controls { flex-wrap: wrap; }
  .side-menu {
    margin-bottom: 0;
  }
  .nav-button {
    min-height: 38px;
    padding: 0 8px;
  }
  .stats {
    grid-template-columns: auto 1fr auto 1fr;
    align-items: baseline;
    gap: 6px 8px;
    margin-top: 0;
  }
  .stats b {
    font-size: 22px;
  }
  .auth-status, .auth-actions, label {
    margin-top: 0;
    margin-bottom: 0;
  }
  h2 {
    font-size: 21px;
  }
  .panel {
    padding: 18px;
  }
  .focus-panel .head {
    align-items: flex-start;
  }
  .head-actions {
    width: 100%;
    justify-content: stretch;
  }
  .head-actions button {
    flex: 1;
  }
  .question-actions {
    margin-top: 14px;
  }
  .check-panel {
    position: static;
  }
  .answer-panel textarea {
    min-height: 210px;
  }
}

.quiz-page {
  background:
    linear-gradient(180deg, #fbfcfa 0, var(--paper) 240px);
}
.quiz-main {
  width: min(100%, 980px);
  padding: 28px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
  align-content: start;
}
.quiz-controls {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.quiz-controls label {
  margin: 0;
}
.quiz-card {
  display: grid;
  gap: 16px;
  border-color: #c6dcd7;
}
.quiz-count {
  color: var(--muted);
  font-weight: 700;
}
.quiz-choices {
  display: grid;
  gap: 10px;
}
.choice-button {
  min-height: 50px;
  text-align: left;
  line-height: 1.5;
  padding: 10px 12px;
}
.choice-button.correct {
  border-color: #4a9a74;
  background: #e7f5ee;
  color: #145c3d;
  font-weight: 700;
}
.choice-button.wrong {
  border-color: #d16a6a;
  background: #fff0f0;
  color: #8f2e2e;
}
.quiz-feedback {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.7;
}
.quiz-feedback p {
  margin: 4px 0 0;
}
.quiz-feedback.correct {
  border-color: #93d2b4;
  background: #f0fbf5;
}
.quiz-feedback.wrong {
  border-color: #e4b0b0;
  background: #fff7f7;
}
.quiz-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
@media (max-width: 680px) {
  .quiz-main { padding: 14px; }
}
