/* === Infinitus Live - YouTube Live Style === */
:root {
  --c-bg: #0f0f0f;
  --c-surface: #1a1a1a;
  --c-card: #272727;
  --c-card-hover: #3a3a3a;
  --c-text: #f1f1f1;
  --c-text-sub: #aaaaaa;
  --c-border: #3f3f3f;
  --c-accent: #3ea6ff;
  --c-live: #ff0000;
  --c-live-glow: rgba(255, 0, 0, 0.4);
  --c-success: #2ba640;
  --c-warning: #ffad1f;
  --c-danger: #ff4e45;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 6px rgba(0,0,0,0.3);
  --font: 'Noto Sans JP', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-bg: #0f0f0f;
}

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

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* Festival mode */
body.festival-mode {
  --header-bg: #1a0505;
}

/* === Header (horizontal bar) === */
.header {
  background: var(--header-bg);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--c-border);
}
.header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
}
.header .subtitle {
  font-size: 0.75rem;
  color: var(--c-text-sub);
}
.header .live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--c-text-sub);
  flex-shrink: 0;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-live);
  animation: livePulse 1.5s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--c-live-glow); }
  50% { box-shadow: 0 0 0 4px transparent; }
}

body.festival-mode .header {
  background: linear-gradient(135deg, #1a0505, #2d0a0a);
  border-bottom-color: #3d1111;
}

/* === Stream Grid (YouTube Style Cards) === */
.stream-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 24px 20px;
  max-width: 1400px;
  margin: 0 auto;
}
@media (min-width: 1200px) {
  .stream-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

.stream-card {
  cursor: pointer;
  background: transparent;
  border-radius: 0;
}

.stream-thumb-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-surface);
}
.stream-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}
.stream-card:hover .stream-thumb-img {
  transform: scale(1.03);
}
.stream-no-thumb {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #3f3f3f;
}
.stream-live-pill {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: var(--c-live);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.stream-time-pill {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
}
.stream-time-pill:empty { display: none; }

.stream-details {
  padding: 10px 2px 16px;
}
.stream-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stream-subtitle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.stream-subtitle {
  font-size: 0.8rem;
  color: var(--c-text-sub);
}
.stream-share-btn {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--c-text);
  transition: background 0.15s;
  flex-shrink: 0;
}
.stream-share-btn:hover {
  background: var(--c-accent);
  border-color: var(--c-accent);
}

/* === Player (Full Page - YouTube Live Style) === */
.player-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-bg);
  z-index: 200;
  display: none;
  flex-direction: column;
}
.player-overlay.active { display: flex; }

.player-full {
  display: flex;
  width: 100%;
  height: 100%;
}
.player-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #000;
}
.player-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.player-close {
  background: none;
  border: none;
  color: var(--c-text-sub);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  flex-shrink: 0;
  font-family: var(--font);
}
.player-close:hover {
  background: var(--c-card);
  color: #fff;
}
.player-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-guide-btn {
  background: none;
  border: 1px solid var(--c-border);
  color: var(--c-text-sub);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.player-guide-btn:hover {
  background: var(--c-card);
  color: #fff;
}

.player-video-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #000;
}
.player-video-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Fullscreen: video-wrapだけが全画面になる */
.player-video-wrap:fullscreen,
.player-video-wrap:-webkit-full-screen {
  background: #000;
}
.player-video-wrap:fullscreen video,
.player-video-wrap:-webkit-full-screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.player-video-wrap:fullscreen .admin-popup-container,
.player-video-wrap:-webkit-full-screen .admin-popup-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
}

/* Fullscreen overlay controls (YouTube-style tap to show/hide) */
.fs-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fs-overlay .fs-top-bar,
.fs-overlay .fs-bottom-bar {
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.fs-overlay.visible .fs-top-bar,
.fs-overlay.visible .fs-bottom-bar {
  opacity: 1;
  pointer-events: auto;
}
.fs-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 16px 32px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.fs-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px 16px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 12px;
}
.fs-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.15s;
  flex-shrink: 0;
}
.fs-btn:active {
  background: rgba(255,255,255,0.4);
}
.fs-exit-btn {
  font-size: 1.4rem;
}
.fs-live-badge {
  background: #e74c3c;
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.fs-spacer {
  flex: 1;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--c-surface);
  flex-shrink: 0;
}
.live-badge-sm {
  background: var(--c-live);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}
.mute-btn {
  background: var(--c-card);
  border: none;
  color: var(--c-text);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
  transition: background 0.15s;
}
.mute-btn:hover { background: var(--c-card-hover); }
.status-text {
  font-size: 0.78rem;
  color: var(--c-text-sub);
  margin-left: auto;
}
.fullscreen-btn {
  background: var(--c-card);
  border: none;
  color: var(--c-text);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
  transition: background 0.15s;
}
.fullscreen-btn:hover { background: var(--c-card-hover); }
.share-btn {
  background: var(--c-card);
  border: none;
  color: var(--c-text);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
  transition: background 0.15s;
}
.share-btn:hover { background: var(--c-card-hover); }
.share-btn.copied {
  background: var(--c-success);
  color: #fff;
}

/* === Copy Toast === */
.copy-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 20000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === Admin Stream Links === */
.stream-link-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.stream-link-url {
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--c-text-sub);
  background: var(--c-bg);
  padding: 4px 8px;
  border-radius: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stream-link-btn {
  background: var(--c-card-hover);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.stream-link-btn:hover { background: var(--c-accent); color: #fff; }
.stream-link-btn.copied { background: var(--c-success); color: #fff; border-color: var(--c-success); }
.stream-bulk-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* === Chat Panel (YouTube Live Chat) === */
.comment-panel {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-left: 1px solid var(--c-border);
}
.comment-panel.hidden {
  display: none !important;
}
.comment-panel-header {
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-close-btn {
  background: none;
  border: none;
  color: var(--c-text-sub);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.chat-close-btn:hover {
  background: var(--c-card);
  color: #fff;
}
.comment-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
}
.chat-msg {
  padding: 4px 16px;
  font-size: 0.85rem;
  line-height: 1.6;
}
.chat-msg:hover {
  background: rgba(255,255,255,0.04);
}
.chat-name {
  color: var(--c-accent);
  font-weight: 600;
  font-size: 0.78rem;
  margin-right: 8px;
  white-space: nowrap;
}
.chat-text {
  color: var(--c-text);
  word-break: break-word;
}
.chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--c-text-sub);
  font-size: 0.85rem;
  padding: 20px;
  text-align: center;
}

/* Chat input */
.comment-form {
  padding: 8px 12px;
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
}
.comment-nickname {
  width: 100%;
  padding: 6px 12px;
  margin-bottom: 6px;
  background: var(--c-card);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--c-text);
  font-size: 0.78rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.comment-nickname:focus { border-color: var(--c-accent); }
.comment-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.comment-input {
  flex: 1;
  padding: 8px 14px;
  background: var(--c-card);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--c-text);
  font-size: 0.85rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.comment-input:focus { border-color: var(--c-accent); }
.comment-send {
  padding: 8px 16px;
  background: var(--c-accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
  transition: background 0.15s;
}
.comment-send:hover { background: #2d8fe0; }
.comment-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* Festival chat accents */
body.festival-mode .chat-name { color: #ff6b6b; }
body.festival-mode .comment-send { background: var(--c-live); }
body.festival-mode .comment-send:hover { background: #cc0000; }
body.festival-mode .comment-input:focus,
body.festival-mode .comment-nickname:focus { border-color: var(--c-live); }

/* === Mobile === */
@media (max-width: 768px) {
  .stream-grid {
    grid-template-columns: 1fr;
    padding: 16px 12px;
    gap: 16px;
  }
  .header {
    padding: 8px 16px;
  }
  .header h1 { font-size: 1rem; }
  .header .subtitle { display: none; }

  .player-full {
    flex-direction: column;
  }
  .player-main {
    flex: none;
  }
  .player-video-wrap {
    flex: none;
    height: 30vh;
    min-height: 180px;
  }
  .player-controls { border-radius: 0; }
  .comment-panel {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-left: none;
    border-top: 1px solid var(--c-border);
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .stream-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === Festival Nav === */
.festival-nav {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  justify-content: center;
  border-bottom: 1px solid var(--c-border);
}
.festival-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  background: var(--c-card);
  color: var(--c-text);
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--c-border);
  transition: all 0.15s;
}
.festival-nav-link:hover {
  background: var(--c-card-hover);
  border-color: var(--c-text-sub);
}

/* === Broadcast Page === */
.broadcast-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.broadcast-preview {
  position: relative;
  width: 100%;
  padding-bottom: 75%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.broadcast-preview video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.broadcast-status {
  text-align: center;
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.9rem;
}
.broadcast-status.connecting { background: rgba(255,173,31,0.15); color: var(--c-warning); }
.broadcast-status.live { background: rgba(255,0,0,0.12); color: var(--c-live); }
.broadcast-status.offline { background: rgba(170,170,170,0.12); color: var(--c-text-sub); }
.broadcast-status.error { background: rgba(255,78,69,0.12); color: var(--c-danger); }

.broadcast-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--c-accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #2d8fe0; }

.btn-danger {
  background: var(--c-danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #dd3333; }

.btn-secondary {
  background: var(--c-card);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.btn-secondary:hover:not(:disabled) { background: var(--c-card-hover); }

.btn-block { width: 100%; }

.broadcast-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-box {
  background: var(--c-card);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--c-accent);
}
.stat-label {
  font-size: 0.72rem;
  color: var(--c-text-sub);
  margin-top: 2px;
}

/* === Auth Form === */
.auth-container {
  max-width: 400px;
  margin: 80px auto 0;
  padding: 32px 24px;
  background: var(--c-card);
  border-radius: var(--radius);
  text-align: center;
}
.auth-container h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.auth-container p {
  font-size: 0.85rem;
  color: var(--c-text-sub);
  margin-bottom: 20px;
}

.input-group {
  margin-bottom: 14px;
}
.input-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-text-sub);
  margin-bottom: 6px;
  text-align: left;
}
.input-group input,
.input-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--c-bg);
  border: 1.5px solid var(--c-border);
  border-radius: 10px;
  color: var(--c-text);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.input-group input:focus,
.input-group select:focus {
  border-color: var(--c-accent);
}

.error-msg {
  color: var(--c-danger);
  font-size: 0.82rem;
  margin-bottom: 12px;
}

/* === Admin === */
.admin-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 16px;
}

.admin-section {
  background: var(--c-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.admin-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--c-border);
}

.mode-toggle {
  display: flex;
  gap: 10px;
}
.mode-btn {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  border: 2px solid var(--c-border);
  background: transparent;
  color: var(--c-text);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn.active {
  border-color: var(--c-accent);
  background: rgba(62,166,255,0.1);
  color: var(--c-accent);
}
.mode-btn.festival.active {
  border-color: var(--c-live);
  background: rgba(255,0,0,0.08);
  color: var(--c-live);
}

.token-list {
  list-style: none;
}
.token-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.85rem;
}
.token-item:last-child { border-bottom: none; }
.token-value {
  font-family: monospace;
  background: var(--c-bg);
  padding: 4px 10px;
  border-radius: 6px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.token-revoke {
  background: none;
  border: none;
  color: var(--c-danger);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.stream-list-admin {
  list-style: none;
}
.stream-admin-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}
.stream-admin-item:last-child { border-bottom: none; }
.stream-admin-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.stream-admin-status.live { background: var(--c-success); }
.stream-admin-status.offline { background: var(--c-text-sub); }
.stream-admin-label {
  flex: 1;
}
.stream-admin-label input {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--c-text);
  font-family: var(--font);
  font-size: 0.85rem;
  width: 100%;
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--c-text-sub);
}
.empty-state .icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.3;
}
.empty-state p {
  font-size: 0.95rem;
}

/* === Loading === */
.loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--c-text-sub);
}
.loading .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Tutorial (archeo-style) === */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: none;
  transition: opacity 0.3s;
}
.tutorial-overlay.show { display: block; }
.tutorial-backdrop {
  position: absolute;
  inset: 0;
}
.tutorial-highlight {
  position: absolute;
  border-radius: 12px;
  box-shadow: 0 0 0 4000px rgba(0,0,0,0.8), 0 0 20px rgba(62,166,255,0.4);
  z-index: 20001;
  transition: all 0.4s ease;
  pointer-events: none;
}
.tutorial-tooltip {
  position: absolute;
  z-index: 20002;
  background: var(--c-card);
  border: 2px solid var(--c-accent);
  border-radius: 16px;
  padding: 20px 24px;
  max-width: 320px;
  width: calc(100vw - 40px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  animation: tutorialFadeIn 0.4s ease;
}
@keyframes tutorialFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.tutorial-step-indicator {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-border);
  transition: background 0.3s;
}
.tutorial-dot.active {
  background: var(--c-accent);
  box-shadow: 0 0 8px rgba(62,166,255,0.4);
}
.tutorial-dot.done {
  background: var(--c-success);
}
.tutorial-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}
.tutorial-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-accent);
  margin-bottom: 6px;
}
.tutorial-desc {
  font-size: 0.9rem;
  color: var(--c-text);
  line-height: 1.6;
  margin-bottom: 16px;
}
.tutorial-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.tutorial-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: transform 0.2s, box-shadow 0.2s;
}
.tutorial-btn:active { transform: scale(0.95); }
.tutorial-btn-next {
  background: linear-gradient(135deg, var(--c-accent), #2d8fe0);
  color: #fff;
  box-shadow: 0 4px 15px rgba(62,166,255,0.3);
  flex: 1;
}
.tutorial-btn-skip {
  background: transparent;
  color: var(--c-text-sub);
  padding: 10px 12px;
  font-size: 0.8rem;
}
.tutorial-btn-skip:hover { color: var(--c-text); }
.tutorial-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--c-text-sub);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  padding: 0;
}
.tutorial-close:hover {
  color: #fff;
  background: rgba(255,78,69,0.3);
}
.tutorial-welcome {
  text-align: center;
  padding: 30px 20px;
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  z-index: 20002;
  background: var(--c-card);
  border: 2px solid var(--c-accent);
  border-radius: 20px;
  max-width: 360px;
  width: calc(100vw - 40px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  animation: tutorialFadeIn 0.4s ease;
}
.tutorial-welcome .tutorial-icon { font-size: 2.5rem; margin-bottom: 12px; }
.tutorial-welcome .tutorial-title { font-size: 1.2rem; }
.tutorial-welcome .tutorial-desc { font-size: 0.88rem; }
.tutorial-welcome .tutorial-buttons { justify-content: center; flex-wrap: wrap; }
.tutorial-welcome .tutorial-btn-next { flex: none; padding: 12px 36px; border-radius: 24px; }
body.festival-mode .tutorial-highlight {
  box-shadow: 0 0 0 4000px rgba(0,0,0,0.8), 0 0 20px rgba(255,0,0,0.4);
}
body.festival-mode .tutorial-dot.active {
  background: var(--c-live);
  box-shadow: 0 0 8px rgba(255,0,0,0.4);
}
body.festival-mode .tutorial-title { color: var(--c-live); }
body.festival-mode .tutorial-tooltip { border-color: var(--c-live); }
body.festival-mode .tutorial-welcome { border-color: var(--c-live); }
body.festival-mode .tutorial-btn-next {
  background: linear-gradient(135deg, var(--c-live), #cc0000);
  box-shadow: 0 4px 15px rgba(255,0,0,0.3);
}

/* === Admin Message Popup === */
.admin-popup-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15000;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.admin-popup {
  margin: 8px 16px 0;
  padding: 12px 20px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1px solid var(--c-accent);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 12px rgba(62,166,255,0.15);
  max-width: 420px;
  width: calc(100% - 32px);
  pointer-events: auto;
  animation: popupSlideIn 0.4s ease-out;
  transition: opacity 0.4s, transform 0.4s;
}
.admin-popup.hiding {
  opacity: 0;
  transform: translateY(-20px);
}
.admin-popup-booth {
  font-size: 0.72rem;
  color: var(--c-accent);
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-popup-booth::before {
  content: '📢';
}
.admin-popup-text {
  font-size: 0.95rem;
  color: var(--c-text);
  font-weight: 600;
  line-height: 1.5;
}
@keyframes popupSlideIn {
  from { opacity: 0; transform: translateY(-40px); }
  to   { opacity: 1; transform: translateY(0); }
}
body.festival-mode .admin-popup {
  background: linear-gradient(135deg, #2a0a0a, #3a1010);
  border-color: var(--c-live);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 12px rgba(255,0,0,0.15);
}
body.festival-mode .admin-popup-booth {
  color: #ff6b6b;
}

/* === Footer === */
.footer {
  text-align: center;
  padding: 20px 16px;
  font-size: 0.72rem;
  color: var(--c-text-sub);
}
.footer a { color: var(--c-accent); text-decoration: none; }
