:root {
  color-scheme: dark;
  --ink: #ffffff;
  --muted: #b9c9d9;
  --navy: #173a63;
  --deep: #111315;
  --panel: #1c2938;
  --panel-2: #234f7c;
  --line: #3e668e;
  --amber: #f15a24;
  --amber-ink: #ffffff;
  --cyan: #43a1db;
  --danger: #ff7a78;
  --radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(66, 139, 202, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(66, 139, 202, .045) 1px, transparent 1px),
    radial-gradient(circle at 78% -10%, #255b8f 0, transparent 40%),
    var(--deep);
  background-size: 34px 34px, 34px 34px, auto, auto;
}

body::before { content: ""; position: fixed; inset: 0 0 auto; z-index: 10; height: 7px; background: linear-gradient(90deg, #428bca 0 76%, #f15a24 76% 100%); }

button, input { font: inherit; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 28px; }

.topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; margin-bottom: 24px; }
.brand-eagle { width: 78px; height: 78px; object-fit: contain; filter: drop-shadow(0 0 14px rgba(66, 139, 202, .32)); }
.eyebrow, .label { margin: 0 0 5px; color: var(--amber); font-size: .78rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.55rem, 3vw, 2.25rem); letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: clamp(1.65rem, 4vw, 2.7rem); letter-spacing: -.045em; line-height: 1.05; }
h3 { margin-bottom: 7px; font-size: 1.25rem; }
.clock { text-align: right; }
.clock strong { display: block; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.clock span, .readout p, .heartbeat, .status-detail { color: var(--muted); }

.status-panel { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; padding: clamp(24px, 4vw, 42px); border: 1px solid #4f89bb; border-radius: 28px; background: linear-gradient(128deg, rgba(35, 79, 124, .99), rgba(17, 25, 34, .99) 72%); box-shadow: 0 22px 70px rgba(0, 0, 0, .35); }
.status-panel::after { content: ""; position: absolute; right: -85px; bottom: -145px; width: 280px; height: 280px; border: 36px solid rgba(241, 90, 36, .1); border-radius: 50%; pointer-events: none; }
.status-line { display: flex; align-items: center; gap: 9px; }
.status-line .eyebrow { margin: 0; }
.status-light { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 18px rgba(241, 90, 36, .72); }
.status-light[data-mode="running"], .status-light[data-mode="ready"] { background: var(--cyan); box-shadow: 0 0 18px rgba(89, 209, 215, .7); }
.status-light[data-mode="error"] { background: var(--danger); box-shadow: 0 0 18px rgba(255, 122, 120, .65); }
.status-panel p:last-child { margin-bottom: 0; font-size: 1rem; }
.primary { position: relative; z-index: 1; min-width: 180px; padding: 16px 24px; border: 0; border-radius: 14px; color: var(--amber-ink); background: var(--amber); font-weight: 900; cursor: pointer; box-shadow: 0 8px 24px rgba(241, 90, 36, .3); }
.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary:focus-visible, .text-button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.readout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 18px 0; }
.readout { min-height: 142px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(28, 41, 56, .92); }
.readout p:last-child { margin-bottom: 0; }
.next-event { border-color: #a84b2a; background: linear-gradient(145deg, rgba(72, 38, 29, .95), rgba(28, 41, 56, .96)); }

.schedule-panel { padding: clamp(22px, 4vw, 34px); border: 1px solid var(--line); border-radius: 24px; background: rgba(16, 20, 24, .92); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0; font-size: 1.6rem; }
.heartbeat { margin: 0; font-size: .9rem; }
.schedule-empty { padding: 34px 0 10px; color: var(--muted); text-align: center; }
.schedule-row { display: grid; grid-template-columns: 42px minmax(180px, 1fr) auto; gap: 16px; align-items: center; min-height: 62px; padding: 12px 4px; border-bottom: 1px solid rgba(52, 80, 112, .65); }
.schedule-row:last-child { border-bottom: 0; }
.schedule-row[data-active="true"] { margin: 0 -14px; padding-inline: 18px; border: 1px solid #5479a2; border-radius: 14px; background: var(--panel-2); }
.schedule-row strong, .schedule-row span { display: block; }
.schedule-row div span, .schedule-row time { color: var(--muted); }
.schedule-row time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-icon { color: var(--amber); text-align: center; }
.schedule-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.schedule-period { font-weight: 800; }
.schedule-course { color: var(--muted); }
.schedule-tag { padding: 5px 9px; border: 1px solid #a84b2a; border-radius: 999px; color: var(--amber); font-size: .78rem; font-weight: 800; white-space: nowrap; }
.activity { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: rgba(22, 40, 68, .72); }
.activity h3 { font-size: 1rem; }
.activity-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; color: var(--muted); }
.activity-list li { display: flex; gap: 10px; }
.activity-list time { color: var(--cyan); font-variant-numeric: tabular-nums; }

footer { display: flex; justify-content: space-between; padding: 20px 4px 0; }
.text-button { padding: 8px 4px; border: 0; color: var(--muted); background: transparent; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.text-button:disabled { opacity: .4; cursor: default; }

dialog { width: min(620px, calc(100% - 28px)); padding: 0; border: 1px solid #4f89bb; border-radius: 24px; color: var(--ink); background: #173a63; box-shadow: 0 30px 100px rgba(0, 0, 0, .55); }
dialog::backdrop { background: rgba(3, 9, 17, .78); backdrop-filter: blur(5px); }
dialog form { padding: 28px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { font-size: 1.7rem; }
.close-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: transparent; font-size: 1.5rem; cursor: pointer; }
.dialog-copy, .field-help { color: var(--muted); line-height: 1.55; }
dialog label { display: block; margin: 20px 0 8px; font-weight: 750; }
dialog input { width: 100%; min-height: 48px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--deep); }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.secondary { padding: 11px 16px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--panel); font-weight: 750; cursor: pointer; }
.field-help { margin: 8px 0 0; font-size: .9rem; }
.account-card { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--deep); }
.account-card strong, .account-card span { display: block; }
.account-card span:last-child { margin-top: 3px; color: var(--muted); font-size: .9rem; }
.dialog-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }

@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 650px); padding-top: 20px; }
  .topbar { grid-template-columns: auto 1fr; }
  .brand-eagle { width: 62px; height: 62px; }
  .clock { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; text-align: left; }
  .status-panel { grid-template-columns: 1fr; }
  .primary { width: 100%; }
  .readout-grid { grid-template-columns: 1fr; }
  .readout { min-height: auto; }
  .section-heading { align-items: start; flex-direction: column; }
  .schedule-row { grid-template-columns: 34px 1fr; gap: 5px 12px; padding-block: 14px; }
  .schedule-row time { grid-column: 2; }
  .schedule-course { grid-column: 2; }
  .schedule-tag { grid-column: 2; justify-self: start; }
  .dialog-actions { flex-direction: column-reverse; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: transform .18s ease, filter .18s ease; }
}
