* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  overflow: hidden;
  background: #000;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: #333;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

canvas { display: block; }

/* Start Screen */
#start-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  text-align: center;
  color: #fff;
}

.start-content { max-width: 420px; padding: 2rem; }
.start-logo { font-size: 2.8rem; font-weight: 700; letter-spacing: 0.15em; margin-bottom: 0.3rem; }
.start-subtitle { font-size: 0.9rem; font-weight: 300; letter-spacing: 0.2em; color: rgba(255,255,255,0.5); margin-bottom: 2rem; }
.start-divider { width: 60px; height: 1px; background: rgba(255,255,255,0.2); margin: 0 auto 2rem; }
.start-exhibition { margin-bottom: 2.5rem; }
.start-now { display: block; font-size: 0.7rem; letter-spacing: 0.3em; text-transform: uppercase; color: #e74c8b; margin-bottom: 0.5rem; }
.start-title { display: block; font-size: 1.6rem; font-weight: 600; margin-bottom: 0.3rem; }
.start-artist { display: block; font-size: 0.85rem; font-weight: 300; color: rgba(255,255,255,0.6); }

.enter-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 0.9rem 3rem;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 1.5rem;
  font-family: inherit;
}

.enter-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.7);
}

.start-hint { font-size: 0.7rem; color: rgba(255,255,255,0.3); letter-spacing: 0.1em; }

/* Crosshair */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
  z-index: 10;
  display: none;
}

#crosshair::before,
#crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.5);
}

#crosshair::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  transform: translateY(-50%);
}

#crosshair::after {
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  transform: translateX(-50%);
}

/* UI Buttons */
#ui-buttons {
  position: fixed;
  top: 16px;
  right: 16px;
  display: none;
  gap: 8px;
  z-index: 60;
}

.ui-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  pointer-events: auto;
}

.ui-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.ui-btn kbd {
  font-family: inherit;
  font-size: 0.5rem;
  position: absolute;
  bottom: 2px;
  right: 3px;
  opacity: 0.5;
}

/* Instructions */
#instructions {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  z-index: 10;
  pointer-events: none;
  display: none;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Logo */
#logo-link {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 60;
  display: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s;
  pointer-events: auto;
}

#logo-link:hover {
  color: #fff;
}

/* ─── Visitor Counter ────────────────────────────────────── */
#visitor-counter {
  position: fixed;
  bottom: 36px;
  left: 16px;
  color: rgba(255,255,255,0.4);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  z-index: 10;
  display: none;
  pointer-events: none;
}

/* ─── BGM Button ─────────────────────────────────────────── */
#btn-bgm .bgm-icon-on { display: none; }
#btn-bgm .bgm-icon-off { display: inline; }
#btn-bgm.active .bgm-icon-on { display: inline; }
#btn-bgm.active .bgm-icon-off { display: none; }
#btn-bgm.active { background: rgba(255,255,255,0.25); color: #fff; }

/* ─── Visit Timer ────────────────────────────────────────── */
#visit-timer {
  position: fixed;
  left: 16px;
  bottom: 16px;
  display: none;
  z-index: 10;
  background: rgba(0,0,0,0.4);
  padding: 4px 10px;
  border-radius: 6px;
  color: rgba(255,255,255,0.5);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ─── Overlay Panels ─────────────────────────────────────── */
.overlay-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 250;
  backdrop-filter: blur(6px);
}

.overlay-panel.active {
  display: flex;
}

.overlay-content {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2.5rem;
  max-width: 440px;
  width: 90%;
  position: relative;
  color: #ddd;
}

.overlay-content h3 {
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 1.5rem;
}

.overlay-content h4 {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #888;
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
}

.overlay-content p {
  font-size: 0.85rem;
  line-height: 2;
  color: #bbb;
}

.overlay-content p strong {
  color: #fff;
  font-weight: 500;
  display: inline-block;
  min-width: 120px;
}

.overlay-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  font-weight: 200;
  line-height: 1;
  transition: color 0.2s;
}

.overlay-close:hover {
  color: #fff;
}

.info-details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1.2rem;
  font-size: 0.85rem;
}

.info-details dt {
  color: #888;
  font-weight: 400;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  padding-top: 2px;
}

.info-details dd {
  color: #ddd;
  line-height: 1.6;
}

.exhibition-list {
  list-style: none;
  counter-reset: exlist;
  padding: 0;
}

.exhibition-list li {
  counter-increment: exlist;
  font-size: 0.85rem;
  color: #ccc;
  line-height: 2;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.exhibition-list li::before {
  content: counter(exlist) '.';
  color: #666;
  min-width: 1.5em;
}

.exhibition-list li span {
  color: #666;
  font-size: 0.75rem;
}

/* ─── Share Overlay ──────────────────────────────────────── */
.share-content { max-width: 360px; }
.share-buttons { display: flex; flex-direction: column; gap: 10px; }

.share-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #ddd;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  font-family: inherit;
}

.share-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.share-icon { font-size: 1.2rem; width: 24px; text-align: center; flex-shrink: 0; }
.share-twitter:hover { background: rgba(29,161,242,0.2); }
.share-facebook:hover { background: rgba(24,119,242,0.2); }

#help-mobile { display: none; }

@media (max-width: 768px) {
  #help-pc { display: none !important; }
  #help-mobile { display: block !important; }
  .overlay-content { padding: 1.8rem; }
  #visit-timer { left: 10px; bottom: 200px; }
}

/* ─── Nickname Modal ─────────────────────────────────────── */
#nickname-modal { display: none; }
#nickname-modal.overlay-panel { z-index: 260; }
#nickname-input:focus { border-color: #e74c8b; }

/* ─── Artwork Modal ──────────────────────────────────────── */
.artwork-detail { max-width: 380px; }
.artwork-detail h3 { font-size: 1.2rem; font-weight: 600; color: #fff; margin-bottom: 0.3rem; }
#artwork-like-btn:hover, #artwork-like-btn.liked { background: #e74c8b; color: #fff; }

/* ─── Loading Overlay ────────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.loading-spinner {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: #e74c8b;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1.5rem;
}

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

#loading-text {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 0.15em;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Mobile Controls */
#joystick-zone {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 180px;
  height: 180px;
  z-index: 50;
  display: none;
  pointer-events: auto;
}

#joystick-base {
  position: absolute;
  left: 30px;
  bottom: 30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#joystick-thumb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: background 0.1s;
}

#joystick-thumb.active {
  background: rgba(255, 255, 255, 0.5);
}

#look-zone {
  position: fixed;
  right: 0;
  top: 0;
  width: calc(100% - 180px);
  height: 100%;
  z-index: 45;
  display: none;
  pointer-events: auto;
}

/* Mobile */
@media (max-width: 768px) {
  #start-screen h1 {
    font-size: 1.8rem;
    letter-spacing: 0.3em;
  }

  #start-screen h2 {
    font-size: 0.7rem;
    margin-bottom: 2rem;
  }

  #instructions {
    font-size: 0.6rem;
    bottom: 200px;
  }
}

/* ─── Guestbook ──────────────────────────────────────────── */
.gb-input {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.08);
  color: #ddd;
  font-family: inherit;
  resize: none;
}

.gb-input:focus {
  outline: none;
  border-color: #e74c8b;
}

#gb-emoji-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  justify-content: center;
}

.gb-emoji {
  font-size: 1.3rem;
  background: none;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.gb-emoji.selected,
.gb-emoji:hover {
  border-color: #e74c8b;
}

.gb-submit-btn {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.6rem;
  background: #e74c8b;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.gb-submit-btn:hover {
  background: #d63a7a;
}

#gb-recent {
  margin-top: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.gb-entry {
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
  text-align: left;
}

.gb-entry strong { color: #ccc; }
.gb-entry .gb-date { color: #aaa; font-size: 0.7rem; }
.gb-entry .gb-msg { color: #ddd; }

/* ─── Minimap ────────────────────────────────────────────── */
#minimap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 150px;
  height: 150px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  z-index: 50;
  display: none;
  pointer-events: none;
}

@media (pointer: coarse), (max-width: 768px) {
  #minimap { bottom: auto; top: 70px; right: 10px; width: 120px; height: 120px; }
  .start-logo { font-size: 1.8rem !important; }
  .start-title { font-size: 1.2rem !important; }
}
