:root {
  --primary: #ff6b35;
  --accent: #f7c948;
  --background: #0a0e1a;
  --panel: rgba(18, 27, 54, 0.9);
  --line: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--background);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.phone-shell {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(247, 201, 72, 0.16), transparent 28%),
    linear-gradient(160deg, #142452 0%, #0a0e1a 58%, #111827 100%);
}

.top-actions,
.scene-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 8px;
}

.admin-link {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
}

.intro-screen {
  display: grid;
  place-items: center;
  padding: 24px;
}

.intro-screen.custom-intro-bg {
  background:
    linear-gradient(180deg, rgba(10, 14, 26, 0.26), rgba(10, 14, 26, 0.74)),
    var(--intro-bg) center / cover no-repeat;
}

.intro-screen.custom-intro-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, rgba(10, 14, 26, 0.08), rgba(10, 14, 26, 0.54));
}

.intro-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
  padding: 42px 22px 28px;
}

.name-panel {
  padding-top: 34px;
}

.name-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.name-input-wrap {
  display: block;
  width: 100%;
}

.name-form input,
.name-input {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  font-size: 16px;
  line-height: 50px;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: text;
  user-select: text;
  position: relative;
  z-index: 2;
}

.name-form input:focus,
.name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.18);
}

.name-form input::placeholder,
.name-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.name-status {
  min-height: 20px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.player-chip {
  display: inline-block;
  margin-bottom: 14px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  font-size: 13px;
}

.intro-badge {
  display: inline-grid;
  place-items: center;
  width: 80px;
  height: 80px;
  margin-bottom: 18px;
  border-radius: 50%;
  color: #18233d;
  background: linear-gradient(135deg, var(--accent), #fff2b3);
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 12px 34px rgba(247, 201, 72, 0.28);
}

.intro-panel h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
}

.intro-panel p {
  margin: 22px auto 28px;
  max-width: 320px;
  color: var(--muted);
  line-height: 1.78;
  font-size: 16px;
}

.primary-btn,
.secondary-btn {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #e85d26);
  box-shadow: 0 14px 26px rgba(255, 107, 53, 0.24);
}

.secondary-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
}

.scene-screen {
  padding-bottom: 22px;
}

.scene-header h2 {
  margin: 8px 0 0;
  max-width: 270px;
  font-size: 18px;
  line-height: 1.35;
}

.scene-tag {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.progress {
  height: 8px;
  margin: 6px 18px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 300ms ease;
}

.scene-card {
  margin: 0 14px;
  display: grid;
  gap: 14px;
}

.scene-image {
  position: relative;
  height: min(68vh, 590px);
  min-height: 460px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #111827;
}

.scene-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.generated-scene {
  width: 100%;
  height: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.055) 0 12px, transparent 12px 24px);
}

.generated-icon {
  font-size: 82px;
}

.generated-scene h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.generated-scene p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hotspot {
  position: absolute;
  width: 58px;
  height: 58px;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 107, 53, 0.22);
}

.hotspot::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 50%;
  animation: pulse 1.4s infinite;
}

.hotspot span {
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-size: 24px;
  font-weight: 900;
}

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

.scene-copy {
  padding: 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--line);
}

.scene-copy p {
  margin: 0;
  font-weight: 800;
  line-height: 1.5;
}

.warning {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  color: #ffe9b6;
  line-height: 1.55;
}

.success-box,
.analysis {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.success-box span,
.analysis span {
  color: var(--muted);
  line-height: 1.55;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.66);
}

.modal-card {
  width: min(100%, 394px);
  max-height: 86vh;
  overflow: auto;
  padding: 22px;
  border-radius: 16px 16px 8px 8px;
  background: linear-gradient(180deg, #1e3a8a, #142452);
  border: 1px solid var(--line);
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-head span {
  font-size: 28px;
}

.modal-head h3,
.question {
  margin: 0;
}

.question {
  margin-top: 14px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
}

.option-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.option-btn {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #fff;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.option-btn.correct {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.35);
}

.option-btn.wrong {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.32);
}

.option-btn.muted {
  opacity: 0.6;
}

.reward-screen {
  padding: 22px 16px;
  overflow: auto;
}

.reward-panel {
  display: grid;
  gap: 16px;
}

.reward-badge {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin: 4px auto 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  font-size: 38px;
}

.reward-panel h2 {
  margin: 0;
  text-align: center;
  font-size: 26px;
}

.tip-stack {
  display: grid;
  gap: 12px;
}

.tip-card {
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.tip-card h3 {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 17px;
}

.tip-card ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.5;
}

.finale-screen {
  display: grid;
  place-items: center;
  padding: 22px;
}

.finale-card {
  width: 100%;
  display: grid;
  gap: 16px;
}

.identity-card {
  min-height: 520px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 34px;
  text-align: center;
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(247, 201, 72, 0.16), transparent 34%),
    linear-gradient(180deg, #1f3f7d, #111827);
  border: 1px solid var(--line);
}

.identity-card span {
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0.1em;
}

.identity-card h1 {
  margin: 0;
  font-size: 46px;
}

.identity-card p,
.identity-card small {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.finale-image {
  width: 100%;
  border-radius: 8px;
}

.finale-actions {
  display: grid;
  gap: 10px;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 12px;
  color: #172033;
  background: #fff;
  text-align: center;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

.pocket-card {
  position: relative;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.46);
  font-size: 24px;
  line-height: 1;
}

.notice-text {
  margin: 12px 0 0;
  color: var(--muted);
  text-align: center;
}

.admin-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #eef3f8 0%, #f7f9fc 46%, #eef3f8 100%);
  color: #172033;
  color-scheme: light;
}

.screen-admin-preview {
  position: relative;
  height: 360px;
  overflow: hidden;
  border-radius: 8px;
  background: #101827;
}

.screen-admin-preview img,
.screen-admin-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen-preview-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: #94a3b8;
}

.screen-admin-preview span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border-radius: 8px;
  color: #172033;
  background: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  font-weight: 800;
}

.screen-body {
  min-height: 100vh;
  background: #050914;
  overflow: hidden;
}

#screen-app,
.screen-stage {
  width: 100vw;
  height: 100vh;
}

.screen-stage {
  position: relative;
  overflow: hidden;
  background: #080d18;
}

.screen-kv,
.screen-fallback,
.screen-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.screen-kv {
  object-fit: cover;
}

.screen-fallback {
  background:
    radial-gradient(circle at 28% 24%, rgba(247, 201, 72, 0.25), transparent 28%),
    linear-gradient(135deg, #17376f, #07101f 58%, #141b2e);
}

.screen-shade {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.48)),
    radial-gradient(circle at 50% 70%, transparent, rgba(0, 0, 0, 0.36));
}

.screen-title {
  position: absolute;
  top: 8vh;
  left: 6vw;
  max-width: 760px;
  color: #fff;
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.38);
}

.screen-title h1 {
  margin: 0;
  font-size: clamp(44px, 6vw, 92px);
  line-height: 1.05;
}

.screen-title p {
  margin: 18px 0 0;
  font-size: clamp(20px, 2vw, 34px);
  color: rgba(255, 255, 255, 0.82);
}

.qr-panel {
  position: absolute;
  z-index: 4;
  width: 180px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform-origin: center;
}

.qr-panel svg {
  display: block;
  width: 100%;
  height: auto;
}

.qr-panel span {
  display: block;
  margin-top: 8px;
  color: #172033;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.qr-panel small {
  display: block;
  margin-top: 5px;
  color: #475569;
  text-align: center;
  font-size: 9px;
  line-height: 1.25;
  word-break: break-all;
}

.barrage-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.barrage-name {
  position: absolute;
  left: 100%;
  white-space: nowrap;
  padding: 10px 18px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: clamp(18px, 2vw, 30px);
  font-weight: 800;
  animation: barrage-move linear infinite;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

@keyframes barrage-move {
  from { transform: translateX(0); }
  to { transform: translateX(-130vw); }
}

.admin-layout {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  color: #fff;
  background:
    linear-gradient(180deg, #12253f, #162033 62%, #101827);
  box-shadow: 18px 0 44px rgba(15, 23, 42, 0.16);
}

.admin-brand {
  padding: 4px 6px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 18px;
}

.admin-brand span {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #143020;
  background: #a7f3d0;
  font-size: 13px;
  font-weight: 900;
}

.admin-sidebar h1 {
  margin: 12px 0 6px;
  font-size: 25px;
  letter-spacing: 0;
}

.admin-brand p {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.admin-tabs {
  display: grid;
  gap: 7px;
}

.admin-tab {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.74);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.admin-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.admin-tab.active {
  color: #102033;
  background: #fff;
  border-color: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.admin-main {
  padding: 28px;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid #dfe7f2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 44px rgba(30, 41, 59, 0.08);
}

.admin-toolbar h2 {
  margin: 0;
  color: #102033;
  font-size: 28px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.primary-actions {
  min-width: 210px;
}

.secondary-actions {
  width: 100%;
  justify-content: flex-end;
}

.admin-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  color: #172033;
  border: 1px solid #d6dce8;
  background: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.admin-button:hover {
  transform: translateY(-1px);
  border-color: #b7c2d6;
  box-shadow: 0 10px 22px rgba(30, 41, 59, 0.12);
}

.admin-button.primary {
  color: #fff;
  border-color: #0f766e;
  background: #0f766e;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.18);
}

.save-status {
  min-height: 24px;
  color: #15803d;
  font-size: 13px;
  font-weight: 800;
}

.save-status.dirty {
  color: #b45309;
}

.admin-section {
  display: grid;
  gap: 16px;
  max-width: 1180px;
}

.form-card {
  padding: 20px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e0e7f1;
  box-shadow: 0 16px 36px rgba(30, 41, 59, 0.07);
}

.form-card h3 {
  margin: 0 0 10px;
  color: #102033;
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 13px;
  font-weight: 800;
  color: #4b5563;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: #172033;
  border: 1px solid #d6dce8;
  border-radius: 8px;
  background: #fbfdff;
  outline: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d6dce8;
  border-radius: 8px;
  color: #172033;
  background: #fff;
  font-size: 14px;
  font-weight: 800;
}

.stage-admin {
  display: grid;
  gap: 16px;
}

.step-list,
.tips-list,
.options-list {
  display: grid;
  gap: 12px;
}

.mini-card {
  padding: 16px;
  border-radius: 8px;
  background: #f8fbff;
  border: 1px solid #e0e7f1;
}

.hotspot-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 260px;
  margin: 14px 0;
  overflow: hidden;
  border: 1px dashed #a8b3c7;
  border-radius: 8px;
  color: #64748b;
  background:
    linear-gradient(180deg, rgba(23, 32, 51, 0.08), rgba(23, 32, 51, 0.02)),
    #eef3fa;
}

.hotspot-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hotspot-preview i {
  position: absolute;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-style: normal;
  font-weight: 900;
  box-shadow: 0 0 0 10px rgba(255, 107, 53, 0.18);
}

.quiz-editor {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e1e6f0;
}

.quiz-editor h4 {
  margin: 0 0 12px;
  font-size: 16px;
}

.notice {
  color: #64748b;
  line-height: 1.6;
  margin-top: 4px;
}

@media (max-width: 760px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .admin-main {
    padding: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
