/* FIRE UP KEEP — load after styles.css and account.css.
   Screen-only refinements leave the existing print document unchanged. */
@media screen {
  :root {
    --ink: #19352d;
    --muted: #53675d;
    --green: #234b41;
    --orange: #ed592b;
    --line: #d9e2dd;
    --pale: #edf3ef;
    --paper: #f6f8f7;
    --radius: 16px;
    --keep-accent-text: #a83b18;
    --keep-focus: #234b41;
    --keep-error: #a12f20;
    font-size: 100%;
  }

  body { line-height: 1.65; }
  button, input, select, textarea { font: inherit; }
  button, .button, .text-button, .subtle-action {
    min-height: 44px;
    font-size: .875rem;
    line-height: 1.5;
  }
  a, button, input, select, textarea, summary {
    scroll-margin-block: 24px 112px;
  }
  button, .button { overflow-wrap: anywhere; }
  button:disabled { opacity: .65; }
  :is(button, a, input, select, textarea, summary):focus-visible,
  .choice input:focus-visible + span {
    outline: 3px solid var(--keep-focus);
    outline-offset: 3px;
  }
  .button.primary:focus-visible,
  .species-shortcuts button[aria-pressed="true"]:focus-visible {
    outline-color: var(--keep-accent-text);
  }

  /* Common reading hierarchy, independent of the viewport. */
  .page-intro h1, .home-heading h1 {
    font-size: clamp(1.75rem, 2.6vw, 2.5rem);
    line-height: 1.35;
    letter-spacing: -.045em;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }
  .page-intro p, .home-heading p, .section-description,
  .first-animal p, .species-heading > span,
  .registration-aside > p, .account-panel p,
  .help-card p, .help-card li, .help-card details p {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--muted);
  }
  .eyebrow, .home-heading .eyebrow, .topbar-label, .workspace-label,
  .brand-sub, .sidebar-note p, .sidebar-bottom a,
  .sidebar-bottom small, .site-footer,
  .privacy-pill, .selected-tag, .optional,
  .species-search-hint, .species-match-status,
  .species-photo-note > span, .species-photo-note .text-button,
  .species-option-text i, .species-option-text > span,
  .chosen-species i, .species-photo > span,
  .saved-species-photo span, .photo-credit,
  .animal-badge, .animal-scientific, .last-action, .last-action span,
  .inventory-tabs b, .inventory-footnote p,
  .field-help, .field-error, .small-notice, .save-note,
  .registration-aside > small, .handoff-tag,
  .official-path, .copy-row, .copy-row strong, .official-tools,
  .preview-top > span, .message-card-header small,
  .animal-summary .scientific, .animal-summary .meta,
  .mini-task, .preview-footer, .preview-caption,
  .record-date, .record-title > span {
    font-size: .875rem;
    line-height: 1.65;
  }
  .eyebrow { color: var(--keep-accent-text); letter-spacing: .08em; }
  .topbar-label { color: var(--muted); letter-spacing: .06em; }
  .workspace-label, .brand-sub, .sidebar-bottom a,
  .sidebar-bottom small, .site-footer, .sidebar-note p,
  .optional, .species-heading > span, .species-search-hint,
  .species-photo-note > span, .species-photo-note .text-button,
  .species-option-text i, .species-option-text > span,
  .animal-species, .animal-scientific, .last-action, .last-action span,
  .inventory-footnote, .inventory-footnote strong,
  .field-help, .registration-aside > small, .save-note,
  .official-path, .preview-footer, .preview-caption,
  .message-card-header small, .animal-summary .scientific,
  .animal-summary .meta, .mini-task, .record-date,
  .animal-manage summary, .storage-tools summary, .storage-tools p {
    color: var(--muted);
  }
  .home-heading h1 em, .text-button { color: var(--keep-accent-text); }
  .text-button:hover { color: #7e2a10; }
  .field-error, .account-panel .field-error { color: var(--keep-error); }

  /* A quiet frame lets names and reference photographs lead. */
  .topbar { min-height: 72px; height: auto; padding-block: 12px; }
  .topbar > div { min-width: 0; }
  .quiet-button { color: var(--muted); flex-shrink: 0; }
  main { max-width: 1340px; padding-top: 28px; }
  .page-intro, .home-heading { gap: 20px; margin-bottom: 24px; }
  .page-intro { flex-wrap: wrap; }
  .page-intro > div, .home-heading > div { min-width: 0; }
  .home-heading { padding: 4px 0 0; }
  .home-heading > .button { min-height: 48px; }
  .home-heading p { margin-top: 8px; }
  .home-heading.compact h1 { font-size: clamp(1.5rem, 2vw, 2rem); }
  .home-heading.compact { padding-block: 0; margin-bottom: 20px; }
  .keep-brand-label {
    font-size: .875rem;
    line-height: 1.4;
    letter-spacing: .08em;
    font-weight: 800;
    color: var(--green);
    margin-left: 8px;
  }
  .brand-sub.keep-brand-label {
    display: block;
    position: static;
    margin: 6px 0 0;
    letter-spacing: .02em;
    font-weight: 600;
    color: var(--muted);
  }
  .storage-indicator {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccdcd2;
    border-radius: 10px;
    background: #edf4ef;
    color: #42634e;
    font-size: .875rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
  }
  .storage-indicator svg { width: 18px; height: 18px; flex-shrink: 0; }
  .draft-resume {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: #edf4ef;
    border: 1px solid #ccdcd2;
    border-radius: 12px;
  }
  .draft-resume > div { min-width: 0; flex: 1 1 180px; }
  .draft-resume strong { font-size: 1rem; color: var(--ink); }
  .draft-resume p { font-size: .875rem; color: var(--muted); margin-top: 4px; }
  .draft-resume .button { flex-shrink: 0; }
  .registration-progress {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-bottom: 20px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: .875rem;
    line-height: 1.65;
    color: var(--muted);
  }
  .registration-progress span { display: inline-flex; align-items: center; gap: 6px; }
  .registration-progress [aria-current="step"],
  .registration-progress .current { color: var(--green); font-weight: 700; }
  .save-status {
    font-size: .875rem;
    line-height: 1.65;
    color: var(--muted);
    overflow-wrap: anywhere;
  }
  .save-status:not(:empty) { padding-block: 8px; }
  .save-status.error, .save-status[data-state="error"] { color: var(--keep-error); }
  .primary-nav a { min-height: 48px; font-size: 1rem; }
  .primary-nav a.active { background: #e8f1eb; color: var(--green); }
  .sidebar-note { background: var(--paper); }
  .count { color: var(--green); font-size: .875rem; }
  .flow-strip { padding-block: 12px; gap: 12px 24px; margin-bottom: 24px; }
  .flow-strip span { color: var(--muted); }
  .panel, .animal-card, .help-card { box-shadow: none; border-color: var(--line); }
  .form-body, .account-panel, .help-card { padding: 24px; }
  .section-heading h2, .species-heading h2,
  .help-card h2, .account-panel h2 {
    font-size: 1.25rem;
    line-height: 1.5;
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
  }

  /* Registration keeps visible labels, explicit selection, and error text. */
  .species-grid { gap: 16px; }
  .species-option { border-color: #cddbd2; border-radius: 12px; }
  .species-option:hover { border-color: var(--green); box-shadow: 0 3px 12px #19352d0d; }
  .species-option-text { padding: 12px; gap: 5px; }
  .species-option-text strong { font-size: 1rem; line-height: 1.5; }
  .species-photo > span, .saved-species-photo span {
    color: #fff;
    background: #19352df2;
    padding: 3px 8px;
  }
  .species-shortcuts { gap: 8px; }
  .species-shortcuts button { padding: 9px 13px; color: var(--green); }
  .species-shortcuts button[aria-pressed="true"] { color: #fff; }
  .species-shortcuts button span { font-size: .875rem; opacity: 1; }
  .species-photo-note { align-items: flex-start; gap: 8px 16px; }
  .species-photo-note .text-button { padding-block: 8px; }
  .chosen-species { padding: 16px; gap: 16px; background: #edf4ef; }
  .chosen-species strong { font-size: 1.125rem; line-height: 1.5; }
  .chosen-species .text-button { min-width: 44px; padding-inline: 8px; }
  .chosen-species i, .selected-tag { color: #42634e; }
  .field { margin-bottom: 24px; }
  .field > label, .field-label, fieldset legend, .manual-species label {
    font-size: .875rem;
    line-height: 1.6;
  }
  .field input, .field select, .species-search-box input,
  .manual-species input, .animal-search input, .message-text {
    font-size: 1rem;
    min-height: 48px;
    border-color: #81988b;
    border-radius: 10px;
    background-color: #fff;
  }
  .message-text { min-height: 18rem; line-height: 1.75; }
  .field input::placeholder, .species-search-box input::placeholder,
  .manual-species input::placeholder, .animal-search input::placeholder {
    color: #5e7066;
    font-size: 1rem;
    opacity: 1;
  }
  .field input[readonly] { color: var(--muted); background: #f1f5f2; }
  .field input:focus, .field select:focus, .species-search-box input:focus {
    border-color: var(--green);
    outline: 3px solid var(--green);
    outline-offset: 2px;
  }
  .field [aria-invalid="true"], .manual-species [aria-invalid="true"],
  .species-search-box [aria-invalid="true"] { border-color: var(--keep-error); }
  .field-help { margin-top: 8px; }
  .registration-extra summary, .animal-manage summary,
  .storage-tools summary, .help-card summary {
    min-height: 44px;
    padding-block: 10px;
    line-height: 1.7;
    font-size: .875rem;
  }
  .registration-extra summary { margin-bottom: 12px; }
  .save-note { background: var(--paper); padding: 14px 16px; }
  .form-actions { gap: 12px; padding: 20px 24px; background: #fff; }
  .form-actions > *, .actions-end { min-width: 0; }
  .actions-end { flex-wrap: wrap; }
  .button { min-height: 48px; padding: 12px 18px; border-radius: 10px; }
  .button.primary { box-shadow: none; }
  .button.orange { background: #af3d19; border-color: #af3d19; }
  .button.orange:hover { background: #8f3012; border-color: #8f3012; }
  .subtle-action { display: inline-flex; align-items: center; color: var(--muted); }
  .stepper { padding: 16px 24px; }
  .stepper button { color: var(--muted); font-size: .875rem; min-width: 0; }
  .stepper button.done { color: #42634e; }
  .stepper .step-number { color: var(--muted); flex-shrink: 0; }
  .stepper button.current .step-number,
  .stepper button.done .step-number { color: #fff; }
  .choice span { min-height: 48px; }
  .choice input:checked + span { background: #edf4ef; border-color: var(--green); }

  /* Consistent cards and a readable distinction between saved and shared. */
  .inventory-toolbar { gap: 12px 20px; flex-wrap: wrap; }
  .inventory-tabs { gap: 6px; flex-wrap: wrap; }
  .inventory-tabs button { padding: 10px 12px; color: var(--muted); }
  .inventory-tabs button.selected { color: var(--green); background: #e7f0e9; }
  .animal-search { min-width: 0; }
  .animal-grid { gap: 20px; }
  .animal-card { padding: 20px; border-radius: 16px; }
  .saved-species-photo { height: 168px; margin: -20px -20px 16px; border-radius: 15px 15px 0 0; }
  .animal-card-top { margin-bottom: 12px; align-items: flex-start; }
  .animal-card-top .animal-mark { width: 36px; height: 36px; border-radius: 10px; }
  .animal-card-top .animal-mark svg { width: 20px; height: 20px; }
  .animal-badge { max-width: 100%; color: #42634e; background: #edf3ef; }
  .animal-card h2 { font-size: 1.25rem; line-height: 1.5; letter-spacing: -.03em; }
  .animal-scientific { margin: 4px 0 16px; min-height: 0; }
  .animal-secondary { gap: 8px; flex-wrap: wrap; }
  .animal-secondary .text-button { color: var(--green); padding: 10px 0; }
  .last-action { margin: 8px 0 12px; min-height: 0; }
  .animal-manage { padding-top: 4px; }
  .animal-manage summary { max-width: 100%; }
  .animal-manage > div { margin-top: 4px; }
  .animal-manage button { color: var(--green); padding: 10px 12px; }
  .animal-manage button[data-delete] { color: var(--keep-error); background: #fff1ec; }
  .inventory-footnote { padding: 16px; background: #edf3ef; border-radius: 12px; align-items: center; }
  .inventory-footnote p { flex: 1; min-width: 0; }
  .inventory-footnote a { display: inline-flex; align-items: center; }
  .first-animal { padding: 36px 24px; }
  .first-animal h2 { font-size: 1.375rem; }

  .account-grid { align-items: start; }
  .account-panel { min-width: 0; }
  .account-panel .field-help { font-size: .875rem; }
  .account-panel .button { max-width: 100%; }
  .account-panel .record-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
  .account-panel .record-toolbar .button { margin: 0; }
  .account-panel .social-buttons button {
    min-height: 52px;
    font-size: max(19px, 1.1875rem);
    font-weight: 700;
    line-height: 1.5;
  }
  /* Naver's required white label on #03A94D has 3.09:1 contrast.
     The bold label is at least 19px: this uses the large-text 3:1 criterion. */
  .account-panel .social-buttons .naver { background: #03a94d; color: #fff; }
  .storage-count { margin: 20px 0; font-size: 2.25rem; line-height: 1.4; }
  .storage-count span { display: inline-block; }
  .account-user { color: var(--green); background: #edf4ef; }
  .account-backup-details { min-width: 0; }
  .account-backup-details > summary {
    min-height: 44px;
    padding-block: 10px;
    font-size: 1rem;
    line-height: 1.65;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
  }
  .account-backup-details[open] > summary { margin-bottom: 12px; }
  .help-card summary { color: var(--ink); }
  .help-card a, .official-card a { min-height: 44px; padding-block: 10px; }
  .official-card a { display: inline-block; }
  .help-card ol { padding-left: 1.5rem; }
  .help-card li + li { margin-top: 8px; }
  .handoff-card h3 { font-size: 1.25rem; line-height: 1.5; }
  .handoff-card p { font-size: 1rem; color: var(--muted); }
  .handoff-tag { color: #42634e; }
  .preview-top { flex-wrap: wrap; gap: 8px; }
  .preview-top > span { color: var(--muted); }
  .copy-row { flex-wrap: wrap; gap: 8px 12px; }
  .copy-row > span { color: var(--muted); }
  .copy-row strong { min-width: 0; flex: 1; }
  .official-tools a { display: inline-flex; align-items: center; min-height: 44px; }
  .site-footer { flex-wrap: wrap; }
  dialog {
    padding: 24px;
    max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  dialog h2 { line-height: 1.45; overflow-wrap: anywhere; }
  dialog p, dialog ul { color: var(--muted); }
  dialog .dialog-actions { flex-wrap: wrap; }
  .toast { font-size: .875rem; line-height: 1.7; overflow-wrap: anywhere; }

  @media (min-width: 701px) and (max-width: 1100px) {
    .account-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .topbar { flex-wrap: wrap; gap: 4px 16px; }
    .home-heading { align-items: flex-start; }
  }

  @media (max-width: 700px) {
    body { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
    .sidebar { padding: 20px 16px 12px; }
    .brand-sub { position: static; margin-top: 6px; }
    .topbar { min-height: 48px; padding: 4px 16px; gap: 4px 12px; flex-wrap: wrap; }
    .topbar > div { font-size: .875rem; color: var(--muted); }
    .quiet-button { font-size: .875rem; max-width: 100%; }
    main { padding: 20px 16px 24px; }
    .page-intro, .home-heading { gap: 12px; margin-bottom: 20px; }
    .page-intro h1, .home-heading h1 { font-size: 1.75rem; }
    .home-heading { flex-wrap: wrap; align-items: center; }
    .home-heading > .button { align-self: auto; margin: 0; white-space: normal; }
    .home-heading.compact h1 { font-size: 1.5rem; }
    .draft-resume { padding: 16px; gap: 12px; }
    .draft-resume .button { width: 100%; }
    .registration-progress { gap: 8px 16px; }
    .home-heading p { max-width: none; }
    .flow-strip { padding-block: 12px; gap: 8px 16px; }
    .flow-strip span:last-child { flex-basis: auto; }
    .form-body, .account-panel, .help-card { padding: 20px; }
    .form-actions { padding: 16px 20px; }
    .form-actions .actions-end { width: 100%; margin: 0; }
    .form-actions .actions-end .button { flex: 1 1 140px; }
    #registration-form .form-actions > .button { width: 100%; }
    .species-grid { gap: 12px; }
    .species-option-text { padding: 10px; }
    .species-option-text strong { font-size: 1rem; }
    .species-option-text i { font-size: .875rem; }
    .species-option-text > span { display: block; }
    .chosen-species { flex-wrap: wrap; gap: 12px; padding: 12px; }
    .chosen-species > img { width: 72px; height: 72px; }
    .chosen-species > div { min-width: 0; }
    .chosen-species .text-button { padding: 10px 8px; }
    .species-shortcuts button { padding: 9px 12px; }
    .species-photo > span { left: 6px; bottom: 6px; }
    .stepper { padding: 12px 16px; gap: 8px; flex-wrap: wrap; }
    .stepper button { font-size: .875rem; gap: 6px; white-space: normal; }
    .animal-card { padding: 20px; }
    .saved-species-photo { margin: -20px -20px 16px; height: 176px; }
    .inventory-footnote { gap: 8px; align-items: flex-start; }
    .inventory-footnote > a { margin-left: 26px; }
    .storage-tools .record-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
    .storage-tools .record-toolbar .button { flex: 1 1 140px; white-space: normal; }
    .account-panel .record-toolbar .button { flex: 1 1 140px; white-space: normal; }
    .primary-nav {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 4px;
      padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    }
    .primary-nav a {
      min-width: 0;
      min-height: 60px;
      padding: 8px 2px;
      gap: 4px;
      font-size: .875rem;
      line-height: 1.4;
      white-space: normal;
      text-align: center;
      word-break: keep-all;
      overflow-wrap: anywhere;
    }
    .primary-nav a svg { width: 22px; height: 22px; }
    .site-footer { font-size: .875rem; padding-inline: 16px; }
    .toast { left: 50%; bottom: calc(106px + env(safe-area-inset-bottom)); }
    dialog { padding: 20px; }
  }

  @media (max-width: 360px) {
    main { padding-inline: 12px; }
    .form-body, .account-panel, .help-card, .form-actions { padding: 16px; }
    .field-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .species-grid { grid-template-columns: minmax(0, 1fr); }
    .stepper { gap: 6px; padding-inline: 12px; }
    .stepper button { flex-direction: column; flex: 1; text-align: center; }
    .inventory-tabs button { padding-inline: 10px; }
    .first-animal { padding: 28px 16px; }
    .first-animal > div:last-child { width: 100%; }
    .first-animal .button { width: 100%; }
    .inventory-footnote { padding: 12px; }
    dialog .dialog-actions .button { flex: 1; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  }
  @media (forced-colors: active) {
    .primary-nav a.active, .inventory-tabs button.selected,
    .species-shortcuts button[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -3px; }
    :is(button, a, input, select, textarea, summary):focus-visible { outline-color: Highlight; }
  }
}
