:root {
  color-scheme: light;
  --paper: #f5f1e8;
  --ink: #101010;
  --muted: #68635b;
  --line: #d8d0c2;
  --surface: #fffaf1;
  --surface-strong: #ffffff;
  --accent: #e64c3c;
  --accent-two: #087f8c;
  --focus: #b6e22e;
  --shadow: 0 22px 60px rgba(16, 16, 16, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16, 16, 16, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(16, 16, 16, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 56px;
}

.workspace {
  display: grid;
  gap: 20px;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(340px, 0.72fr);
  min-height: 420px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stage-media {
  position: relative;
  min-width: 0;
  border-right: 2px solid var(--ink);
  background: #000;
  aspect-ratio: 16 / 9;
}

.stage-poster,
.stage-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.stage-poster {
  display: block;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: #000;
}

.stage-poster img,
.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.stage-info {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 20px;
  min-width: 0;
  max-height: min(72vw, 700px);
  padding: 28px;
  overflow: hidden;
}

.track-head {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.kicker {
  margin: 0;
  color: var(--accent-two);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.stage-info h1 {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: keep-all;
  font-size: clamp(30px, 3.4vw, 52px);
  line-height: 1.05;
  letter-spacing: 0;
}

.watch-link {
  width: fit-content;
  min-height: 34px;
  padding: 7px 10px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.guestbook {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
  padding-top: 18px;
  border-top: 2px solid var(--ink);
}

.guestbook-head,
.guest-meta,
.admin-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.guestbook h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0;
}

.guest-form {
  display: grid;
  grid-template-columns: minmax(112px, 0.38fr) minmax(0, 1fr) 56px;
  gap: 8px;
}

.guest-input {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.guest-input span,
.guest-meta,
.admin-panel {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.guest-input input,
.guest-input textarea {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 11px 12px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  line-height: 1.3;
}

.guest-input textarea {
  overflow: auto;
  resize: none;
}

.guest-input input:disabled,
.guest-input textarea:disabled,
.submit-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.guest-input input:focus,
.guest-input textarea:focus,
.edit-form textarea:focus {
  outline: 3px solid var(--focus);
  outline-offset: 0;
}

.submit-button,
.ghost-button,
.edit-entry,
.delete-entry {
  min-height: 34px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.submit-button {
  align-self: end;
  width: 56px;
  height: 48px;
  padding: 0;
  background: var(--focus);
}

.ghost-button {
  padding: 0 10px;
}

.delete-entry {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 8px;
  color: var(--accent);
}

.guest-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.guest-meta {
  justify-content: flex-start;
}

.guest-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.56);
}

.guest-entry p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.35;
}

.entry-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.entry-actions {
  display: flex;
  gap: 6px;
}

.entry-body small {
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.entry-history {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.edit-form {
  grid-column: 1 / -1;
  display: grid;
  gap: 7px;
}

.edit-form textarea {
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  resize: vertical;
}

.edit-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.edit-controls span {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cancel-edit,
.save-edit {
  min-height: 30px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.save-edit {
  background: var(--focus);
}

.playlist {
  padding-top: 4px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.card:hover,
.card:focus-visible,
.card.is-active {
  transform: translateY(-3px);
  background: #fffdf8;
  box-shadow: 5px 5px 0 var(--accent);
  outline: 0;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 0;
  background: #000;
}

.card-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
}

.card-copy strong,
.card-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-copy strong {
  font-size: 15px;
}

.card-copy span {
  color: var(--muted);
  font-size: 13px;
}

.playlist-break {
  grid-column: 1 / -1;
  display: block;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 2px solid var(--ink);
}

.playlist-break span {
  display: none;
}

.playlist-break strong {
  font-size: 20px;
  font-weight: 900;
  text-transform: none;
}

.empty {
  margin: 0;
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 1080px) {
  .stage {
    grid-template-columns: 1fr;
  }

  .stage-media {
    border-right: 0;
    border-bottom: 2px solid var(--ink);
  }

  .stage-info {
    max-height: none;
  }

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

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1240px);
    padding-top: 10px;
  }

  .stage-info {
    padding: 20px;
  }

  .stage-info h1 {
    font-size: 32px;
  }

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

@media (max-width: 520px) {
  .guest-form {
    grid-template-columns: 1fr;
  }

  .submit-button {
    width: 100%;
  }

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