:root {
  --ink: #17233c;
  --muted: #65708a;
  --paper: #f6f8fc;
  --white: #ffffff;
  --blue: #1f5eff;
  --blue-soft: #e9efff;
  --coral: #ff6b55;
  --line: #d9dfeb;
  --success: #16794b;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(28, 45, 82, 0.13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(31, 94, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 94, 255, .055) 1px, transparent 1px);
  background-size: 28px 28px;
  font-family: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--blue); text-underline-offset: 3px; }

.site-header,
footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header { height: 86px; }

.brand {
  color: var(--ink);
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -.03em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--blue);
  border-radius: 8px 2px 8px 2px;
  font-size: 22px;
}

.status {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .76);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.status i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #28b875;
  box-shadow: 0 0 0 3px rgba(40, 184, 117, .14);
}

main {
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 160px);
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 30px 0 70px;
}

.auth-shell {
  display: grid;
  grid-template-columns: .92fr 1.08fr;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.lesson-panel {
  position: relative;
  overflow: hidden;
  min-height: 600px;
  padding: 68px 58px;
  color: white;
  background: var(--blue);
}

.lesson-panel::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -110px;
  width: 330px;
  height: 330px;
  border: 50px solid rgba(255, 255, 255, .1);
  border-radius: 50%;
}

.eyebrow,
.query-tag {
  font: 800 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.lesson-panel .eyebrow { color: #cdd9ff; }

.lesson-panel h1,
.profile-header h1 {
  margin: 26px 0 46px;
  font-family: "Iowan Old Style", "Songti SC", "STSong", serif;
  font-size: clamp(42px, 5vw, 67px);
  line-height: 1.07;
  letter-spacing: -.055em;
}

.lesson-panel h1 em {
  color: #ffcf5c;
  font-style: normal;
}

.trace {
  position: relative;
  z-index: 1;
  padding: 0;
  margin: 0;
  list-style: none;
}

.trace li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 17px 0;
  border-top: 1px solid rgba(255,255,255,.26);
}

.trace b { font-size: 14px; }
.trace span { color: #cfdaff; font-size: 13px; }

.code-note {
  position: relative;
  z-index: 1;
  display: grid;
  width: fit-content;
  padding: 22px 26px;
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(8, 31, 102, .28);
  color: #d9e2ff;
  font: 14px/1.8 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.code-note strong { color: #ffcf5c; }

.form-panel { padding: 62px clamp(36px, 6vw, 82px); }
.form-heading { margin-bottom: 34px; }
.query-tag { color: var(--coral); }
.form-heading h2 { margin: 12px 0 8px; font-size: 32px; letter-spacing: -.04em; }
.form-heading p { margin: 0; color: var(--muted); line-height: 1.6; }

.field { margin-bottom: 19px; }
.field label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 750; }
.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: #fbfcff;
  font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.input:focus {
  border-color: var(--blue);
  background: white;
  box-shadow: 0 0 0 4px rgba(31,94,255,.11);
}

.input-error { border-color: var(--danger); }
.field-errors { margin: 7px 0 0; padding: 0; color: var(--danger); font-size: 12px; list-style: none; }

.button {
  width: 100%;
  min-height: 49px;
  margin-top: 5px;
  border: 0;
  border-radius: 10px;
  color: white;
  background: var(--blue);
  box-shadow: 0 8px 20px rgba(31, 94, 255, .22);
  cursor: pointer;
  font: 750 15px/1 inherit;
  transition: transform .15s, box-shadow .15s, background .15s;
}

.button:hover { background: #174ee0; transform: translateY(-1px); box-shadow: 0 11px 24px rgba(31,94,255,.27); }
.button:focus-visible, a:focus-visible { outline: 3px solid #ffb800; outline-offset: 3px; }
.form-switch { margin: 22px 0 0; color: var(--muted); text-align: center; font-size: 13px; }

.flash-stack { position: fixed; z-index: 10; top: 76px; left: 50%; width: min(460px, calc(100% - 32px)); transform: translateX(-50%); }
.flash { margin-top: 8px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 10px 28px rgba(23,35,60,.12); font-size: 14px; }
.flash-success { border-left: 4px solid var(--success); }
.flash-error { border-left: 4px solid var(--danger); }
.flash-info { border-left: 4px solid var(--blue); }

.profile-shell { padding: clamp(30px, 6vw, 70px); border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: var(--shadow); }
.profile-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 40px; border-bottom: 1px solid var(--line); }
.profile-header .eyebrow { color: var(--coral); }
.profile-header h1 { margin: 12px 0; font-size: clamp(38px, 5vw, 64px); }
.profile-header p { margin: 0; color: var(--muted); }
.profile-header form { min-width: 130px; }
.button-secondary { color: var(--blue); background: var(--blue-soft); box-shadow: none; }
.button-secondary:hover { color: white; }

.record-card { display: grid; grid-template-columns: 130px 1fr; margin: 40px 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.record-index { display: grid; place-items: center; color: white; background: var(--blue); font: 800 30px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.record-card dl { margin: 0; }
.record-card dl > div { display: grid; grid-template-columns: 140px 1fr; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.record-card dl > div:last-child { border-bottom: 0; }
.record-card dt { color: var(--muted); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.record-card dd { margin: 0; word-break: break-word; }
.hash { color: var(--success); }
.next-step { display: flex; align-items: center; gap: 18px; padding: 18px 20px; border-radius: 12px; background: #f0f4ff; }
.next-step span { flex: 0 0 auto; font-size: 13px; font-weight: 750; }
.next-step code { overflow-x: auto; color: var(--blue); font-size: 12px; white-space: nowrap; }

.message-shell {
  width: min(620px, 100%);
  margin: auto;
  padding: clamp(38px, 8vw, 76px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: white;
  box-shadow: var(--shadow);
  text-align: center;
}
.message-shell .eyebrow { color: var(--coral); }
.message-shell h1 { margin: 16px 0 10px; font-size: clamp(36px, 7vw, 58px); }
.message-shell p:not(.eyebrow) { margin: 0 0 30px; color: var(--muted); }
.button-link { display: inline-grid; width: auto; min-width: 160px; place-items: center; text-decoration: none; }

footer { height: 74px; color: var(--muted); font-size: 11px; }

@media (max-width: 760px) {
  .site-header, footer, main { width: min(100% - 24px, 560px); }
  .status { display: none; }
  main { padding-top: 4px; }
  .auth-shell { grid-template-columns: 1fr; border-radius: 18px; }
  .lesson-panel { min-height: auto; padding: 38px 30px; }
  .lesson-panel h1 { margin: 18px 0 28px; font-size: 43px; }
  .trace { display: none; }
  .code-note { font-size: 12px; }
  .form-panel { padding: 38px 28px; }
  .profile-shell { padding: 30px 22px; }
  .profile-header { align-items: stretch; flex-direction: column; }
  .record-card { grid-template-columns: 1fr; }
  .record-index { min-height: 80px; }
  .record-card dl > div { grid-template-columns: 1fr; gap: 6px; }
  .next-step { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
