/* RISING ISLAND · R24 360 PREVIEW FULL RESPONSIVE STYLESHEET */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-dark: #192529;
  --panel-bg: rgba(20, 33, 37, 0.88);
  --panel-border: rgba(255, 255, 255, 0.25);
  --text-main: #f6f1e9;
  --accent-gold: #d8be8f;
  --accent-pill: #e9d5b3;
  --cover-bg: #f3f0e9;
  --cover-text: #263b3a;
  --cover-border: rgba(38, 59, 58, 0.15);
  --btn-primary: #294541;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text-main);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Noto Sans TC", sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

/* ========================================================
   360 CANVAS & VIEWER CONTROLS (RESPONSIVE & TOUCH-READY)
   ======================================================== */
#view {
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
  cursor: grab;
}

#view:active {
  cursor: grabbing;
}

/* Top Navigation Bar */
.bar {
  position: fixed;
  left: max(16px, env(safe-area-inset-left, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  top: max(14px, env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  z-index: 5;
}

.brand {
  font-weight: 500;
  letter-spacing: 0.15em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.pill {
  display: inline-block;
  border: 1px solid rgba(228, 207, 167, 0.45);
  border-radius: 12px;
  padding: 2px 8px;
  color: var(--accent-pill);
  font-size: 11px;
  letter-spacing: 0.08em;
  background: rgba(20, 33, 37, 0.6);
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

select, button {
  padding: 8px 14px;
  min-height: 40px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: #fff;
  font: inherit;
  font-size: 13px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

select:hover, button:hover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(26, 43, 48, 0.95);
}

button:active {
  transform: scale(0.97);
}

select {
  max-width: 260px;
  text-overflow: ellipsis;
  outline: none;
}

optgroup {
  background: #142125;
  color: #d8be8f;
  font-style: normal;
  font-weight: 600;
}

option {
  background: #192529;
  color: #fff;
  font-weight: normal;
}

/* Floating Status Notes */
.note {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  left: max(20px, env(safe-area-inset-left, 0px));
  padding: 10px 14px;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  max-width: 420px;
  z-index: 5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#label {
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.hint {
  color: #c0ccc7;
  font-size: 11px;
}

.status {
  font-size: 11px;
  color: #e5b882;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Zoom Slider */
.zoom {
  position: fixed;
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 14px;
  min-height: 40px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.zoom input[type="range"] {
  width: 90px;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

/* Loading Indicator */
.loading-badge {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 33, 37, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 13px;
  color: #fff;
  z-index: 8;
  display: none;
  backdrop-filter: blur(10px);
}

.loading-badge.active {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#error {
  position: fixed;
  inset: auto 20px 80px 20px;
  padding: 12px;
  background: rgba(180, 40, 40, 0.9);
  color: #fff;
  border-radius: 8px;
  display: none;
  text-align: center;
  z-index: 9;
}

/* ========================================================
   CINEMATIC COVER / LANDING PAGE (ALL VIEWPORTS)
   ======================================================== */
.cover {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--cover-bg);
  color: var(--cover-text);
  user-select: text;
  -webkit-user-select: text;
}

.cover[hidden] {
  display: none;
}

/* Header */
.cover-header {
  width: 94vw;
  max-width: 1720px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--cover-border);
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.wordmark {
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: 24px;
  letter-spacing: 0.18em;
  font-weight: 600;
  line-height: 1.1;
}

.wordmark span {
  display: inline-block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 9px;
  letter-spacing: 0.28em;
  margin-left: 8px;
  color: #556c65;
  vertical-align: middle;
}

.preview-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.edition {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #64756e;
  border: 1px solid rgba(38, 59, 58, 0.25);
  border-radius: 12px;
  padding: 2px 8px;
  background: rgba(38, 59, 58, 0.04);
}

.preview-notice {
  font-size: 11px;
  color: #786c5a;
  letter-spacing: 0.02em;
}

.enter-top {
  display: none;
}

/* Main Container: Wide 94vw */
.cover-main {
  width: 94vw;
  max-width: 1720px;
  margin: 0 auto;
  padding: 0 0 calc(36px + env(safe-area-inset-bottom, 0px));
}

/* First Screen: Full Cinematic Presentation */
.first-screen {
  width: 100%;
  margin: 0 0 12px;
}

.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 10px 0 8px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: #5e746a;
  margin: 0 0 2px;
  font-weight: 600;
}

.intro h1 {
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: clamp(18px, 1.9vw, 26px);
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.subtitle {
  font-size: 12px;
  color: #5d6d66;
  margin: 2px 0 0;
}

.enter {
  background: var(--btn-primary);
  color: #fff;
  border: 0;
  padding: 10px 22px;
  min-height: 42px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 13px;
  letter-spacing: 0.06em;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(33, 59, 51, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.enter:hover {
  background: #1f3733;
  box-shadow: 0 6px 22px rgba(33, 59, 51, 0.3);
  transform: translateY(-1px);
}

/* Grand Panoramic Hero Image */
.hero {
  margin: 0;
  width: 100%;
}

.hero-frame {
  width: 100%;
  max-height: calc(100vh - 165px);
  display: flex;
  justify-content: center;
  align-items: center;
  background: #dce2df;
  border-radius: 4px;
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.09);
  overflow: hidden;
}

.hero img {
  width: 100%;
  max-height: calc(100vh - 165px);
  height: auto;
  object-fit: contain;
  aspect-ratio: auto;
  display: block;
}

.cover figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 6px;
  font-size: 11px;
  color: #63726a;
}

/* Below the Fold */
.below-screen {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--cover-border);
}

.second {
  margin: 0 0 24px;
  width: 100%;
}

.second-frame {
  width: 100%;
  background: #dce2df;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.second img {
  width: 100%;
  height: auto;
  object-fit: contain;
  aspect-ratio: auto;
  display: block;
}

.cover footer {
  font-size: 11px;
  line-height: 1.8;
  color: #7b8882;
  border-top: 1px solid var(--cover-border);
  padding-top: 16px;
  margin-top: 16px;
}

/* ========================================================
   TABLET RESPONSIVE STYLES (1024x768 & 768x1024)
   ======================================================== */
@media (min-width: 641px) and (max-width: 1024px) {
  .cover-header {
    width: 93vw;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
  }

  .cover-main {
    width: 93vw;
  }

  .intro h1 {
    font-size: 22px;
  }

  /* Ensure touch friendliness for tablet taps */
  select, button {
    min-height: 44px;
    font-size: 13px;
    padding: 10px 14px;
  }

  .enter {
    min-height: 44px;
    padding: 12px 20px;
  }

  .hero-frame {
    max-height: calc(100vh - 160px);
  }

  .hero img {
    max-height: calc(100vh - 160px);
  }

  .bar {
    top: max(12px, env(safe-area-inset-top, 0px));
  }

  .note {
    max-width: 360px;
    font-size: 11px;
  }
}

/* ========================================================
   MOBILE RESPONSIVE STYLES (max-width: 640px)
   ======================================================== */
@media (max-width: 640px) {
  .cover-header {
    width: 92vw;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
  }

  .wordmark {
    font-size: 20px;
  }

  .header-left {
    gap: 8px;
  }

  .preview-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .preview-notice {
    font-size: 10px;
  }

  .cover-main {
    width: 92vw;
  }

  .intro {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 0 8px;
  }

  .enter-hero {
    width: 100%;
    min-height: 46px;
    justify-content: space-between;
    padding: 12px 18px;
    font-size: 14px;
  }

  .hero-frame {
    max-height: none;
  }

  .hero img {
    max-height: none;
  }

  .cover figcaption {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  /* 360 Viewer Controls on Mobile (Ergonomic Touch Layout) */
  .bar {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    top: max(8px, env(safe-area-inset-top, 0px));
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .brand {
    justify-content: space-between;
    font-size: 13px;
  }

  .controls {
    display: flex;
    gap: 6px;
    width: 100%;
  }

  select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    font-size: 13px;
    padding: 0 10px;
    min-height: 44px;
  }

  button {
    flex: 0 0 auto;
    font-size: 13px;
    padding: 0 12px;
    min-height: 44px;
  }

  #full {
    display: none;
  }

  .note {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    max-width: none;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px));
    padding: 8px 12px;
    font-size: 11px;
  }

  #label {
    font-size: 13px;
  }

  .hint {
    display: none;
  }

  .status {
    font-size: 10px;
  }

  .zoom {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    padding: 4px 10px;
    min-height: 38px;
    font-size: 11px;
  }

  .zoom input[type="range"] {
    width: 70px;
  }
}