* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #fff8fc 0%, #f8f4fb 100%);
  color: #3d2445;
}

.file-proto-banner {
  margin: 0;
  padding: 14px 40px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #4a1f24;
  background: #fff0f1;
  border-bottom: 2px solid #e8a8b0;
}

.file-proto-banner strong {
  color: #3d1218;
}

.file-proto-banner-actions {
  display: block;
  margin-top: 8px;
  font-weight: 600;
  color: #5c3038;
}

.file-proto-banner code {
  font-size: 0.82rem;
  padding: 2px 7px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e8ccd0;
  word-break: break-all;
}

.file-proto-banner-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.file-proto-copy-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  background: linear-gradient(90deg, #d96aa7, #b36ae2);
  color: #fff;
}

.file-proto-copy-btn:hover {
  filter: brightness(1.05);
}

.file-proto-copy-hint {
  font-size: 0.82rem;
  font-weight: 600;
  color: #3d6b45;
  max-width: 100%;
}

.file-proto-copy-hint code {
  font-size: 0.78rem;
}

@media (max-width: 640px) {
  .file-proto-banner {
    padding: 12px 16px;
    font-size: 0.85rem;
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 40px;
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid #edddea;
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
}

.brand {
  font-size: 1.3rem;
  font-weight: 700;
  color: #6b2e62;
}

.nav {
  display: flex;
  gap: 22px;
}

.nav a {
  text-decoration: none;
  color: #5e4a63;
  font-weight: 600;
}

.nav a:hover {
  color: #b14f8b;
}

.page {
  max-width: 1300px;
  margin: 0 auto;
  padding: 30px 24px 50px;
}

.hero {
  margin-bottom: 26px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 2.3rem;
  color: #58284f;
}

.hero p {
  margin: 0;
  font-size: 1rem;
  color: #6f6273;
}

/* —— Home landing (index.html) —— */
.home-page .home-hero h1 {
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  line-height: 1.15;
}

.home-lead {
  margin: 0 0 22px !important;
  font-size: 1.05rem !important;
  line-height: 1.65 !important;
  max-width: 52rem;
  color: #5c4d66 !important;
}

.home-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

a.home-cta,
a.home-cta-secondary {
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

a.home-cta:hover,
a.home-cta-secondary:hover {
  transform: translateY(-2px);
}

.home-section {
  margin-top: 42px;
}

.home-section-title {
  margin: 0 0 10px;
  font-size: 1.45rem;
  color: #58284f;
}

.home-section-lead {
  margin: 0 0 20px;
  max-width: 48rem;
  font-size: 0.98rem;
  line-height: 1.55;
  color: #6f6273;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.home-feature-card {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.home-feature-card .card-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: #5a2a50;
}

.home-feature-card p {
  margin: 0 0 14px;
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #654f69;
}

.home-card-link {
  font-weight: 800;
  font-size: 0.92rem;
  color: #7b2f61;
  text-decoration: none;
}

.home-card-link:hover {
  text-decoration: underline;
}

.home-external-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.home-external-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  background: #fcf9fd;
  border: 1px solid #ead9e7;
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.home-external-card:hover {
  transform: translateY(-3px);
  border-color: #d96aa7;
  box-shadow: 0 10px 26px rgba(95, 64, 92, 0.12);
}

.home-external-name {
  font-weight: 800;
  font-size: 1rem;
  color: #522548;
}

.home-external-desc {
  font-size: 0.86rem;
  line-height: 1.45;
  color: #7a6b82;
}

.home-footnote {
  margin-top: 36px;
  padding: 18px 20px;
  background: #f8f4fc;
  border-color: #e5d8ef;
}

.home-footnote-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #5a4a62;
}

.home-footnote-text code {
  font-size: 0.8rem;
  padding: 2px 6px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #ead9e7;
}

.analysis-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 24px;
  align-items: start;
}

.card {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 14px 32px rgba(95, 64, 92, 0.12);
  padding: 20px;
  border: 1px solid #f0e3ef;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.card-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #522548;
}

.pill {
  background: #f6d6ea;
  color: #7b2f61;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.pill.soft {
  background: #eee7f7;
  color: #5a4385;
}

.board {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 18px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  background: #f0edf5;
  color: #4d3753;
  transition: transform 0.15s ease, background 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  background: #e8dff0;
}

.primary-btn {
  background: linear-gradient(90deg, #d96aa7, #b36ae2);
  color: white;
}

.primary-btn:hover {
  background: linear-gradient(90deg, #cf5f9e, #a65fd5);
}

.ghost-btn {
  background: transparent;
  border: 2px solid #e0d4e8;
  color: #6a4c68;
}

.ghost-btn:hover {
  background: #fcf9fd;
  border-color: #d96aa7;
}

/* Links styled as buttons (home CTAs) — same pill shape as <button> */
a.primary-btn,
a.ghost-btn {
  box-sizing: border-box;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.meta-box {
  display: grid;
  gap: 8px;
}

.meta-box label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #6a4c68;
}

.meta-box input,
.meta-box textarea {
  width: 100%;
  border: 1px solid #ead9e7;
  border-radius: 14px;
  padding: 12px;
  font-size: 0.95rem;
  background: #fcf9fd;
  color: #47314f;
  resize: vertical;
}

.side-panel {
  display: grid;
  gap: 14px;
}

.info-block {
  background: #fcf9fd;
  border: 1px solid #f1e4ef;
  border-radius: 18px;
  padding: 16px;
}

.info-block h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #5a2a50;
}

.info-block p {
  margin: 0;
  line-height: 1.55;
  color: #654f69;
}

#whyText {
  white-space: pre-line;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  background: #f7e8c8;
  color: #7a5a17;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
}

/* —— Stockfish mini panel (Analyze + Learn) —— */
.sf-mini {
  margin-top: 6px;
  padding: 14px 16px;
  background: linear-gradient(165deg, #f8f2fc 0%, #eef6fb 100%);
  border: 1px solid #e2d4ec;
  border-radius: 16px;
}

.sf-mini-learn {
  margin-top: 18px;
}

.sf-file-warning {
  margin: 0 0 12px;
  padding: 12px 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #5c2d32;
  background: #fdecef;
  border: 1px solid #f0b4bc;
  border-radius: 12px;
}

.sf-file-warning code {
  font-size: 0.78rem;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  word-break: break-all;
}

.sf-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.sf-mini-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #4a2750;
}

.sf-mini-note {
  margin: 0 0 12px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #6f5f78;
}

.sf-mini-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.sf-depth-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #522548;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sf-depth-label select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e0d4e8;
  background: #fff;
  font-weight: 700;
  color: #42253d;
}

.sf-analyze-btn {
  padding: 10px 16px !important;
  font-size: 0.88rem !important;
}

.sf-mini-dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 0.86rem;
}

.sf-mini-dl dt {
  margin: 0;
  font-weight: 700;
  color: #6a4c68;
}

.sf-mini-dl dd {
  margin: 0;
  font-weight: 600;
  color: #2d2433;
  word-break: break-word;
}

.sf-status {
  margin: 10px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #8a7194;
  min-height: 1.2em;
}

@media (max-width: 1000px) {
  .analysis-layout {
    grid-template-columns: 1fr;
  }

  .board {
    max-width: 100%;
  }
}

@media (max-width: 700px) {
  .topbar {
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero h1 {
    font-size: 1.8rem;
  }
}

/* —— Learn page (subpagel.html) —— */
.brand-link {
  text-decoration: none;
  color: inherit;
}

.nav a[aria-current="page"] {
  color: #b14f8b;
  font-weight: 800;
}

.learn-page .learn-lead {
  margin: 0 0 18px;
  color: #6f6273;
  line-height: 1.5;
  font-size: 0.98rem;
}

.level-tracker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.level-pill {
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  border: 1px solid #ead9e7;
  background: #fcf9fd;
  color: #6a4c68;
}

.level-pill-active {
  background: #f6d6ea;
  color: #7b2f61;
  border-color: #e8c4dc;
}

.level-pill-locked {
  opacity: 0.55;
  font-weight: 600;
}

.learn-section {
  margin-bottom: 24px;
}

.learn-section-hidden {
  display: none;
}

.learn-subhead {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid #f1e4ef;
}

.video-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.video-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fcf9fd;
  border: 1px solid #f1e4ef;
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(95, 64, 92, 0.14);
}

.video-card:focus-visible {
  outline: 2px solid #d96aa7;
  outline-offset: 3px;
}

.video-card-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #2d1f33;
}

.video-card-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #5a2a50 0%, #7b3d8a 45%, #b36ae2 100%);
}

.video-card-placeholder-icon {
  font-size: 3rem;
  opacity: 0.9;
}

.video-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.video-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.video-card-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: #522548;
  line-height: 1.35;
}

.video-card-channel {
  font-size: 0.85rem;
  color: #8a7194;
  font-weight: 600;
}

.lichess-frame-wrap {
  position: relative;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid #ead9e7;
  background: #261c2e;
  min-height: 520px;
}

.lichess-frame-wrap iframe {
  display: block;
  width: 100%;
  min-height: 560px;
  height: 70vh;
  max-height: 720px;
  border: 0;
}

.unlock-panel {
  margin-top: 22px;
  padding: 18px;
  background: #fcf9fd;
  border: 1px solid #f1e4ef;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.unlock-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #47314f;
  line-height: 1.45;
  font-weight: 600;
}

.unlock-check input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: #b36ae2;
  flex-shrink: 0;
}

.unlock-panel-done {
  background: #f0faf4;
  border-color: #c5e6d4;
}

.learn-done-msg {
  margin: 0;
  color: #3d5c4a;
  line-height: 1.55;
  font-size: 0.95rem;
}

.learn-done-msg a {
  color: #7b2f61;
  font-weight: 700;
}

.level-pill-done {
  background: #e8f5ec;
  color: #2d6a45;
  border-color: #b8dfc8;
  font-weight: 700;
}

.puzzle-trainer-card .learn-lead {
  margin-bottom: 14px;
}

.learn-board-wrap {
  max-width: 520px;
  margin: 0 auto 14px;
}

.learn-board {
  width: 100%;
}

.learn-board-disabled {
  opacity: 0.85;
  pointer-events: none;
}

.puzzle-feedback {
  min-height: 1.4em;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #3d7a4a;
  text-align: center;
}

.puzzle-feedback-error {
  color: #9b2d4a;
}

.learn-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

@media (max-width: 960px) {
  .learn-split {
    grid-template-columns: 1fr;
  }
}

.learn-gallery-card {
  margin-bottom: 0;
}

.learn-gallery-scroll {
  max-height: min(72vh, 640px);
  overflow-y: auto;
  padding-right: 6px;
  align-content: start;
}

.puzzle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 16px 0 8px;
}

.learn-choice-wrap {
  margin: 12px 0 16px;
}

.learn-choice-wrap[hidden] {
  display: none !important;
}

.learn-choice-lead {
  margin: 0 0 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #522548;
}

.learn-choice-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.learn-choice-btn {
  width: 100%;
  text-align: left;
  border-radius: 14px !important;
  padding: 14px 16px !important;
  background: #fcf9fd;
  border: 2px solid #ead9e7 !important;
  color: #42253d;
  font-weight: 700;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.learn-choice-btn:hover {
  border-color: #d96aa7 !important;
  background: #fff;
}

.learn-choice-btn.is-selected {
  border-color: #b36ae2 !important;
  background: #f6e8fb;
  box-shadow: 0 0 0 1px rgba(179, 106, 226, 0.35);
}

/* —— Saved games / archive (subpagea.html) —— */
.archive-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .archive-layout {
    grid-template-columns: 1fr;
  }
}

.file-drop-wrap {
  position: relative;
  margin-bottom: 18px;
}

.file-input-screen-reader {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-drop {
  display: block;
  padding: 28px 20px;
  border: 2px dashed #d4c2d8;
  border-radius: 18px;
  background: #fcf9fd;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.file-drop:hover,
.file-drop-hover {
  border-color: #b36ae2;
  background: #f5effa;
}

.file-drop-label {
  font-weight: 700;
  color: #5a2a50;
}

.archive-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #6a4c68;
  margin-bottom: 8px;
}

.archive-textarea {
  width: 100%;
  border: 1px solid #ead9e7;
  border-radius: 14px;
  padding: 12px;
  font-size: 0.9rem;
  font-family: ui-monospace, monospace;
  background: #fcf9fd;
  color: #47314f;
  margin-bottom: 12px;
  resize: vertical;
}

.archive-divider {
  height: 1px;
  background: #f1e4ef;
  margin: 22px 0;
}

.color-pick {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  font-weight: 600;
  color: #47314f;
}

.color-pick label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.archive-scan-btn {
  width: 100%;
  margin-top: 4px;
}

.archive-note {
  margin: 12px 0 0;
  font-size: 0.88rem;
  color: #7a6585;
  min-height: 1.2em;
}

.archive-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.archive-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #f1e4ef;
  border-radius: 14px;
  margin-bottom: 8px;
  background: #fcf9fd;
}

.archive-item-title {
  font-weight: 700;
  color: #522548;
  font-size: 0.92rem;
}

.archive-item-meta {
  font-size: 0.8rem;
  color: #8a7194;
}

.archive-item-remove {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  padding: 0;
  line-height: 1;
  font-size: 1.2rem;
  background: #f5e8ec;
  color: #8b3a52;
}

.archive-item-remove:hover {
  background: #edd5dc;
}

.archive-item-empty {
  display: block;
  text-align: center;
  color: #8a7194;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: default;
  padding: 16px;
}

.archive-library-hint {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #6f6273;
}

.archive-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.archive-item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.archive-item-main {
  min-width: 0;
}

.archive-item-colors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-top: 4px;
  border-top: 1px solid #f1e4ef;
}

.archive-color-heading {
  font-size: 0.82rem;
  font-weight: 700;
  color: #6a4c68;
  margin-right: 4px;
}

.archive-color-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #47314f;
  cursor: pointer;
}

.archive-color-opt input {
  width: 16px;
  height: 16px;
  accent-color: #b36ae2;
  margin: 0;
}

.archive-clear {
  background: transparent;
  color: #8b3a52;
  text-decoration: underline;
  font-size: 0.9rem;
  padding: 8px 0;
}

.archive-clear:hover {
  transform: none;
  background: transparent;
}

.report-blocks {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.report-block {
  background: #fcf9fd;
  border: 1px solid #f1e4ef;
  border-radius: 18px;
  padding: 18px 20px;
}

.report-block h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: #522548;
}

.report-block-body {
  margin: 0;
  line-height: 1.6;
  color: #654f69;
  font-size: 0.95rem;
}

.archive-page .hero a {
  color: #7b2f61;
  font-weight: 700;
}

/* —— Puzzle scanner (puzzle-scanner.html) —— */
.scanner-page .hero {
  margin-bottom: 28px;
}

.scanner-page .learn-lead {
  margin: 0 0 18px;
  color: #6f6273;
  line-height: 1.5;
  font-size: 0.98rem;
}

.scanner-tf-root {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.scanner-vision-status {
  margin: 12px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  color: #6a5575;
  min-height: 2.8em;
}

.scanner-side-select {
  width: 100%;
  max-width: 280px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid #e5d4e8;
  font-size: 0.95rem;
  font-weight: 600;
  color: #3d2445;
  background: #fff;
  cursor: pointer;
}

.scanner-side-select:focus {
  outline: 2px solid #d96aa7;
  outline-offset: 2px;
}

.scanner-disclaimer {
  margin: 18px 0 0;
  padding: 14px 18px;
  background: #faf5fc;
  border: 1px solid #ead8f0;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #5c4860;
}

.scanner-disclaimer-warn {
  background: #fff8f0;
  border-color: #f0d4b8;
  color: #5c4030;
}

.scanner-disclaimer-warn strong {
  color: #3d2818;
}

.scanner-paste-first {
  margin: 0 0 16px;
  padding: 14px 18px;
  background: #f0faf3;
  border: 1px solid #c5e6d1;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #2d4a38;
}

.scanner-paste-first strong {
  color: #1e3d2c;
}

.scanner-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.scanner-card.scanner-card-wide {
  grid-column: 1 / -1;
}

.scanner-drop-wrap {
  margin-bottom: 14px;
}

.scanner-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.scanner-file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  background: linear-gradient(90deg, #d96aa7, #b36ae2);
  color: #fff;
  border: none;
  box-shadow: 0 6px 18px rgba(179, 106, 226, 0.35);
}

.scanner-file-label:hover {
  filter: brightness(1.06);
}

.scanner-image-preview-wrap,
.scanner-video-preview-wrap {
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #f0e3ef;
  background: #fcf9fd;
}

.scanner-image-preview {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.scanner-video-preview {
  display: block;
  width: 100%;
  max-height: 360px;
  background: #1a1220;
}

.scanner-label {
  display: block;
  margin: 16px 0 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #5a3f58;
}

.scanner-label:first-of-type {
  margin-top: 0;
}

.scanner-fen-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e5d4e8;
  font-size: 0.95rem;
  font-family: ui-monospace, monospace;
  color: #3d2445;
  background: #fff;
}

.scanner-fen-input:focus {
  outline: 2px solid #d96aa7;
  outline-offset: 2px;
}

.scanner-fen-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e5d4e8;
  font-size: 0.9rem;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #3d2445;
  background: #fff;
  resize: vertical;
  min-height: 4.5rem;
  word-break: break-all;
}

.scanner-fen-textarea:focus {
  outline: 2px solid #d96aa7;
  outline-offset: 2px;
}

.scanner-mic-row .ghost-btn {
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.scanner-alt-steps {
  margin: 0;
  padding-left: 1.35rem;
  line-height: 1.6;
  color: #554060;
  font-size: 0.95rem;
}

.scanner-alt-steps li {
  margin-bottom: 14px;
}

.scanner-alt-steps li:last-child {
  margin-bottom: 0;
}

.scanner-alt-steps a {
  color: #7b2f61;
  font-weight: 700;
}

.scanner-alt-steps a:hover {
  color: #b14f8b;
}

.scanner-alt-foot {
  margin: 16px 0 0;
  font-size: 0.82rem;
  color: #8a7194;
  line-height: 1.45;
}

.scanner-chat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.scanner-chat-include {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #554060;
  cursor: pointer;
}

.scanner-chat-include input {
  width: 18px;
  height: 18px;
  accent-color: #b36ae2;
}

.scanner-chat-log {
  min-height: 200px;
  max-height: 420px;
  overflow-y: auto;
  padding: 14px 16px;
  background: #faf7fc;
  border: 1px solid #ebe0ef;
  border-radius: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scanner-chat-msg {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.scanner-chat-msg.system {
  align-self: center;
  max-width: 100%;
  background: #f0ede8;
  color: #5c5348;
  font-size: 0.86rem;
  text-align: center;
}

.scanner-chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #e8d4f2, #dcc9f5);
  color: #3d2445;
}

.scanner-chat-msg.model {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #ebe0ef;
  color: #3d2445;
}

.scanner-chat-msg.error {
  align-self: stretch;
  background: #fff0f1;
  border: 1px solid #f0c4c8;
  color: #6b2830;
}

.scanner-chat-compose {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.scanner-chat-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #e5d4e8;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #3d2445;
  resize: vertical;
  min-height: 72px;
  font-family: inherit;
}

.scanner-chat-input:focus {
  outline: 2px solid #d96aa7;
  outline-offset: 2px;
}

.scanner-chat-compose .primary-btn {
  flex: 0 0 auto;
  padding: 12px 22px;
}

.scanner-chat-gpt-note {
  margin: 14px 0 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: #6f6273;
}

.scanner-chat-gpt-note a {
  color: #7b2f61;
  font-weight: 700;
}

.scanner-transcript {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #e5d4e8;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #3d2445;
  background: #fff;
  resize: vertical;
  min-height: 160px;
}

.scanner-transcript:focus {
  outline: 2px solid #d96aa7;
  outline-offset: 2px;
}

.scanner-mic-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 14px 0 8px;
}

.scanner-mic-status {
  font-size: 0.88rem;
  font-weight: 600;
  color: #7b5f86;
}

.scanner-run-hint {
  margin: 12px 0 0;
  min-height: 1.3em;
  font-size: 0.9rem;
  font-weight: 600;
  color: #8b3a52;
}

.scanner-results {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #f1e4ef;
}

.scanner-results-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: #522548;
}

.scanner-result-block {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: #fcf9fd;
  border-radius: 14px;
  border: 1px solid #f1e4ef;
}

.scanner-result-block:last-child {
  margin-bottom: 0;
}

.scanner-result-block h4 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8a7194;
}

.scanner-result-block p {
  margin: 0;
  line-height: 1.55;
  color: #554060;
  font-size: 0.95rem;
}

.scanner-reasoning-echo {
  font-style: italic;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .scanner-layout {
    grid-template-columns: 1fr;
  }

  .scanner-card.scanner-card-wide {
    grid-column: auto;
  }
}