:root {
  --bg: #f4efe5;
  --panel: rgba(63, 92, 68, 0.96);
  --panel-accent: #dce9d2;
  --card: rgba(255, 252, 246, 0.95);
  --card-strong: #fffdf9;
  --line: rgba(57, 76, 58, 0.14);
  --text: #223127;
  --text-soft: #5b6b5d;
  --text-inverse: #f5f2ea;
  --accent: #bd5d38;
  --accent-strong: #9f4727;
  --accent-soft: #f3d8cc;
  --ok: #456d4f;
  --shadow: 0 24px 70px rgba(54, 64, 48, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-sans: "Avenir Next", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Menlo", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(215, 137, 84, 0.28), transparent 32%),
    radial-gradient(circle at bottom right, rgba(78, 121, 92, 0.18), transparent 24%),
    linear-gradient(135deg, #f4efe5 0%, #ece4d8 50%, #f6f2ea 100%);
}

.page-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.hero-banner {
  position: relative;
  overflow: hidden;
  padding: 24px 30px 18px;
  background:
    linear-gradient(180deg, rgba(41, 65, 50, 0.98), rgba(62, 86, 67, 0.96)),
    linear-gradient(45deg, rgba(255, 255, 255, 0.05), transparent);
}

.hero-banner::after {
  content: "";
  position: absolute;
  inset: auto -40px -90px auto;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(233, 193, 141, 0.28), transparent 70%);
}

.hero-copy {
  position: relative;
  z-index: 1;
  color: var(--text-inverse);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.72;
}

.hero-copy h1,
.workspace-panel h2,
.card-head h3 {
  margin: 0;
  line-height: 1.05;
}

.hero-copy h1 {
  font-size: clamp(2.1rem, 4vw, 3.1rem);
}

.workspace-panel {
  padding: 26px;
}

.workspace-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.locale-switcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(57, 76, 58, 0.12);
  box-shadow: 0 10px 24px rgba(57, 76, 58, 0.08);
  color: var(--text-soft);
}

.locale-switcher span {
  font-size: 0.9rem;
}

.locale-switcher select {
  width: auto;
  min-width: 132px;
  padding: 10px 14px;
  border-radius: 999px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.login-card,
.dashboard {
  animation: rise 360ms ease;
}

.login-card {
  max-width: 520px;
  margin: 32px auto 0;
  padding: 28px;
}

.dashboard {
  display: grid;
  gap: 20px;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-actions,
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
}

.content-stack {
  display: grid;
  gap: 20px;
}

.editor-section {
  display: grid;
  gap: 14px;
}

.qa-section {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(57, 76, 58, 0.1);
}

.section-inline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-inline-head h5 {
  margin: 0;
  font-size: 1rem;
}

.qa-pairs-editor,
.mistake-list {
  display: grid;
  gap: 14px;
}

.qa-card,
.mistake-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.92);
  border: 1px solid rgba(57, 76, 58, 0.12);
}

.qa-card-head,
.mistake-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.qa-card-head h4,
.mistake-card-head h5 {
  margin: 0;
}

.qa-card-meta {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.qa-grid,
.mistake-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.qa-field-wide,
.mistake-field-wide {
  grid-column: 1 / -1;
}

.mistake-section {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.mistake-table {
  display: grid;
  gap: 10px;
}

.mistake-table-head,
.mistake-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 2fr) auto;
  gap: 10px;
  align-items: start;
}

.mistake-table-head {
  padding: 0 2px;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.mistake-row {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.92);
  border: 1px solid rgba(57, 76, 58, 0.12);
}

.mistake-row .ghost-button {
  align-self: center;
}

.inline-empty {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(91, 107, 93, 0.08);
  border: 1px dashed rgba(91, 107, 93, 0.2);
  color: var(--text-soft);
  line-height: 1.6;
}

.small-button {
  padding: 10px 14px;
  font-size: 0.92rem;
}

.lecture-list-card,
.editor-card,
.simulator-card {
  padding: 22px;
}

.chat-log {
  display: grid;
  gap: 12px;
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(57, 76, 58, 0.12);
}

.chat-form {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.chat-bubble {
  max-width: min(88%, 680px);
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.chat-bubble.user {
  margin-left: auto;
  background: rgba(189, 93, 56, 0.12);
  border: 1px solid rgba(189, 93, 56, 0.18);
}

.chat-bubble.assistant {
  margin-right: auto;
  background: rgba(73, 99, 80, 0.09);
  border: 1px solid rgba(73, 99, 80, 0.14);
}

.chat-role {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.chat-empty {
  color: var(--text-soft);
  line-height: 1.7;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.card-head.compact {
  margin-bottom: 18px;
}

.stack-form {
  display: grid;
  gap: 16px;
}

.stack-form label {
  display: grid;
  gap: 8px;
}

.stack-form span {
  font-size: 0.92rem;
  color: var(--text-soft);
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(78, 96, 76, 0.2);
  background: var(--card-strong);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(189, 93, 56, 0.5);
  box-shadow: 0 0 0 4px rgba(189, 93, 56, 0.12);
}

textarea {
  resize: vertical;
}

.code-area {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.6;
}

.primary-button,
.ghost-button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 14px 28px rgba(157, 71, 39, 0.28);
}

.ghost-button {
  background: rgba(73, 99, 80, 0.08);
  color: var(--text);
  border: 1px solid rgba(73, 99, 80, 0.12);
}

.danger-button {
  border-color: rgba(159, 71, 39, 0.2);
  color: var(--accent-strong);
  background: rgba(189, 93, 56, 0.08);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.pill.muted {
  background: rgba(91, 107, 93, 0.12);
  color: var(--text-soft);
}

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

.lecture-item {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(57, 76, 58, 0.12);
  background: rgba(255, 255, 255, 0.64);
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.lecture-item:hover,
.lecture-item.active {
  transform: translateY(-1px);
  border-color: rgba(189, 93, 56, 0.42);
  background: rgba(255, 247, 242, 0.95);
}

.lecture-item-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.lecture-item h4 {
  margin: 0;
  font-size: 1rem;
}

.lecture-item p,
.subtle-text,
.meta-text {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.meta-text {
  font-size: 0.86rem;
}

.message-bar {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 260px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(35, 50, 40, 0.92);
  color: white;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.message-bar.visible {
  opacity: 1;
  transform: translateY(0);
}

.message-bar.error {
  background: rgba(133, 49, 40, 0.96);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .hero-banner {
    padding: 22px 22px 16px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace-panel {
    padding: 18px;
  }

  .workspace-toolbar {
    justify-content: stretch;
  }

  .locale-switcher {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard-topbar,
  .card-head,
  .lecture-item-header,
  .section-inline-head,
  .qa-card-head,
  .mistake-card-head {
    flex-direction: column;
  }

  .qa-grid,
  .mistake-grid {
    grid-template-columns: 1fr;
  }

  .mistake-table-head {
    display: none;
  }

  .mistake-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .form-actions {
    width: 100%;
  }

  .topbar-actions > button,
  .form-actions > button {
    flex: 1 1 100%;
  }
}
