:root {
  color-scheme: light;
  --ink: #1c1915;
  --muted: #5e584f;
  --line: #e3dcd1;
  --paper: #f3efe7;
  --card: #fffdf8;
  --green: #0e6b4f;
  --green-soft: #e5f3ed;
  --warn: #8a4b12;
  --warn-soft: #f8ecdf;
  --danger: #8c2f2f;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.04), 0 12px 32px rgba(28, 25, 21, 0.06);
  font-family: 'Avenir Next', 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  font-size: 16px;
  line-height: 1.45;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
img {
  max-width: 100%;
}

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 28px;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h1,
h2,
h3 {
  font-family: Palatino, 'Iowan Old Style', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h1 {
  font-size: 40px;
  margin: 0;
  line-height: 1;
}
h2 {
  font-size: 28px;
  margin: 0;
}
h3 {
  font-size: 20px;
  margin: 0;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.stack {
  display: grid;
  gap: 14px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.household {
  margin-top: 28px;
}
.under-list {
  margin: 22px 0 0;
}
.household header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.household header .meta {
  margin: 2px 0 0;
}
.house-agenda {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.agenda-toggle-row {
  margin-bottom: 12px;
}
.agenda-body {
  gap: 22px;
}
.agenda-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.person,
.account,
.event-edit,
.task-edit {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.person,
.event-edit,
.task-edit {
  display: grid;
  gap: 12px;
}
.account {
  display: grid;
  gap: 8px;
}
.calendar-list {
  display: grid;
  gap: 6px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
}
.card,
.panel-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.panel-list {
  display: grid;
  gap: 12px;
}
.panel-card {
  display: flex;
  gap: 16px;
  align-items: center;
}
.panel-card .preview {
  flex: 0 0 auto;
  height: min(30vh, 300px);
  max-width: 55%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.panel-card .preview img,
.panel-card .preview .empty {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}
.panel-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: center;
}
.panel-card h3 {
  font-size: 22px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button.primary,
button.quiet,
button.danger,
a.button {
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
button.primary,
a.button.primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
button.danger {
  color: var(--danger);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}

.badge,
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 13px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.status.online {
  background: var(--green-soft);
  border-color: transparent;
  color: var(--green);
}
.status.offline {
  color: var(--muted);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: currentColor;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}
.times {
  display: grid;
  gap: 2px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
code,
.token {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 15px;
}
.token {
  letter-spacing: 0.01em;
}

.preview {
  background: #141414;
  border-radius: 12px;
  padding: 8px;
  min-height: 72px;
}
.preview img,
.preview .empty {
  display: block;
  width: 100%;
  background: white;
  border-radius: 4px;
}
.preview img {
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}
.preview .empty {
  margin: 0;
  padding: 22px 12px;
  text-align: center;
  color: var(--muted);
}

#panel-manage {
  width: min(720px, calc(100% - 24px));
  max-height: min(92vh, 920px);
  overflow: auto;
}
.manage-preview {
  height: min(20vh, 220px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.manage-preview img,
.manage-preview .empty {
  width: auto;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  object-fit: contain;
}

dialog {
  width: min(440px, calc(100% - 32px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: inherit;
  box-shadow: 0 24px 60px rgba(28, 25, 21, 0.18);
}
dialog::backdrop {
  background: rgba(28, 25, 21, 0.45);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.login {
  width: min(420px, calc(100% - 32px));
  margin: 12vh auto;
}
.error {
  background: #f8e8e4;
  color: var(--danger);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 0;
}
.note {
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0;
}

dl.media {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 6px 12px;
  margin: 0;
}
dl.media dt {
  color: var(--muted);
}
dl.media dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.events {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}
.events li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

body.viewing {
  background: #161616;
  overflow: hidden;
}
.view-app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #161616;
  position: relative;
}
.view-app:fullscreen,
.view-app:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #161616;
}
.stage {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
  background: #161616;
}
.font-cycle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.font-cycle p {
  min-width: 8rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
#weight-name {
  min-width: 6rem;
}
.font-cycle button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 8px 14px;
}
.stage.scroll {
  overflow: auto;
  place-items: safe center;
}
.glass.pixels #screen,
.glass.pixels #cursor {
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}
.bezel {
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}
.glass {
  position: relative;
  line-height: 0;
  background: white;
}
#screen,
#cursor {
  display: block;
}
#cursor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hud {
  width: 100%;
  margin: 0;
  padding: 6px 16px 10px;
  display: grid;
  gap: 4px;
  justify-items: center;
  background: #161616;
  color: #f3efe7;
}
.hud p {
  margin: 0;
}
.hud #where,
.hud #role,
.hud #notes {
  display: none;
}
.hud #fit {
  color: #b7b1a6;
  font-size: 13px;
}
.hud #claim {
  margin-top: 4px;
}
.hud #fullscreen {
  border: 1px solid #3a3a3a;
  background: transparent;
  color: #f3efe7;
  border-radius: 999px;
  padding: 8px 14px;
}
body.filling .hud > :not(#fullscreen) {
  display: none;
}
body.filling .hud {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: auto;
  padding: 0;
  background: transparent;
  z-index: 2;
}
body.claiming {
  background: white;
}
body.claiming .hud {
  display: none;
}
body.claiming .view-app {
  background: white;
}
body.claiming .stage {
  background: white;
}
body.claiming .bezel {
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  background: white;
}
body.claiming .glass,
body.claiming #screen {
  width: 100%;
  height: 100%;
}

@media (max-width: 640px) {
  h1 {
    font-size: 32px;
  }
  .top {
    align-items: stretch;
    flex-direction: column;
  }
  dl.media {
    grid-template-columns: 1fr;
  }
  .panel-card {
    align-items: stretch;
  }
  .panel-card .preview {
    max-width: 46%;
  }
  .panel-body {
    align-content: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
