:root {
  --bg: #f5f6f1;
  --surface: #ffffff;
  --soft: #eef4f3;
  --ink: #18201f;
  --muted: #66716e;
  --line: #dbe1de;
  --teal: #08766f;
  --teal-dark: #075e5a;
  --blue: #1e4f7a;
  --amber: #f3b13d;
  --red: #be3f35;
  --shadow: 0 18px 48px rgba(24, 32, 31, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Noto Sans JP", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar h1 {
  max-width: 780px;
  margin: 4px 0 0;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

.topbar-actions,
.controls,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 48px) 36px;
}

.student-stage,
.history-panel,
.admin-card,
.admin-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.student-stage {
  display: flex;
  min-height: 680px;
  flex-direction: column;
  padding: 22px;
}

.history-panel,
.admin-card,
.admin-list {
  padding: 18px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading.compact {
  margin-bottom: 10px;
}

.section-heading h2,
.followup-header h3 {
  margin: 4px 0 0;
  font-size: 22px;
  letter-spacing: 0;
}

.section-heading.compact h2 {
  font-size: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.status-strip span,
.small-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.prompt-area {
  display: flex;
  min-height: 320px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(8, 118, 111, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(30, 79, 122, 0.05) 1px, transparent 1px),
    #fbfcfb;
  background-size: 28px 28px;
  padding: 28px;
  text-align: center;
}

.prompt-content {
  max-width: 680px;
}

.prompt-kicker {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

.prompt-title {
  margin: 0;
  font-size: clamp(30px, 5vw, 64px);
  line-height: 1.03;
  letter-spacing: 0;
}

.prompt-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
}

audio {
  width: 100%;
  margin: 18px 0;
}

.text-help {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 18px;
  border-left: 5px solid var(--amber);
  border-radius: 8px;
  background: #fff9eb;
}

.hidden {
  display: none;
}

.jp-text {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.35;
  font-weight: 800;
}

.id-text {
  margin: 0;
  color: #5f4b16;
  font-size: 17px;
  line-height: 1.45;
}

.controls {
  margin-top: auto;
}

.controls button {
  flex: 1 1 140px;
}

.primary-button,
.ghost-button,
.danger-button,
.next-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 800;
}

a.primary-button,
a.ghost-button,
a.danger-button,
a.next-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  background: var(--teal);
  color: #ffffff;
}

.primary-button:hover:not(:disabled),
.next-button:hover:not(:disabled) {
  background: var(--teal-dark);
}

.next-button {
  background: var(--blue);
  color: #ffffff;
}

.ghost-button {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.ghost-button:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal);
}

.danger-button {
  border-color: rgba(190, 63, 53, 0.35);
  background: #fff8f7;
  color: var(--red);
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-color: var(--line);
  background: #ffffff;
  color: var(--red);
  font-size: 24px;
  line-height: 1;
}

.history-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.history-list li,
.question-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  font-size: 13px;
  line-height: 1.35;
}

.history-type {
  display: block;
  margin-bottom: 4px;
  color: var(--teal);
  font-weight: 800;
}

.history-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.history-answer {
  margin: 8px 0 0;
  color: var(--muted);
}

.muted-item {
  color: var(--muted);
}

.admin-shell {
  display: grid;
  grid-template-columns: minmax(340px, 520px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 48px) 36px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(430px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 118, 111, 0.13);
}

.followup-header,
.followup-item-head,
.question-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.followup-list {
  display: grid;
  gap: 12px;
}

.followup-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.full-button {
  width: 100%;
}

.question-list {
  display: grid;
  gap: 10px;
}

.question-row h3 {
  margin: 0;
  font-size: 16px;
}

.question-row p {
  margin: 7px 0 0;
  color: var(--muted);
}

.small-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.notice {
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 800;
}

.notice.success {
  background: #e9f7ef;
  color: #1d6a3a;
}

.notice.error {
  background: #fff0ee;
  color: var(--red);
}

.soft-divider {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

@media (max-width: 1080px) {
  .app-shell,
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .student-stage {
    min-height: 560px;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions button,
  .topbar-actions a {
    flex: 1;
  }

  .app-shell,
  .admin-shell {
    padding-inline: 12px;
  }

  .student-stage,
  .history-panel,
  .admin-card,
  .admin-list {
    padding: 14px;
  }
}
