:root {
  --bg: #0e0d0c;
  --oak: #2b1e14;
  --oak-light: #3d2b1c;
  --steel: #8a8f96;
  --steel-light: #c7cbd1;
  --candle: #d99a4e;
  --text: #ece7df;
  --text-dim: #a89f92;
  --danger: #a23b3b;
  --success: #4a7a5c;
  --radius: 6px;
  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(9,7,6,0.7) 0%, rgba(9,7,6,0.2) 260px, rgba(9,7,6,0.4) 100%),
    radial-gradient(ellipse at center, rgba(20,17,15,0.25) 0%, rgba(12,11,10,0.58) 70%),
    url("../img/tile-bg.webp") 0 0 / 420px auto repeat;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

.page-header {
  text-align: center;
  padding: 3rem 1.5rem 1.5rem;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: 0.06em;
  margin: 0 0 0.5rem;
  color: var(--steel-light);
  text-shadow: 0 0 18px rgba(217, 154, 78, 0.15);
}

.subhead {
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto;
  font-size: 0.95rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
}

#table-wrap {
  position: relative;
  width: 100%;
  min-height: 640px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#table-oval {
  position: relative;
  width: min(700px, 78vw);
  aspect-ratio: 2 / 1;
  background: #14100c url("../img/table.webp?v=2") center / cover no-repeat;
  border-radius: 6px;
  border: 10px solid #1c130c;
  box-shadow:
    inset 0 0 70px rgba(0,0,0,0.45),
    0 24px 60px rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-center-label {
  display: none;
}

#seats {
  position: absolute;
  inset: 0;
}

.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 108px;
  text-align: center;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  padding: 0;
}

.seat-marker {
  width: 92px;
  height: auto;
  aspect-ratio: 400 / 177;
  margin: 0 auto 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 0;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.seat-plaque {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.65));
}

.seat:hover .seat-marker,
.seat:focus-visible .seat-marker {
  transform: translateY(-2px) scale(1.04);
  filter:
    drop-shadow(0 5px 5px rgba(0, 0, 0, 0.72))
    drop-shadow(0 0 5px rgba(199, 203, 209, 0.18));
}

.seat-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--steel-light);
  line-height: 1.2;
}

.seat-role {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.2;
}

#character-panel {
  position: fixed;
  inset: 0;
  background: rgba(6, 5, 4, 0.82);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  overflow-y: auto;
  z-index: 50;
}

#character-panel.hidden { display: none; }

#character-panel-content {
  background: #17130f;
  border: 1px solid #3a2c1e;
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  padding: 2rem;
  position: relative;
}

#close-panel {
  position: fixed;
  top: 4vh;
  right: max(1rem, calc(50vw - 280px - 3rem));
  background: none;
  border: 1px solid var(--steel);
  color: var(--steel-light);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  z-index: 51;
}

.char-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--steel-light);
  margin: 0 0 0.2rem;
}

.char-role {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

.tab-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid #3a2c1e;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 0.6rem 0.2rem;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--candle);
  border-bottom-color: var(--candle);
}

.tab-panel.hidden { display: none; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 1rem 0 0.35rem;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  background: #0e0b09;
  border: 1px solid #3a2c1e;
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.honeypot-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

.form-note {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

button.submit-btn {
  margin-top: 1.4rem;
  background: linear-gradient(145deg, #4a3220, #2b1e14);
  border: 1px solid var(--candle);
  color: var(--text);
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

button.submit-btn:hover {
  box-shadow: 0 0 16px rgba(217, 154, 78, 0.35);
}

button.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.qa-entry {
  border-top: 1px solid #2a2019;
  padding: 1rem 0;
}

.qa-question {
  font-weight: 600;
  color: var(--steel-light);
  margin: 0 0 0.35rem;
}

.qa-asker {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0 0 0.5rem;
}

.qa-answer {
  white-space: pre-wrap;
  line-height: 1.5;
}

.empty-note {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 1rem 0;
}

#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #17130f;
  border: 1px solid var(--candle);
  color: var(--text);
  padding: 0.8rem 1.3rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  z-index: 100;
  max-width: 90vw;
}

#toast.error {
  border-color: var(--danger);
}

#toast.hidden {
  display: none;
}

.page-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  padding: 1rem 1.5rem 3rem;
}

/* Responsive: below a certain width, seats collapse to a scrollable list rather
   than trying to cram an ellipse layout onto a phone screen. */
@media (max-width: 640px) {
  #table-wrap {
    min-height: auto;
  }

  #table-oval {
    display: none;
  }

  #seats {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem 0.5rem;
  }

  .seat {
    position: static;
    transform: none;
    width: auto;
  }

  #close-panel {
    right: 1rem;
  }
}

/* ---------------------------------------------------------------------
   Table notes: real battered paper + My Light dagger.
   The paper and dagger are treated as ONE physical tabletop artifact.
   --------------------------------------------------------------------- */

#table-notes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.table-note {
  position: absolute;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  width: 120px;
  pointer-events: auto;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  z-index: 1;
  transition: transform 0.15s ease, filter 0.15s ease;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.55));
}

.table-note:hover,
.table-note:focus-visible {
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1.09);
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.65));
}

.note-paper {
  display: block;
  position: relative;
  width: 120px;
  height: auto;
  z-index: 2;
}

.note-paper-image {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.note-name {
  position: absolute;
  left: 50%;
  top: 51%;
  transform: translate(-50%, -50%);
  width: 84%;
  text-align: center;

  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.76rem;
  font-style: italic;
  font-weight: normal;
  line-height: 1;

  color: #2c2013;
  white-space: nowrap;
  pointer-events: none;
  z-index: 4;
}

/*
   The My Light dagger crosses the parchment.
   Its blade enters the upper-left area of the note instead of
   hovering above it.
*/
.note-dagger {
  position: absolute;
  width: 128px;
  height: auto;

  left: -20px;
  top: -20px;

  transform: rotate(calc(-7deg + var(--drot, 0deg)));
  transform-origin: 52% 58%;

  pointer-events: none;
  z-index: 3;

  filter:
    drop-shadow(2px 4px 2px rgba(0, 0, 0, 0.72))
    drop-shadow(0 1px 1px rgba(0, 0, 0, 0.8));
}

@media (max-width: 640px) {
  #table-notes {
    display: none;
  }
}

/* ---------------------------------------------------------------------
   Note detail modal (reuses the character-panel visual language)
   --------------------------------------------------------------------- */

#note-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 5, 4, 0.82);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  overflow-y: auto;
  z-index: 50;
}

#note-modal.hidden {
  display: none;
}

#note-modal-content {
  background: #17130f;
  border: 1px solid #3a2c1e;
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  padding: 2rem;
  position: relative;
}

#close-note-modal {
  position: fixed;
  top: 4vh;
  right: max(1rem, calc(50vw - 280px - 3rem));
  background: none;
  border: 1px solid var(--steel);
  color: var(--steel-light);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  z-index: 51;
}

.note-modal-entry {
  border-top: none;
  padding-top: 0;
}