:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #5b6678;
  --line: #dbe5f0;
  --blue: #1764d8;
  --blue-dark: #0d3f9d;
  --orange: #ff7a1a;
  --orange-dark: #d9480f;
  --green: #159c61;
  --green-dark: #099268;
  --red: #d83933;
  --purple: #7048e8;
  --purple-dark: #5f3dc4;
  --paper: #ffffff;
  --soft: #eef6ff;
  --wash: #f7fbff;
  --cream: #fff7ec;
  --shadow: 0 18px 44px rgba(15, 56, 120, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  background: #f6f9ff;
}

a {
  color: inherit;
  text-decoration: none;
}

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

h1,
h2,
h3,
p,
span,
strong,
label {
  word-break: keep-all;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 24px);
  overflow-y: auto;
  background:
    linear-gradient(rgba(246, 249, 255, 0.86), rgba(246, 249, 255, 0.92)),
    url("./assets/step-1.png") center / cover;
}

.gate.is-open {
  display: none;
}

.gate-panel {
  width: min(100%, 560px);
  margin: auto;
  padding: clamp(20px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.gate-panel h1 {
  margin: 10px 0 0;
  font-size: clamp(32px, 5vw, 50px);
  line-height: 1.12;
  letter-spacing: 0;
}

.gate-form {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.gate-panel .form-group input {
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 14px;
  font-size: 15px;
  border-radius: 8px;
  width: 100%;
}

.gate-panel .form-group input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 100, 216, 0.15);
}

.gate-panel .primary-button {
  margin-top: 10px;
  min-height: 50px;
  font-size: 16px;
}

.app-shell.is-locked {
  max-height: 100vh;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(18, 68, 156, 0.12);
  background: rgba(255, 255, 255, 0.91);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-size: 15px;
  font-weight: 900;
}

.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.gate-logo {
  width: 76px;
  height: 76px;
  margin-bottom: 8px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 850;
}

.nav a {
  padding: 10px 12px;
  border-radius: 8px;
}

.nav a:hover {
  color: var(--blue);
  background: var(--soft);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(24px, 4vw, 40px);
  min-height: calc(100vh - 72px);
  padding: clamp(34px, 7vw, 74px) clamp(18px, 5vw, 72px) 44px;
  background:
    radial-gradient(circle at 90% 10%, rgba(255, 122, 26, 0.12), transparent 22%),
    linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
}

.hero-header {
  text-align: center;
  margin-bottom: 10px;
}

.hero-header .eyebrow {
  margin: 0 auto 10px;
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 13px;
  color: var(--blue);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
}

.hero-header h2 {
  font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  font-size: clamp(28px, 4.5vw, 42px);
  font-weight: 900;
  color: var(--blue-dark);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.15;
}

.planner-header {
  text-align: center;
  margin-bottom: 10px;
}

.planner-header .eyebrow {
  margin: 0 auto 10px;
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 13px;
  color: var(--purple);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
}

.planner-header h2 {
  font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  font-size: clamp(28px, 4.5vw, 42px);
  font-weight: 900;
  color: var(--purple-dark);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.15;
}

.notebook-header {
  text-align: center;
  margin-bottom: 30px;
  width: 100%;
}

.notebook-header .eyebrow {
  margin: 0 auto 10px;
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 13px;
  color: var(--orange);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
}

.notebook-header h2 {
  font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  font-size: clamp(28px, 4.5vw, 42px);
  font-weight: 900;
  color: var(--orange-dark);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.15;
}

.notebook-header p {
  max-width: 800px;
  margin: 15px auto 0;
  color: var(--muted);
  font-size: clamp(14px, 1.8vw, 16px);
  line-height: 1.6;
  font-weight: 700;
}

.lead {
  max-width: 680px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.72;
  font-weight: 700;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-button,
.ghost-button,
.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 10px 20px rgba(21, 91, 215, 0.22);
}

.primary-button:hover {
  background: var(--blue-dark);
}

.ghost-button,
.copy-button {
  color: var(--blue-dark);
  background: #fff;
  border-color: var(--line);
}

.coach-card {
  width: 100%;
  max-width: 1600px;
  display: grid;
  gap: 14px;
  min-height: 900px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.coach-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

select,
input {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

.chat-window {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 550px;
  max-height: 750px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--wash);
}

.message {
  max-width: 92%;
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(16, 40, 90, 0.08);
}

.message strong {
  display: block;
  margin-bottom: 6px;
}

.message p {
  margin: 0;
  line-height: 1.62;
  font-weight: 700;
}

.message ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.message li {
  margin: 5px 0;
  line-height: 1.55;
  font-weight: 700;
}

.message.student {
  align-self: flex-end;
  color: #7d3a00;
  background: #fff0df;
  border: 1px solid #ffc37d;
}

.message.tutor {
  align-self: flex-start;
  color: #0f377e;
  background: #fff;
  border: 1px solid #bdd2f4;
}

.question-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.latest-answer {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid #bcd2f5;
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: #fff;
}

.latest-answer.has-answer {
  box-shadow: 0 12px 24px rgba(21, 91, 215, 0.15);
}

.latest-answer strong {
  color: var(--blue-dark);
  font-size: 17px;
}

.latest-answer p {
  margin: 0;
  line-height: 1.62;
  font-weight: 750;
}

.latest-answer ul {
  margin: 0;
  padding-left: 20px;
}

.latest-answer li {
  margin: 6px 0;
  line-height: 1.55;
  font-weight: 720;
}

.section {
  padding: 78px clamp(18px, 5vw, 72px);
  background: #fff;
}

.section:nth-of-type(2n) {
  background: var(--wash);
}

.section-heading {
  max-width: 900px;
  margin-bottom: 26px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.12;
  letter-spacing: 0;
}

.section-heading p:not(.eyebrow) {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.72;
  font-weight: 700;
}

.material-board {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
}

.upload-box,
.material-list,
.step-card,
.planner,
.complete-board,
.complete-result,
.prompt-card,
.rule-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.upload-box {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 22px;
}

.material-list {
  display: grid;
  gap: 10px;
  min-height: 180px;
  padding: 18px;
}

.material-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.material-item strong {
  font-size: 16px;
}

.material-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.delete-material {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #ffd0c8;
  border-radius: 8px;
  color: var(--red);
  background: #fff7f5;
  font-weight: 900;
  cursor: pointer;
}

.delete-material:hover {
  border-color: var(--red);
}

.empty-state,
.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 700;
}

.form-note.is-error {
  color: var(--red);
}

.notebook-section {
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(24px, 4vw, 40px);
}

.notebook-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
  width: 100%;
  max-width: 1600px;
}

.notebook-flow article {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid #ffd3a8;
  border-radius: 8px;
  background: #fff;
}

.notebook-flow strong {
  font-size: 17px;
}

.notebook-flow span {
  color: var(--muted);
  line-height: 1.55;
  font-weight: 700;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 1600px;
}

.prompt-card {
  display: grid;
  gap: 14px;
  align-content: space-between;
  min-height: 280px;
  padding: 20px;
}

.prompt-card h3 {
  margin: 0;
  font-size: 19px;
}

.prompt-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
  font-weight: 720;
}

.copy-button {
  justify-self: start;
}

.copy-button.done {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.complete-section {
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(24px, 4vw, 40px);
}

.complete-header {
  text-align: center;
  margin-bottom: 30px;
  width: 100%;
}

.complete-header .eyebrow {
  margin: 0 auto 10px;
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 13px;
  color: var(--green);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
}

.complete-header h2 {
  font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  font-size: clamp(28px, 4.5vw, 42px);
  font-weight: 900;
  color: var(--green-dark);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.15;
}

.complete-header p {
  max-width: 800px;
  margin: 15px auto 0;
  color: var(--muted);
  font-size: clamp(14px, 1.8vw, 16px);
  line-height: 1.6;
  font-weight: 700;
}

.complete-board {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  padding: 22px;
  width: 100%;
  max-width: 1600px;
}

.complete-form {
  display: grid;
  gap: 14px;
  align-content: start;
}

.complete-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.complete-output {
  display: grid;
  gap: 14px;
}

.complete-result {
  display: grid;
  gap: 12px;
  padding: 18px;
  box-shadow: none;
}

.complete-result strong {
  color: var(--blue-dark);
  font-size: 20px;
}

.complete-result span,
.complete-result p,
.complete-result li {
  color: var(--muted);
  line-height: 1.6;
  font-weight: 720;
}

.complete-result ol {
  margin: 0;
  padding-left: 22px;
}

.answer-frame {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #ffd3a8;
  border-radius: 8px;
  background: #fff8ef;
}

.answer-frame p {
  margin: 0;
}

.model-answer {
  border-color: #bdd2f4;
  background: #f5f9ff;
}

.step-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.tab {
  min-width: 92px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.tab.is-active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.routine-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(320px, 1.18fr);
  gap: 22px;
  align-items: stretch;
}

.step-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  padding: clamp(24px, 4vw, 42px);
}

.step-kicker {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--orange);
  font-weight: 900;
}

.step-card h3 {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.18;
}

.step-card p:not(.step-kicker) {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.72;
  font-weight: 700;
}

.checklist {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding: 14px 14px 14px 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: inset 0 0 0 4px #fff;
}

.poster-frame {
  margin: 0;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.poster-frame img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 760px;
  object-fit: contain;
  background: #fff;
}

.planner {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  padding: 22px;
  width: 100%;
  max-width: 1600px;
}

.planner-form {
  display: grid;
  gap: 14px;
  align-content: start;
}

.full {
  width: 100%;
  margin-top: 4px;
}

.plan-output {
  display: grid;
  gap: 12px;
}

.plan-day {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: #fff;
}

.plan-day strong {
  font-size: 18px;
}

.plan-day span {
  color: var(--muted);
  line-height: 1.55;
  font-weight: 700;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.rule-grid article {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.rule-grid strong {
  font-size: 18px;
}

.rule-grid span {
  color: var(--muted);
  line-height: 1.58;
  font-weight: 700;
}

.footer {
  padding: 34px clamp(18px, 5vw, 72px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-weight: 800;
}

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

  .hero,
  .material-board,
  .routine-grid,
  .planner,
  .complete-board {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .coach-toolbar,
  .notebook-flow,
  .prompt-grid,
  .rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .nav {
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
    font-size: 13px;
  }

  .nav a {
    padding: 8px 6px;
    white-space: nowrap;
  }

  .gate-row,
  .question-form,
  .coach-toolbar,
  .notebook-flow,
  .prompt-grid,
  .rule-grid {
    grid-template-columns: 1fr;
  }

  .step-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .tab {
    min-width: 0;
  }

  .message {
    max-width: 100%;
  }

  .section {
    padding-block: 56px;
  }
}

/* ==========================================
   Gemini API Settings Panel & Markdown Styling
   ========================================== */

/* API Settings Panel */
.settings-panel {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 4px 12px rgba(18, 68, 156, 0.05);
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.settings-panel.is-hidden {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  border-bottom-color: transparent;
  pointer-events: none;
}

.settings-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px clamp(18px, 4vw, 56px);
  display: grid;
  gap: 16px;
}

.settings-container h3 {
  margin: 0;
  font-size: 18px;
  color: var(--blue-dark);
}

.settings-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 768px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.input-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-password-wrapper input {
  padding-right: 46px;
}

.input-password-wrapper .icon-button {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 8px;
  color: var(--muted);
}

.settings-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.status-badge {
  font-size: 14px;
  font-weight: 900;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--wash);
  color: var(--muted);
  border: 1px solid var(--line);
}

.status-badge.connected {
  background: #eefdf5;
  color: var(--green);
  border-color: #a3ecd0;
}

.status-badge.error {
  background: #fff5f5;
  color: var(--red);
  border-color: #ffd8d6;
}

.settings-buttons {
  display: flex;
  gap: 10px;
}

.settings-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.settings-toggle-btn:hover {
  background: var(--soft);
  color: var(--blue);
  border-color: var(--blue);
}

.settings-toggle-btn.is-active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* Markdown Rendering Helpers inside Chat and Complete box */
.message pre, .complete-result pre {
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
  font-size: 14px;
  margin: 10px 0;
}

.message code, .complete-result code {
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
  background: rgba(15, 23, 42, 0.05);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
}

.message pre code, .complete-result pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.message h1, .message h2, .message h3,
.complete-result h1, .complete-result h2, .complete-result h3 {
  margin-top: 14px;
  margin-bottom: 8px;
  color: var(--blue-dark);
}

.message h3, .complete-result h3 {
  font-size: 16px;
}

/* Custom indicator for files loaded in app.js UI */
.material-item.is-api-ready {
  border-color: #a3ecd0;
  background: #f6fdfa;
}
.material-item.is-api-ready span {
  color: var(--green);
}

/* Badge showing which uploaded files are referenced in the chat question bubble */
.referenced-materials-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(125, 58, 0, 0.2);
  border-radius: 6px;
  font-size: 12px;
  color: #7d3a00;
  font-weight: 800;
}

/* Help text inside settings panel */
.settings-help-text {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 700;
}

/* General helper classes */
.is-hidden {
  display: none !important;
}

/* User authentication badges in header */
.user-email-badge {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--blue-dark);
  background: var(--blue-light);
  padding: 6px 12px;
  border-radius: 20px;
  margin-right: 8px;
  border: 1px solid rgba(21, 91, 215, 0.15);
}

.logout-btn {
  background: #fff0f0 !important;
  color: var(--red) !important;
  border-color: rgba(235, 87, 87, 0.2) !important;
}
.logout-btn:hover {
  background: #ffe5e5 !important;
}

/* Modal Overlay and Content styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.25s ease-out;
}

.modal-content {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  position: relative;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  font-size: 24px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close-btn:hover {
  color: var(--text);
}

.modal-content h3 {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
  text-align: center;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.form-group label {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}
.form-group input {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  transition: border-color 0.2s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--blue);
}

.full-width {
  width: 100%;
}

.auth-error-message {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  margin: -8px 0 16px;
  line-height: 1.4;
}

.auth-toggle-wrapper {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.link-button {
  background: none;
  border: none;
  color: var(--blue);
  font-weight: 900;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  text-decoration: underline;
}
.link-button:hover {
  color: var(--blue-dark);
}

/* History Drawer styling */
/* History Page View Dashboard Styling */
#historyView {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px clamp(18px, 4vw, 56px);
  animation: fadeIn 0.25s ease-out;
}

.history-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  border-bottom: 2.5px solid var(--line);
  padding-bottom: 22px;
  margin-bottom: 30px;
}

.history-page-title-group h2 {
  margin: 0;
  font-size: clamp(28px, 3.5vw, 36px);
  color: var(--blue-dark);
}

.history-page-title-group p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.history-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  align-items: start;
}

@media (max-width: 1024px) {
  .history-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.history-column {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(18, 68, 156, 0.03);
  display: flex;
  flex-direction: column;
  max-height: 700px;
  overflow: hidden;
}

.history-column-header {
  padding: 18px 20px;
  border-bottom: 1.5px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--wash);
}

.history-column-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
  font-weight: 900;
}

.column-count {
  font-size: 12px;
  font-weight: 900;
  background: var(--blue-light);
  color: var(--blue-dark);
  padding: 4px 10px;
  border-radius: 12px;
}

.history-list {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Nav Button highlighting in header topbar */
.nav-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 850;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--blue);
  background: var(--soft);
}

.nav-btn.is-active {
  color: #ffffff !important;
  background: var(--blue) !important;
  border-color: var(--blue) !important;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* History Card styling */
.history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--paper);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.history-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(21, 91, 215, 0.08);
}
.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.history-card-date {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.history-card-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--blue-dark);
  background: var(--blue-light);
}
.history-card-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-card-snippet {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Delete button inside card */
.history-card-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  font-size: 14px;
  transition: color 0.2s;
}
.history-card-delete:hover {
  color: var(--red);
}

/* Keyframes */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Modal Overlay & Card Styling for My Page */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 990;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  transition: opacity 0.25s ease;
}

.modal-overlay.is-hidden {
  display: none !important;
}

.modal-card {
  width: min(100%, 460px);
  padding: 30px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.modal-title {
  margin: 0;
  font-size: 20px;
  color: var(--ink);
  font-weight: 900;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.modal-close:hover {
  color: var(--ink);
}

.mypage-btn {
  background: var(--soft);
  color: var(--blue);
  border: 1px solid transparent;
  padding: 8px 14px;
  font-weight: 800;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.mypage-btn:hover {
  background: var(--blue);
  color: #ffffff;
}

/* Integrated Tutor Materials Box */
.tutor-materials-box {
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.01);
}

.tutor-materials-box .material-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: auto;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.tutor-materials-box .material-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.tutor-materials-box .material-item strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.tutor-materials-box .material-item span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}

.tutor-materials-box .delete-material {
  min-height: auto;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  background: #fff0f0;
  border: 1px solid rgba(235, 87, 87, 0.2);
  color: var(--red);
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}

.tutor-materials-box .delete-material:hover {
  background: #ffe5e5;
  border-color: var(--red);
}

/* API Onboarding Guide Styles */
.api-guide-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 6px;
}

.api-guide-box::-webkit-scrollbar {
  width: 6px;
}
.api-guide-box::-webkit-scrollbar-track {
  background: transparent;
}
.api-guide-box::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

.api-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f8f9fa;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  text-align: left;
}

.api-guide-step .step-num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  flex-shrink: 0;
  margin-top: 1px;
}

.api-guide-step p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  font-weight: 700;
}

.api-link {
  color: var(--blue);
  text-decoration: underline;
  font-weight: 900;
}
.api-link:hover {
  color: var(--blue-dark);
}

