:root {
  color-scheme: light;
  --ink: #282923;
  --muted: #77776e;
  --paper: #f5f2ec;
  --card: #fffefa;
  --line: #e4dfd5;
  --accent: #a66b45;
  --deep: #343a32;
  --modal: #fbfaf6;
  --body-copy: #44453f;
  --soft: #f0ede5;
  --field: #fffefa;
  --field-border: #ded9cf;
  --header: rgba(245, 242, 236, .94);
  --shadow: 0 25px 90px rgba(0, 0, 0, .25);
  --serif: "Literata", Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ecebe4;
  --muted: #aaa99f;
  --paper: #151815;
  --card: #20251f;
  --line: #3a4038;
  --accent: #d2a17d;
  --deep: #202820;
  --modal: #1d231e;
  --body-copy: #deddd5;
  --soft: #293129;
  --field: #171c18;
  --field-border: #454d43;
  --header: rgba(21, 24, 21, .95);
  --shadow: 0 25px 90px rgba(0, 0, 0, .48);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; transition: background-color .2s, color .2s; }
body.modal-open { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.topbar { min-height: 76px; padding: 12px clamp(18px, 7vw, 108px); display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); background: var(--header); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid #b98a69; border-radius: 50%; display: grid; place-items: center; color: var(--accent); font-family: var(--serif); font-size: 12px; }
.brand-name { font-size: 10px; letter-spacing: 2px; font-weight: 700; white-space: nowrap; }
.brand-name i { color: var(--accent); font-style: normal; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: clamp(12px, 2.4vw, 26px); }
.admin-link, .theme-toggle { min-height: 42px; border: 0; background: transparent; color: var(--muted); font: 600 12px var(--sans); cursor: pointer; padding: 8px 2px; white-space: nowrap; }
.admin-link span { color: var(--accent); margin-left: 5px; }
.theme-toggle { display: inline-flex; align-items: center; gap: 7px; }
.theme-toggle > span:first-child { font-size: 17px; color: var(--accent); }
.hero { min-height: 430px; background: var(--deep); color: #f8f5ed; padding: 86px clamp(24px, 12vw, 180px) 74px; position: relative; overflow: hidden; }
.hero-kicker, .eyebrow { font-size: 9px; letter-spacing: 2.2px; font-weight: 700; color: #b88b69; }
.hero-kicker { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.hero-kicker span { width: 24px; height: 1px; background: #b88b69; }
.hero h1 { font: 500 clamp(38px, 6vw, 72px)/1.08 var(--serif); letter-spacing: -2.5px; margin: 28px 0 22px; position: relative; z-index: 1; }
.hero h1 em { font-weight: 400; color: #d5b69c; }
.hero-copy { max-width: 560px; color: #c9cbc1; font-size: 14px; line-height: 1.9; margin: 0; position: relative; z-index: 1; }
.hero-meta { display: flex; align-items: center; gap: 12px; margin-top: 38px; color: #d7d7ce; font-size: 9px; letter-spacing: 1.8px; position: relative; z-index: 1; }
.meta-line { height: 1px; width: 32px; background: #b88b69; }
.hero-orbit { position: absolute; border: 1px solid rgba(211, 184, 158, .13); border-radius: 50%; pointer-events: none; }
.orbit-one { width: 440px; height: 440px; right: -70px; top: -115px; }
.orbit-two { width: 300px; height: 300px; right: 0; top: -45px; }
.classes-section { max-width: 1120px; margin: auto; padding: 82px 32px 110px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.section-heading h2 { font: 500 38px var(--serif); margin: 9px 0 0; letter-spacing: -1px; }
.section-heading p { font-size: 12px; line-height: 1.8; color: var(--muted); margin: 0 0 4px; }
.class-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.class-card { min-width: 0; min-height: 208px; padding: 25px 24px 22px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 2px; text-align: left; display: flex; flex-direction: column; cursor: pointer; transition: transform .2s, border-color .2s, box-shadow .2s, background-color .2s; position: relative; overflow: hidden; }
.class-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 28px rgba(48, 43, 34, .08); }
.card-top { display: flex; justify-content: space-between; align-items: center; color: var(--accent); font-size: 9px; letter-spacing: 1.6px; font-weight: 700; }
.card-arrow { font-size: 18px; color: var(--muted); transition: transform .2s; }
.class-card:hover .card-arrow { transform: translate(3px, -3px); color: var(--accent); }
.class-card h3 { font: 500 21px/1.35 var(--serif); margin: 27px 0 12px; letter-spacing: -.3px; }
.card-excerpt { font-size: 11px; line-height: 1.7; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.empty-state { text-align: center; padding: 76px 20px; color: var(--muted); display: none; }
.empty-state.visible { display: block; }
.empty-symbol { font: 36px var(--serif); color: var(--accent); }
.empty-state h3 { font: 500 23px var(--serif); color: var(--ink); margin: 14px 0 8px; }
.empty-state p { font-size: 12px; }
footer { border-top: 1px solid var(--line); padding: 24px clamp(22px, 7vw, 108px); display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 9px; letter-spacing: 1.4px; }
footer span:last-child { letter-spacing: .2px; font-size: 11px; }

.overlay { position: fixed; inset: 0; background: rgba(16, 19, 16, .68); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); z-index: 10; display: flex; align-items: center; justify-content: center; padding: 22px; opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.overlay.open { opacity: 1; visibility: visible; }
.modal { background: var(--modal); color: var(--ink); box-shadow: var(--shadow); transform: translateY(12px) scale(.995); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.overlay.open .modal { transform: translateY(0) scale(1); }
.reader { width: min(820px, 100%); height: min(88dvh, 940px); display: flex; flex-direction: column; min-height: 0; border-radius: 3px; overflow: hidden; }
.reader-top { flex: 0 0 auto; padding: 20px 30px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.reader-number { font-size: 9px; letter-spacing: 2px; color: var(--accent); font-weight: 700; }
.icon-button { border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; width: 42px; height: 42px; display: grid; place-items: center; touch-action: manipulation; }
.icon-button:hover { background: var(--soft); color: var(--ink); }
.reader-scroll { overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: 35px clamp(25px, 7vw, 74px) 55px; flex: 1 1 auto; min-height: 0; scrollbar-gutter: stable; }
.reader-scroll h2 { font: 500 clamp(28px, 4vw, 40px)/1.2 var(--serif); margin: 0 0 25px; letter-spacing: -.8px; }
.reader-image { width: 100%; max-height: 340px; object-fit: cover; margin: 0 0 28px; display: none; }
.reader-image.visible { display: block; }
.reader-content { font: 16px/1.95 var(--serif); color: var(--body-copy); white-space: pre-wrap; overflow-wrap: anywhere; }
.reader-actions { flex: 0 0 auto; padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--modal); }
.speech-options { display: flex; align-items: center; gap: 12px; }
.speech-options label { display: flex; align-items: center; gap: 7px; color: var(--muted); font: 600 10px var(--sans); }
.speech-options select { max-width: 205px; min-height: 40px; border: 1px solid var(--field-border); border-radius: 2px; background: var(--field); color: var(--ink); padding: 7px 9px; font: 11px var(--sans); }
.speech-buttons { display: flex; align-items: center; gap: 8px; }
.listen-button, .stop-button { min-height: 42px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--accent); font: 700 11px var(--sans); cursor: pointer; padding: 9px 12px; touch-action: manipulation; }
.listen-button:hover, .stop-button:hover:not(:disabled) { background: var(--soft); }
.stop-button { border-color: var(--line); color: var(--muted); }
.stop-button:disabled { opacity: .42; cursor: not-allowed; }
.reader-hint { font-size: 8px; letter-spacing: 1.5px; color: var(--muted); }

.admin-login { width: min(430px, 100%); padding: 27px; border-radius: 3px; }
.admin-login .admin-head h2 { font: 500 29px var(--serif); margin: 8px 0 0; }
.login-copy { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 20px 0 14px; }
.admin-login label { display: block; color: var(--muted); font-size: 11px; font-weight: 700; margin-bottom: 7px; }
.admin-login input { width: 100%; min-height: 48px; border: 1px solid var(--field-border); border-radius: 2px; background: var(--field); color: var(--ink); padding: 11px 13px; font: 16px var(--sans); }
.login-error { min-height: 17px; color: #bd786b; font-size: 11px; line-height: 1.45; margin: 8px 0 0; }
.admin { width: min(850px, 100%); max-height: min(92dvh, 1000px); overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 30px; border-radius: 3px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.admin-head h2 { font: 500 30px var(--serif); margin: 8px 0 0; }
.admin-notice { font-size: 11px; line-height: 1.7; color: var(--muted); background: var(--soft); border-left: 2px solid var(--accent); padding: 13px 15px; margin: 22px 0; }
.admin-notice strong { color: var(--ink); }
.admin-notice code { font-size: 10px; color: var(--accent); }
.admin-toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 18px; }
.toolbar-secondary { display: flex; gap: 8px; }
.primary-button, .secondary-button { min-height: 42px; border: 1px solid transparent; border-radius: 2px; padding: 10px 15px; font: 600 11px var(--sans); cursor: pointer; transition: background .2s, border-color .2s; touch-action: manipulation; }
.primary-button { background: #3e473c; color: white; }
.primary-button:hover { background: #283327; }
.secondary-button { background: transparent; border-color: var(--field-border); color: var(--muted); }
.secondary-button:hover { background: var(--soft); color: var(--ink); }
.admin-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 25px; }
.admin-row { display: grid; grid-template-columns: 65px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); }
.admin-row .row-num { font-size: 9px; letter-spacing: 1px; color: var(--accent); }
.admin-row .row-name { min-width: 0; overflow-wrap: anywhere; font: 500 14px var(--serif); }
.row-action { min-height: 40px; border: 0; border-radius: 2px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; padding: 8px 10px; touch-action: manipulation; }
.row-action:hover { background: var(--soft); color: var(--ink); }
.row-action.delete { color: #bd786b; }
.editor { border-top: 1px solid var(--line); padding-top: 24px; display: none; scroll-margin-top: 10px; }
.editor.visible { display: block; }
.editor-heading h3 { font: 500 22px var(--serif); margin: 6px 0 20px; }
.editor label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin: 14px 0 7px; }
.editor input, .editor textarea { width: 100%; min-height: 46px; border: 1px solid var(--field-border); border-radius: 2px; background: var(--field); padding: 12px 13px; font: 16px/1.55 var(--sans); color: var(--ink); outline: none; }
.editor input:focus, .editor textarea:focus { border-color: var(--accent); }
.editor textarea { resize: vertical; min-height: 220px; font-family: var(--serif); font-size: 16px; line-height: 1.8; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.admin-footnote { font-size: 10px; line-height: 1.6; color: var(--muted); margin-top: 18px; }
.toast { position: fixed; bottom: calc(25px + env(safe-area-inset-bottom)); left: 50%; width: max-content; max-width: calc(100% - 32px); transform: translate(-50%, 15px); opacity: 0; pointer-events: none; background: #30382f; color: #fff; border-radius: 3px; padding: 12px 18px; font-size: 12px; line-height: 1.45; z-index: 30; transition: .2s; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .class-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding-top: 72px; }
  .classes-section { padding-top: 65px; }
}
@media (max-width: 620px) {
  /* En móvil el encabezado usa dos filas: identidad y controles. */
  .topbar {
    min-height: 0;
    width: 100%;
    padding: 10px 16px 11px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }
  .brand { gap: 8px; min-width: 0; min-height: 34px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-name {
    min-width: 0;
    font-size: clamp(8px, 2.35vw, 10px);
    letter-spacing: clamp(.35px, .35vw, .9px);
    white-space: nowrap;
  }
  .top-actions {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
  }
  .admin-link, .theme-toggle {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    justify-content: center;
    padding: 8px 7px;
    border: 1px solid var(--line);
    border-radius: 3px;
    font-size: 11px;
    line-height: 1.2;
    white-space: normal;
    text-align: center;
  }
  .theme-toggle { gap: 5px; }
  .theme-toggle > span:first-child { font-size: 16px; flex: 0 0 auto; }
  .admin-link span { margin-left: 2px; }
  .hero { min-height: 390px; padding: 58px 22px 54px; }
  .hero-kicker { font-size: 8px; letter-spacing: 1.25px; line-height: 1.6; }
  .hero h1 {
    max-width: 100%;
    font-size: clamp(27px, 8.6vw, 44px);
    line-height: 1.12;
    letter-spacing: -.045em;
    overflow-wrap: anywhere;
    margin: 25px 0 20px;
  }
  .hero-copy { max-width: 470px; font-size: 13px; line-height: 1.8; }
  .hero-meta { margin-top: 30px; font-size: 8px; }
  .orbit-one { right: -260px; }
  .orbit-two { right: -200px; }
  .classes-section { padding: 52px 16px 70px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 11px; margin-bottom: 22px; }
  .section-heading h2 { font-size: 34px; }
  .section-heading p { font-size: 12px; }
  .class-grid { grid-template-columns: 1fr; gap: 10px; }
  .class-card { min-height: 148px; padding: 19px 18px; }
  .class-card h3 { margin: 18px 0 8px; font-size: 19px; }
  .card-excerpt { font-size: 12px; }
  footer { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); gap: 10px; flex-direction: column; }
  .overlay { padding: 8px; align-items: center; }
  .reader { width: 100%; height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); max-height: 980px; border-radius: 9px; }
  .reader-top { padding: 8px 14px 7px; }
  .reader-scroll { padding: 24px 20px 34px; }
  .reader-scroll h2 { font-size: clamp(27px, 7vw, 34px); margin-bottom: 19px; }
  .reader-content { font-size: 16px; line-height: 1.85; }
  .reader-image { max-height: 240px; }
  .reader-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; padding: 9px 12px calc(10px + env(safe-area-inset-bottom)); }
  .speech-options { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(105px, .8fr); gap: 8px; }
  .speech-options label { min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 4px; font-size: 9px; }
  .speech-options select { max-width: none; width: 100%; min-width: 0; min-height: 38px; font-size: 11px; }
  .speech-buttons { grid-column: 1; }
  .listen-button, .stop-button { min-height: 42px; padding: 8px 10px; font-size: 11px; }
  .reader-hint { grid-column: 2; justify-self: end; align-self: center; font-size: 7px; }
  .admin-login { width: 100%; padding: 23px 18px; border-radius: 10px; }
  .admin-login .admin-head h2 { font-size: 26px; }
  .admin { width: 100%; max-height: calc(100dvh - 12px - env(safe-area-inset-top)); padding: 21px 15px calc(18px + env(safe-area-inset-bottom)); border-radius: 12px 12px 6px 6px; }
  .admin-head h2 { font-size: 26px; }
  .admin-notice { font-size: 11px; margin: 16px 0; padding: 11px 12px; }
  .admin-toolbar { align-items: stretch; flex-direction: column; gap: 8px; }
  .toolbar-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .primary-button, .secondary-button { min-height: 44px; padding: 10px 11px; font-size: 11px; }
  .admin-row { grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: 4px; padding: 6px 7px; }
  .admin-row .row-num { font-size: 8px; letter-spacing: .3px; }
  .admin-row .row-name { font-size: 12px; }
  .row-action { min-height: 42px; padding: 7px 6px; font-size: 10px; }
  .editor textarea { min-height: 260px; }
  .form-actions { position: sticky; bottom: -1px; background: var(--modal); padding: 10px 0 3px; }
}
@media (max-width: 370px) {
  .topbar { padding-right: 12px; padding-left: 12px; gap: 8px; }
  .brand-name { letter-spacing: .35px; font-size: 8px; }
  .top-actions { gap: 6px; }
  .admin-link, .theme-toggle { font-size: 10px; padding-right: 5px; padding-left: 5px; }
  .hero { padding-right: 18px; padding-left: 18px; }
  .hero h1 { font-size: clamp(25px, 8.2vw, 31px); letter-spacing: -.05em; }
  .admin-row { grid-template-columns: 45px minmax(0, 1fr) auto auto; }
  .row-action { padding: 6px 4px; }
}
@media (hover: none) {
  .class-card:hover { transform: none; box-shadow: none; }
  .class-card:active { border-color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
