@font-face {
  font-family: "Tiempos";
  src: url("../fonts/tiempos-headline-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sohne";
  src: url("../fonts/soehne-buch.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sohne";
  src: url("../fonts/soehne-halbfett.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #0b0d0f;
  --ink-2: #12161a;
  --bone: #f3efe7;
  --paper: #d9d3c6;
  --muted: #9a958a;
  --faint: #676d70;
  --line: rgba(243, 239, 231, 0.16);
  --glass: rgba(11, 13, 15, 0.62);
  --glass-strong: rgba(18, 22, 26, 0.82);
  --red: #ff5a4d;
  --cyan: #00b7a8;
  --gold: #e7c84b;
  --blue: #7db4ff;
  --green: #9cc76c;
  --score-1: #f3efe7;
  --score-2: #00b7a8;
  --score-3: #ff5a4d;
  --score-4: #7db4ff;
  --shadow: rgba(0, 0, 0, 0.34);
  --font-display: "Tiempos", Georgia, "Times New Roman", serif;
  --font-body: "Sohne", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

#stage,
.grain {
  position: fixed;
  inset: 0;
}

#stage {
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  filter: saturate(1.28) contrast(1.08);
}

.grain {
  z-index: 1;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar,
.room {
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.backlink {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 13, 15, 0.34);
  color: var(--paper);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(16px);
}

.top-actions .backlink {
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(23px, 4vw, 44px);
  font-weight: 400;
  line-height: 1.02;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 13, 15, 0.34);
  color: var(--paper);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(18px);
  white-space: nowrap;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 18px rgba(255, 90, 77, 0.8);
}

body[data-running="true"] .pulse-dot {
  animation: pulse 1.6s ease-in-out infinite;
}

.room {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 410px);
  grid-template-rows: 1fr auto;
  gap: 18px;
  min-height: calc(100vh - 110px);
  padding: 0 24px 24px;
}

.wall-text {
  align-self: center;
  max-width: 860px;
  padding: min(7vh, 72px) min(5vw, 64px) 80px 0;
}

.room-number {
  margin-bottom: 12px;
  color: var(--score-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.wall-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.wall-meta span {
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(243, 239, 231, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--score-2) 16%, transparent), rgba(11, 13, 15, 0.34)),
    rgba(11, 13, 15, 0.34);
  color: var(--paper);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

h2 {
  max-width: 820px;
  margin-bottom: 24px;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(38px, 7vw, 104px);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.94;
  text-wrap: balance;
}

.wall-line {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--paper);
  font-size: clamp(16px, 2vw, 22px);
}

.control-dock,
.ledger,
.statement-sheet {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(243, 239, 231, 0.08), transparent 38%),
    linear-gradient(315deg, color-mix(in srgb, var(--score-2) 14%, transparent), transparent 42%),
    var(--glass);
  box-shadow:
    0 22px 70px var(--shadow),
    0 0 34px color-mix(in srgb, var(--score-3) 18%, transparent);
  backdrop-filter: blur(22px);
}

.control-dock {
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
}

.dock-head,
.ledger-head,
.input-row,
.range-line,
.icon-row {
  display: flex;
  align-items: center;
}

.dock-head,
.ledger-head {
  justify-content: space-between;
  gap: 12px;
}

.score-name {
  margin: 0;
  color: var(--bone);
  font-size: 20px;
  font-weight: 600;
}

.icon-row {
  gap: 8px;
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(243, 239, 231, 0.07);
  cursor: pointer;
  transition:
    transform 180ms var(--ease),
    border-color 180ms var(--ease),
    background 180ms var(--ease);
}

.icon-button.primary {
  border-color: color-mix(in srgb, var(--score-3) 72%, rgba(243, 239, 231, 0.2));
  background: color-mix(in srgb, var(--score-3) 28%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--score-3) 28%, transparent);
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(243, 239, 231, 0.38);
  background: rgba(243, 239, 231, 0.12);
}

.icon-button:active {
  transform: translateY(0);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 5;
  width: max-content;
  max-width: 160px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--glass-strong);
  color: var(--bone);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 160ms var(--ease),
    transform 160ms var(--ease);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.segmented button {
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
  transition:
    background 180ms var(--ease),
    color 180ms var(--ease);
}

.segmented button[aria-selected="true"] {
  background: linear-gradient(90deg, var(--score-2), var(--score-3));
  color: var(--ink);
}

.offering-form,
.field {
  display: grid;
  gap: 8px;
}

label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.input-row {
  gap: 8px;
}

input[type="text"] {
  min-width: 0;
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--bone);
  padding: 0 12px;
  outline: none;
}

input[type="text"]::placeholder {
  color: var(--faint);
}

input[type="text"]:focus,
input[type="range"]:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.range-line {
  gap: 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

output {
  min-width: 32px;
  color: var(--bone);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.switch {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: fit-content;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(243, 239, 231, 0.06);
  color: var(--paper);
  padding: 8px 11px;
  cursor: pointer;
}

.switch-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--faint);
}

.switch[aria-checked="true"] .switch-mark {
  background: var(--score-2);
  box-shadow:
    0 0 18px color-mix(in srgb, var(--score-2) 72%, transparent),
    0 0 34px color-mix(in srgb, var(--score-3) 42%, transparent);
}

.ledger {
  grid-column: 1 / -1;
  align-self: end;
  display: grid;
  grid-template-columns: minmax(140px, 190px) 1fr;
  gap: 16px;
  min-height: 112px;
  max-height: 156px;
  padding: 14px;
  overflow: hidden;
}

.room-traces {
  grid-column: 1 / -1;
}

.ledger-head {
  align-items: flex-start;
  flex-direction: column;
  justify-content: flex-start;
}

#timeCode {
  color: var(--bone);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

#ledgerList {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#ledgerList li {
  min-height: 82px;
  padding: 11px;
  border: 1px solid rgba(243, 239, 231, 0.12);
  border-radius: 8px;
  background: rgba(243, 239, 231, 0.06);
  color: var(--paper);
  font-size: 13px;
  overflow: hidden;
}

#ledgerList time {
  display: block;
  margin-bottom: 6px;
  color: var(--cyan);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.statement-panel {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: end;
  padding: 24px;
}

.statement-panel[hidden] {
  display: none;
}

.statement-scrim {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 5, 0.52);
}

.statement-sheet {
  position: relative;
  width: min(780px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 18px;
}

.statement-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.statement-head h2 {
  margin: 0;
  font-size: clamp(32px, 5vw, 60px);
  line-height: 0.98;
}

.statement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.statement-grid section {
  min-height: 190px;
  padding: 15px;
  border: 1px solid rgba(243, 239, 231, 0.12);
  border-radius: 8px;
  background: rgba(243, 239, 231, 0.06);
}

.statement-grid h3 {
  margin: 0 0 10px;
  color: var(--bone);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.statement-grid p {
  margin: 0;
  color: var(--paper);
  font-size: 15px;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.72;
  }

  50% {
    transform: scale(1.42);
    opacity: 1;
  }
}

@media (max-width: 880px) {
  body {
    overflow: auto;
  }

  .topbar {
    padding: 18px;
  }

  .room {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-height: auto;
    padding: 0 18px 18px;
  }

  .wall-text {
    padding: 36px 0 22px;
  }

  .control-dock {
    align-self: stretch;
  }

  .ledger {
    grid-template-columns: 1fr;
    max-height: none;
  }

  #ledgerList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statement-panel {
    place-items: stretch;
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-pill {
    width: fit-content;
  }

  h2 {
    font-size: clamp(38px, 17vw, 72px);
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #ledgerList {
    grid-template-columns: 1fr;
  }

  .statement-grid {
    grid-template-columns: 1fr;
  }
}

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