:root {
  --page-bg: #1b1b1b;
  --frame-bg: #000000;
  --bar-bg: #000000;
  --top-bar-bg: rgba(0, 0, 0, 0.96);

  --text: #ffffff;
  --muted: rgba(255,255,255,0.62);
  --soft: rgba(255,255,255,0.38);

  --radius: 18px;
  --frame-size: 14px;

  --top-bar-height: 74px;
  --bottom-bar-height: 105px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  background: var(--page-bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}

#app-shell {
  width: 100%;
  height: 100%;
  padding: 18px;
}

#viewer-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--frame-bg);
  border: var(--frame-size) solid var(--frame-bg);
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(0,0,0,0.45);
}

/*
  Matterport remains full-size underneath.
  Our top and bottom bars sit above it.
*/

#showcase-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

/* TOP BAR */

#top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;

  z-index: 1000;

  height: var(--top-bar-height);
  padding: 0 24px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  background: var(--top-bar-bg);
  border-bottom: 1px solid rgba(255,255,255,0.10);

  box-shadow: 0 8px 25px rgba(0,0,0,0.24);
}

#venue-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#venue-label {
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--soft);
  margin-bottom: 3px;
}

#venue-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  letter-spacing: 0.8px;
  color: #ffffff;
}

#top-bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

#top-bar-note {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
}

/* WATERMARK */

#watermark {
  position: absolute;
  top: 92px;
  right: 26px;

  z-index: 900;

  display: flex;
  align-items: baseline;
  gap: 7px;

  color: rgba(255,255,255,0.18);

  pointer-events: none;
  user-select: none;
}

.watermark-main {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.watermark-sub {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
}

/* BOTTOM BAR */

#bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  z-index: 1000;

  height: var(--bottom-bar-height);

  display: grid;
  grid-template-columns: 220px 1fr 340px;
  align-items: center;

  padding: 0 22px;

  background: var(--bar-bg);
  border-top: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.28);

  color: white;
}

#brand-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-main {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.6px;
}

.brand-sub {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--muted);
}

#tour-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

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

/* BUTTONS */

button {
  min-height: 40px;
  padding: 8px 14px;

  color: #ffffff;
  background: transparent;

  border: 1px solid rgba(255,255,255,0.32);
  border-radius: 9px;

  font-size: 13px;
  cursor: pointer;

  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    opacity 0.18s ease;
}

button:hover:not(:disabled) {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.55);
}

button:disabled {
  opacity: 0.28;
  cursor: default;
}

#continue-button {
  min-width: 142px;
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  font-weight: 600;
}

#continue-button:hover:not(:disabled) {
  background: rgba(255,255,255,0.86);
}

#chapter-display {
  min-width: 48px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

/* STORY CARD */

#story-card {
  position: absolute;
  z-index: 600;

  left: 50%;
  bottom: calc(var(--bottom-bar-height) + 28px);

  transform: translateX(-50%) translateY(12px);

  width: min(560px, calc(100vw - 100px));
  padding: 26px 30px 24px;

  color: #ffffff;
  background: rgba(0,0,0,0.84);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;

  box-shadow: 0 18px 55px rgba(0,0,0,0.42);

  opacity: 0;
  pointer-events: none;

  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

#story-card.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

#story-close {
  position: absolute;
  top: 12px;
  right: 12px;

  min-height: 32px;
  width: 32px;

  padding: 0;
  border: 0;
  background: transparent;

  font-size: 24px;
  line-height: 1;
  color: rgba(255,255,255,0.65);
}

#story-title {
  margin: 0 35px 10px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  font-weight: normal;
}

#story-text {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.5;
  color: rgba(255,255,255,0.88);
}

#story-actions {
  margin-top: 18px;
}

/* DEBUG */

#debug {
  position: absolute;
  z-index: 500;

  left: 18px;
  bottom: calc(var(--bottom-bar-height) + 12px);

  display: flex;
  gap: 6px;

  padding: 5px 8px;

  background: rgba(0,0,0,0.58);
  color: rgba(255,255,255,0.55);

  border-radius: 7px;

  font-family: monospace;
  font-size: 10px;

  pointer-events: none;
}

/* RESPONSIVE */

@media (max-width: 900px) {
  :root {
    --top-bar-height: 70px;
    --bottom-bar-height: 138px;
  }

  #app-shell {
    padding: 8px;
  }

  #viewer-frame {
    border-width: 8px;
    border-radius: 14px;
  }

  #venue-name {
    font-size: 22px;
  }

  #top-bar-note {
    font-size: 10px;
  }

  #watermark {
    top: 84px;
    right: 18px;
  }

  #bottom-bar {
    grid-template-columns: 1fr auto;
    grid-template-rows: 44px 78px;
    padding: 7px 12px;
  }

  #brand-block {
    grid-column: 1;
    grid-row: 1;
  }

  #utility-controls {
    grid-column: 2;
    grid-row: 1;
  }

  #tour-controls {
    grid-column: 1 / span 2;
    grid-row: 2;
  }

  #return-button {
    display: none;
  }

  .brand-main {
    font-size: 20px;
  }

  .brand-sub {
    font-size: 8px;
  }

  #story-card {
    width: calc(100vw - 60px);
    padding: 22px 22px 20px;
  }

  #story-title {
    font-size: 26px;
  }

  #story-text {
    font-size: 16px;
  }
}[hidden] { display:none !important; }
#story-card { max-height:calc(100% - var(--top-bar-height) - var(--bottom-bar-height) - 40px); overflow:auto; }
#story-text {white-space:pre-line;}
.media-preview img,.media-preview video,.media-preview audio {display:block;max-width:100%;max-height:260px;margin-top:16px;}
#access-panel {position:fixed;z-index:2000;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:30px;background:#111;text-align:center;}
#access-panel h1 {font-family:Georgia,serif;font-weight:normal;}
#access-panel input {display:block;padding:12px;margin:12px 0;background:#222;color:white;border:1px solid #777;border-radius:8px;}
:focus-visible {outline:2px solid white;outline-offset:3px;}
#top-bar-note {max-width:350px;line-height:1.5;}
@media(max-width:500px){#top-bar{padding:0 12px;}#venue-name{font-size:18px;}#top-bar-note{max-width:130px;font-size:9px;}#tour-controls{gap:4px;}button{padding:8px;font-size:12px;}#continue-button{min-width:105px;}#brand-block{gap:4px;}.brand-main{font-size:17px;}.brand-sub{font-size:7px;}#story-card{width:calc(100vw - 50px);}}

.video-fullscreen {display:inline-block;margin:8px 0;padding:8px 14px;cursor:pointer;}
.video-fullscreen-message {display:block;font-size:12px;line-height:1.5;}
.media-preview video:fullscreen {width:100%;height:100%;max-width:none;max-height:none;margin:0;object-fit:contain;background:#000;}
.media-preview video:-webkit-full-screen {width:100%;height:100%;max-width:none;max-height:none;margin:0;object-fit:contain;background:#000;}
