:root {
  --bg-1: #17111f;
  --bg-2: #2a1733;
  --bg-3: #4a1f2e;
  --text: #f7f0ff;
  --muted: #d5c7e8;
  --card: rgba(255, 255, 255, 0.09);
  --card-border: rgba(255, 255, 255, 0.25);
  --accent: #ff8f4d;
  --accent-2: #ff5f6d;
  --soft: #42d4ff;
}

* { box-sizing: border-box; }

.hidden {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 20%, var(--bg-3), transparent 45%),
              radial-gradient(circle at 80% 70%, #1f3a58, transparent 35%),
              linear-gradient(130deg, var(--bg-1), var(--bg-2));
  min-height: 100%;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(45deg, rgba(255,255,255,0.05), transparent 45%, rgba(255,255,255,0.05));
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.event-shell {
  gap: 20px;
}

.event-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.event-title h1 {
  font-size: clamp(2rem, 3vw, 2.9rem);
  margin: 0;
}

.event-title p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.event-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-link {
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: #dbe8ff;
  border-radius: 10px;
  min-height: 40px;
  padding: 0 12px;
  font-weight: 600;
  cursor: pointer;
}

.panel-sub {
  margin: 0 0 14px;
  color: var(--muted);
}

.btn-overlay-main {
  background: linear-gradient(135deg, #ff8a36, #ff2477 56%, #a600ff);
  color: #fff;
  box-shadow: 0 0 24px rgba(255, 66, 156, 0.35);
}

.btn-overlay-compact {
  min-height: 48px;
  padding: 10px 16px;
  font-size: 0.98rem;
}

.action-panel {
  padding: 16px;
}

.action-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.action-btn {
  width: 100%;
  min-height: 68px;
  font-size: 1.06rem;
  border-radius: 14px;
}

.overlay-badge {
  margin: 10px 0 0;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(151, 255, 206, 0.45);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.9rem;
  color: #bcfce2;
  background: rgba(38, 132, 92, 0.2);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.capture-panel,
.latest-panel,
.qr-panel {
  background: linear-gradient(152deg, rgba(20, 16, 44, 0.9), rgba(18, 27, 54, 0.7));
  border-color: rgba(140, 165, 255, 0.22);
  box-shadow: 0 12px 34px rgba(5, 8, 23, 0.35), inset 0 0 0 1px rgba(255,255,255,0.03);
}

.panel {
  backdrop-filter: blur(8px);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 20px;
}

.panel h2 {
  margin-top: 0;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.capture-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

input[type="file"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meta-row label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 1rem;
}

input[type="text"] {
  width: 100%;
  font-size: 1.05rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.2);
  color: var(--text);
  padding: 14px 12px;
}

input[type="date"],
select {
  width: 100%;
  font-size: 1.02rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.2);
  color: var(--text);
  padding: 12px 12px;
}

.actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  min-height: 62px;
  font-size: 1.12rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, #3d7fff, #42d4ff);
  color: #051025;
  box-shadow: 0 0 20px rgba(64, 180, 255, 0.25);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #2a0810;
  box-shadow: 0 0 24px rgba(255, 107, 83, 0.28);
}

.btn-soft {
  background: rgba(255,255,255,0.16);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.3);
}

.btn-beamer {
  background: linear-gradient(135deg, #76f0ff, #50b7ff);
  color: #041325;
  min-width: 320px;
  box-shadow: 0 0 0 1px rgba(173, 242, 255, 0.55), 0 0 30px rgba(92, 210, 255, 0.5);
}

.btn-youtube {
  background: linear-gradient(135deg, #ff6a6a, #ff2d55);
  color: #fff4f4;
  border: 1px solid rgba(255, 161, 161, 0.55);
  box-shadow: 0 0 24px rgba(255, 58, 112, 0.35);
}

.btn-download {
  margin-top: 8px;
  background: linear-gradient(135deg, #79ffb0, #3adf88);
  color: #072817;
  min-height: 56px;
  width: 100%;
  max-width: 320px;
  border-radius: 13px;
  font-size: 1.04rem;
}

.latest-info .btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  text-decoration: none;
  border: 1px solid rgba(150, 255, 199, 0.55);
  box-shadow: 0 8px 22px rgba(44, 204, 129, 0.35);
}

.latest-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: stretch;
}

.latest-photo-wrap {
  position: relative;
}

.latest-image {
  width: 100%;
  min-height: 520px;
  max-height: 66vh;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25), 0 10px 30px rgba(0,0,0,0.26);
}

.latest-sticker {
  position: absolute;
  right: 16px;
  bottom: 16px;
  background: rgba(4, 16, 21, 0.56);
  border: 1px solid rgba(161, 255, 235, 0.45);
  border-radius: 999px;
  padding: 14px 18px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
}

.latest-sticker-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
}

.latest-sticker-sub,
.latest-sticker-date {
  margin: 3px 0 0;
  color: #d6f5ef;
}

.qr-panel h2 {
  margin-top: 0;
}

.latest-info {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 6px 4px;
}

.latest-info p {
  margin: 0;
  font-size: 1.08rem;
}

.inline-link {
  color: #9be8ff;
}

.overlay-state {
  margin: 8px 0 0;
  color: #bde8ff;
  font-size: 0.98rem;
}

.display-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.beamer-dark {
  --card: rgba(9, 9, 12, 0.72);
  --card-border: rgba(255, 255, 255, 0.14);
}

.beamer-dark .bg-glow {
  opacity: 0.35;
}

.display-layout {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 2.6fr 0.95fr;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}

.photo-stage, .qr-stage, .empty-state {
  backdrop-filter: blur(8px);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 14px;
  min-height: 0;
  overflow: hidden;
}

.photo-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.image-frame {
  position: relative;
  min-height: 0;
  display: flex;
}

.stage-image {
  width: 100%;
  height: 100%;
  max-height: min(72vh, calc(100dvh - 210px));
  object-fit: contain;
  object-position: center;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.25);
}

.caption {
  margin-top: 2px;
  min-height: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(11, 9, 17, 0.68), rgba(11, 9, 17, 0.35));
  border: 1px solid rgba(255,255,255,0.16);
}

.caption .line {
  font-size: clamp(1.4rem, 2.6vw, 2.4rem);
  margin: 0;
}

.caption .line.dim {
  color: var(--muted);
  margin-top: 5px;
}

.brand-overlay-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.brand-overlay-wrap picture,
.brand-overlay-wrap .brand-text {
  position: absolute;
}

.brand-logo {
  max-width: clamp(120px, 14vw, 220px);
  max-height: 16vh;
  object-fit: contain;
  opacity: 0.22;
  filter: drop-shadow(0 5px 12px rgba(0,0,0,0.45));
}

.brand-text {
  background: rgba(11, 9, 17, 0.52);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  padding: 8px 10px;
}

.brand-line {
  margin: 0;
  line-height: 1.2;
}

.brand-line.title {
  font-weight: 800;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
}

.brand-line.subtitle {
  color: #dbe8ff;
  margin-top: 4px;
  font-size: clamp(0.92rem, 1.2vw, 1.08rem);
}

.brand-line.date {
  color: #b6d2ff;
  margin-top: 4px;
  font-size: 0.92rem;
}

.qr-stage {
  display: grid;
  grid-template-rows: auto auto auto auto;
  place-items: center;
  align-content: start;
  text-align: center;
  gap: 8px;
  max-height: 100%;
  overflow: hidden;
}

.qr-stage h2 {
  margin: 4px 0;
  font-size: 1.8rem;
}

.qr-box {
  padding: 8px;
  border-radius: 14px;
  background: #fff;
  max-width: 100%;
  overflow: hidden;
}

.qr-box img,
.qr-box canvas {
  max-width: 100%;
  height: auto !important;
}

.qr-text {
  margin: 0;
  color: var(--muted);
}

.empty-state {
  margin: auto;
  max-width: 700px;
  text-align: center;
}

.dim-note {
  color: var(--muted);
}

.stage-top-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  margin-top: 2px;
}

.btn.compact {
  min-height: 40px;
  padding: 7px 11px;
  font-size: 0.88rem;
}

.display-status {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1100;
  background: rgba(15, 15, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.display-status.show {
  opacity: 1;
  transform: translateY(0);
}

.display-status.ok {
  border-color: rgba(97, 224, 157, 0.8);
}

.display-status.warn {
  border-color: rgba(255, 184, 79, 0.95);
}

.upload-success {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  background: linear-gradient(135deg, #65e6a5, #2ac880);
  color: #062417;
  border-radius: 16px;
  padding: 16px 26px;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 12px 34px rgba(0,0,0,0.35);
  transition: opacity 220ms ease;
}

.upload-success.hide {
  opacity: 0;
}

.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  background: rgba(13, 10, 22, 0.7);
}

.upload-overlay.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 14, 0.72);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(860px, 94vw);
  max-height: 92vh;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(22, 18, 32, 0.95);
  padding: 18px;
  position: relative;
}

.modal-card h2 {
  margin: 0 36px 12px 0;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-radius: 10px;
  min-height: 40px;
  min-width: 40px;
  cursor: pointer;
}

.modal-form {
  display: grid;
  gap: 12px;
}

.modal-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.editor-block h3 {
  margin: 6px 0 4px;
}

.overlay-editor-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.24);
  background: #12172a;
}

.overlay-editor-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.overlay-editor-fallback {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(116, 217, 255, 0.35), transparent 35%),
              radial-gradient(circle at 80% 70%, rgba(255, 125, 165, 0.28), transparent 32%),
              linear-gradient(145deg, #1b1732, #182433);
}

.editor-logo-layer,
.editor-text-layer {
  position: absolute;
  z-index: 2;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.editor-logo-layer:active,
.editor-text-layer:active {
  cursor: grabbing;
}

.editor-logo-img {
  max-width: 180px;
  max-height: 110px;
  object-fit: contain;
  opacity: 0.9;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.55));
}

.editor-text-layer {
  background: rgba(10, 10, 16, 0.58);
  border: 1px dashed rgba(255,255,255,0.45);
  border-radius: 10px;
  padding: 8px 10px;
  max-width: 54%;
}

.editor-text-title,
.editor-text-subtitle,
.editor-text-date {
  margin: 0;
  line-height: 1.2;
}

.editor-text-title {
  font-weight: 800;
}

.editor-text-subtitle {
  color: #dbe8ff;
  margin-top: 4px;
}

.editor-text-date {
  color: #b6d2ff;
  margin-top: 4px;
  font-size: 0.86em;
}

.upload-overlay-card {
  background: rgba(24, 20, 34, 0.95);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 18px;
  padding: 20px 26px;
  min-width: 260px;
  text-align: center;
}

.upload-overlay-card p {
  margin: 10px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border: 4px solid rgba(255,255,255,0.25);
  border-top-color: #8de3ff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

@media (min-width: 1000px) and (orientation: landscape) {
  .app {
    padding: 30px;
  }

  .btn {
    min-width: 0;
  }
}

@media (max-width: 980px) {
  .event-header { align-items: flex-start; flex-direction: column; }
  .event-tools { justify-content: flex-start; }
  .action-bar { grid-template-columns: 1fr 1fr; }
  .content-grid { grid-template-columns: 1fr; }

  .meta-row,
  .latest-wrap,
  .display-layout {
    grid-template-columns: 1fr;
  }

  .stage-image {
    height: auto;
    max-height: 58vh;
    object-fit: contain;
  }

  .btn {
    width: 100%;
  }

  .btn-beamer,
  .btn-download {
    min-width: 0;
    max-width: none;
  }

  .latest-image {
    min-height: 280px;
    object-fit: contain;
  }

  .overlay-mainline {
    font-size: 1.5rem;
  }

  .latest-sticker {
    right: 8px;
    bottom: 8px;
    border-radius: 14px;
    padding: 10px 12px;
  }

  .latest-sticker-title {
    font-size: 1.05rem;
  }

  .stage-top-actions {
    margin-top: 6px;
    margin-bottom: 6px;
  }

  .brand-logo {
    max-width: 120px;
    max-height: 12vh;
  }

  .display-page {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .display-layout {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
}
