:root {
  --ink: #2f2d2a;
  --muted: #625d58;
  --paper: #f7f4ed;
  --card: #ffffff;
  --accent: #9c261f;
  --accent-dark: #781a15;
  --charcoal: #433b34;
  --tan: #e4ad78;
  --rust: #ad5a12;
  --line: #d8d2c8;
  --danger: #8f1512;
  --focus: #1e66a8;
  --shadow: 0 10px 28px rgba(67, 59, 52, .1);
}

* { box-sizing: border-box; }
html { font-size: 18px; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Arial, Helvetica, sans-serif; line-height: 1.6; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: .08em; }
a:hover { color: var(--accent-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 4px solid rgba(30, 102, 168, .35); outline-offset: 3px; }
h1, h2, h3 { margin-top: 0; color: var(--accent); font-family: Georgia, "Times New Roman", serif; line-height: 1.16; }
h1 { margin-bottom: .45rem; font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
p { margin-top: 0; }

.skip-link { position: absolute; left: -9999px; top: .5rem; z-index: 20; padding: .75rem 1rem; background: white; }
.skip-link:focus { left: .5rem; }
.environment-banner { padding: .5rem 1rem; color: white; background: var(--accent); font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.site-header { display: flex; min-height: 132px; align-items: center; justify-content: center; padding: .7rem clamp(1rem, 4vw, 3rem); background: white; }
.brand { display: block; width: min(760px, 100%); text-decoration: none; }
.brand-masthead { display: block; width: 100%; height: auto; }
.site-navigation { color: white; background: var(--charcoal); border-top: 6px solid var(--rust); }
.site-navigation-inner { display: flex; width: min(1140px, calc(100% - 2rem)); min-height: 70px; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 auto; }
.portal-label { flex: 0 0 auto; font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; font-weight: 700; }
.site-navigation nav { display: flex; align-items: center; gap: .2rem; }
.site-navigation form { display: inline-flex; margin: 0; }
.site-navigation a, .site-navigation .link-button { display: inline-flex; min-height: 50px; align-items: center; padding: .7rem .85rem; border-radius: 3px; color: white; background: transparent; border: 0; font: 700 .84rem/1.2 Arial, Helvetica, sans-serif; letter-spacing: .055em; text-decoration: none; text-transform: uppercase; cursor: pointer; }
.site-navigation a:hover, .site-navigation .link-button:hover, .site-navigation .current { color: white; background: rgba(255, 255, 255, .13); }
.site-navigation .current { box-shadow: inset 0 -4px var(--tan); }
.signed-in-as { padding: 0 .65rem; color: #eee8e2; font-size: .82rem; line-height: 1.3; }
.signed-in-as strong { display: block; color: white; }
.page-shell { width: min(1140px, calc(100% - 2rem)); min-height: calc(100vh - 340px); margin: 0 auto; padding: clamp(1.5rem, 5vw, 3.5rem) 0; }
.site-footer { display: flex; justify-content: space-between; gap: 2rem; padding: 1.8rem max(clamp(1rem, 4vw, 3rem), calc((100vw - 1140px) / 2)); color: white; background: var(--charcoal); border-top: 8px solid var(--rust); font-size: .9rem; line-height: 1.5; }
.site-footer a { color: white; }
.footer-help { text-align: right; }

.flash { margin: 0 0 1.4rem; padding: 1rem 1.2rem; border-radius: 6px; font-weight: 700; }
.flash.notice { color: #183d2c; background: #dcecdf; border: 2px solid #91b79a; }
.flash.alert { color: #6a1e1e; background: #f4dddd; border: 2px solid #d4aaaa; }
.eyebrow { margin-bottom: .4rem; color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.lead { max-width: 720px; color: var(--muted); font-size: 1.12rem; line-height: 1.55; }
.page-heading { margin-bottom: 2rem; }

.auth-card { width: min(680px, 100%); margin: clamp(.5rem, 4vw, 3rem) auto; padding: clamp(1.4rem, 5vw, 3rem); background: var(--card); border: 1px solid var(--line); border-top: 8px solid var(--tan); border-radius: 4px; box-shadow: var(--shadow); }
.simple-steps { display: grid; gap: .7rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.simple-steps li { display: flex; align-items: center; gap: .8rem; }
.simple-steps li > span { display: inline-flex; width: 38px; height: 38px; flex: 0 0 38px; align-items: center; justify-content: center; border-radius: 50%; color: white; background: var(--rust); font-weight: 800; }
.stacked-form { display: grid; gap: 1.2rem; margin-top: 1.8rem; }
.stacked-form label { display: block; margin-bottom: .4rem; font-size: 1.02rem; font-weight: 800; }
.stacked-form input:not([type="checkbox"]), .stacked-form select, .stacked-form textarea { width: 100%; min-height: 56px; padding: .75rem .9rem; border: 2px solid #8f8982; border-radius: 4px; background: white; color: var(--ink); font: inherit; }
.stacked-form input:focus, .stacked-form select:focus, .stacked-form textarea:focus { border-color: var(--focus); }
.code-input { font-family: ui-monospace, monospace !important; font-size: 1.15rem !important; letter-spacing: .12em; text-transform: uppercase; }
.field-hint, .help-copy { margin: .45rem 0 0; color: var(--muted); font-size: .92rem; }
.help-panel { margin-top: 1.8rem; padding: 1rem 1.15rem; background: #f5e8dc; border-left: 5px solid var(--rust); }
.help-panel p { margin-bottom: .65rem; }
.help-panel p:last-child { margin-bottom: 0; }
.primary-button, .watch-button, input.primary-button { display: inline-flex; min-height: 54px; align-items: center; justify-content: center; padding: .75rem 1.3rem; border: 1px solid var(--accent-dark); border-radius: 4px; color: white; background: var(--accent); font: 800 1rem/1.2 Arial, Helvetica, sans-serif; text-decoration: none; cursor: pointer; }
.primary-button:hover, .watch-button:hover { color: white; background: var(--accent-dark); }

.class-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr)); gap: 1.3rem; }
.class-card { display: flex; min-height: 270px; flex-direction: column; justify-content: space-between; padding: 1.7rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-top: 7px solid var(--tan); border-radius: 4px; box-shadow: var(--shadow); text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.class-card:hover { color: var(--ink); border-color: var(--rust); transform: translateY(-2px); }
.class-card h2 { margin-top: .4rem; }
.class-card p { color: var(--muted); }
.kind-label { color: var(--rust); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.class-card-footer { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.card-action { flex: 0 0 auto; color: var(--accent); font-size: 1rem; font-weight: 800; }
.empty-state { padding: clamp(1.5rem, 4vw, 2.4rem); background: var(--card); border: 1px solid var(--line); border-top: 7px solid var(--tan); border-radius: 4px; text-align: center; box-shadow: var(--shadow); }

.back-link { display: inline-block; min-height: 44px; margin-bottom: 1rem; padding: .4rem 0; font-weight: 800; }
.class-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.4rem; }
.access-date { flex: 0 0 auto; margin-bottom: .35rem; color: var(--muted); text-align: right; }
.player-section { overflow: hidden; background: #171515; border-radius: 4px; color: white; box-shadow: var(--shadow); }
.player-heading { padding: 1rem 1.2rem; }
.player-heading p { margin: 0 0 .15rem; color: #e4ad78; font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.player-heading h2 { margin: 0; color: white; font-size: clamp(1.2rem, 3vw, 1.65rem); }
.video-frame { position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: black; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.recording-list { margin-top: 2rem; }
.recording-list ol { overflow: hidden; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); list-style: none; }
.recording-list li { display: grid; min-height: 82px; grid-template-columns: 2.4rem 1fr auto auto; align-items: center; gap: 1rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.recording-list li:last-child { border-bottom: 0; }
.recording-list li.currently-playing { background: #f7eeee; box-shadow: inset 6px 0 var(--accent); }
.recording-number { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: 50%; color: var(--muted); background: #ece8e0; font-weight: 800; }
.duration { color: var(--muted); }
.recording-title { font-weight: 800; }
.playing-label { color: var(--accent); font-size: .85rem; font-weight: 800; text-transform: uppercase; }
.watch-button { min-height: 48px; padding: .6rem 1rem; font-size: .9rem; }

.admin-nav { display: flex; gap: .35rem; margin-bottom: 2.3rem; padding: .45rem; overflow-x: auto; background: #eee8df; border-radius: 4px; }
.admin-nav a { flex: 0 0 auto; min-height: 46px; display: inline-flex; align-items: center; padding: .55rem .85rem; border-radius: 3px; font-weight: 800; text-decoration: none; }
.admin-nav a:hover, .admin-nav a.current { color: white; background: var(--accent); }
.admin-heading, .section-heading, .button-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.admin-heading { align-items: flex-end; margin-bottom: 2rem; }
.button-row { justify-content: flex-start; flex-wrap: wrap; }
.button-row form { margin: 0; }
.secondary-button, .danger-button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: .65rem 1rem; border: 2px solid var(--accent); border-radius: 4px; color: var(--accent); background: white; font: 800 .95rem/1.2 Arial, Helvetica, sans-serif; text-decoration: none; cursor: pointer; }
.danger-button { color: var(--danger); border-color: var(--danger); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-grid > div { padding: 1.3rem; background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--tan); border-radius: 4px; box-shadow: var(--shadow); }
.stat-grid strong { display: block; font-family: Georgia, serif; font-size: 2.2rem; }
.stat-grid span { color: var(--muted); }
.admin-section { margin-top: 2rem; padding: clamp(1rem, 3vw, 1.5rem); background: var(--card); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.section-heading { align-items: flex-start; margin-bottom: 1rem; }
.section-heading h2, .section-heading p { margin-bottom: .25rem; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
td small { color: var(--muted); }
.status { display: inline-block; padding: .25rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.status.good { color: #174329; background: #dcecdf; }
.status.bad { color: #6a1e1e; background: #f4dddd; }
.status.neutral { color: #514b43; background: #e9e5dd; }
.admin-form { max-width: 850px; padding: 1.5rem; background: var(--card); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.form-columns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.check-label { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.check-label input { width: 22px; height: 22px; }
.inline-form { display: flex; align-items: end; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.inline-form > div { flex: 1 1 220px; }
.inline-form label { display: block; margin-bottom: .35rem; font-weight: 800; }
.inline-form input:not([type="submit"]), .inline-form select, .compact-form input { width: 100%; min-height: 48px; padding: .6rem .75rem; border: 2px solid #8f8982; border-radius: 4px; background: white; font: inherit; }
.compact-form { display: flex; min-width: 235px; gap: .4rem; }
.compact-form input[type="submit"] { width: auto; cursor: pointer; }
.issued-code { margin: 1.5rem 0; padding: 1.5rem; color: white; background: var(--charcoal); border: 4px solid var(--tan); border-radius: 4px; text-align: center; }
.issued-code p { margin-bottom: .5rem; }
.issued-code strong { font-family: ui-monospace, monospace; font-size: clamp(1.4rem, 5vw, 2.4rem); letter-spacing: .12em; }
.danger-zone { border-color: #d4aaaa; }

@media (max-width: 780px) {
  html { font-size: 17px; }
  .site-header { min-height: 0; padding: .55rem .7rem; }
  .site-navigation-inner { width: min(calc(100% - 1rem), 1140px); align-items: stretch; flex-direction: column; gap: .2rem; padding: .55rem 0 .7rem; }
  .portal-label { padding: .2rem .35rem; text-align: center; }
  .site-navigation nav { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
  .site-navigation nav > a, .site-navigation nav > form, .site-navigation .link-button { width: 100%; }
  .site-navigation a, .site-navigation .link-button { justify-content: center; min-height: 52px; padding: .65rem .5rem; border: 1px solid rgba(255, 255, 255, .25); text-align: center; }
  .signed-in-as { grid-column: 1 / -1; padding: .45rem .35rem; text-align: center; }
  .signed-in-as strong { display: inline; }
  .site-navigation .current { box-shadow: inset 0 -4px var(--tan); }
  .page-shell { width: min(calc(100% - 1.2rem), 1140px); }
  .site-footer, .class-heading { align-items: flex-start; flex-direction: column; }
  .footer-help, .access-date { text-align: left; }
  .class-card { min-height: 240px; padding: 1.35rem; }
  .class-card-footer { align-items: flex-start; flex-direction: column; }
  .card-action { width: 100%; padding-top: .45rem; border-top: 1px dashed var(--line); }
  .recording-list li { grid-template-columns: 2.4rem 1fr; gap: .65rem; padding: 1rem; }
  .recording-list .duration { grid-column: 2; }
  .recording-list .playing-label, .recording-list .watch-button { grid-column: 1 / -1; }
  .recording-list .watch-button { width: 100%; }
  .admin-heading, .section-heading { align-items: flex-start; flex-direction: column; }
  .button-row, .button-row > a, .button-row > form, .button-row button { width: 100%; }
  .stat-grid, .form-columns { grid-template-columns: 1fr; }
  .admin-section { padding: 1rem; }
}

@media (max-width: 430px) {
  h1 { font-size: 2rem; }
  .auth-card { padding: 1.2rem; }
  .site-navigation a, .site-navigation .link-button { font-size: .78rem; }
  .player-heading { padding: .85rem 1rem; }
}

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