:root {
  --bg: #0b1020;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.16);
  --text: #f8fafc;
  --muted: #aab4c5;
  --primary: #4f8cff;
  --primary-dark: #2f6be6;
  --success: #35d399;
  --danger: #ff5c7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #25365f 0, transparent 34%), radial-gradient(circle at top right, #182f56 0, transparent 30%), var(--bg);
}

body {
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 46px;
}

.hero-card,
.panel {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.045));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 28px;
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: stretch;
  padding: 34px;
  margin-bottom: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(79, 140, 255, 0.17);
  border: 1px solid rgba(79, 140, 255, 0.32);
  letter-spacing: 0.08em;
  font-weight: 800;
  font-size: 0.75rem;
}

.hero-card h1 {
  margin: 16px 0 12px;
  max-width: 760px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero-card p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.65;
}

.status-box {
  flex: 0 0 230px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 22px;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 8px rgba(53, 211, 153, 0.13), 0 0 30px rgba(53, 211, 153, 0.8);
}

.status-box small {
  color: var(--muted);
  line-height: 1.5;
}

.grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.panel {
  padding: 26px;
}

.panel-header {
  margin-bottom: 22px;
}

.panel-header.compact {
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0 0 7px;
  font-size: 1.35rem;
  letter-spacing: -0.025em;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.field-label {
  display: block;
  margin: 18px 0 9px;
  color: #e5ecff;
  font-weight: 800;
  font-size: 0.95rem;
}

textarea,
input[type="text"] {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(2, 6, 23, 0.54);
  color: var(--text);
  border-radius: 18px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

textarea {
  resize: vertical;
  min-height: 142px;
  padding: 16px;
  line-height: 1.55;
}

input[type="text"] {
  padding: 14px 112px 14px 14px;
}

textarea:focus,
input[type="text"]:focus {
  border-color: rgba(79, 140, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.16);
  background: rgba(2, 6, 23, 0.7);
}

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

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

input[type="color"] {
  width: 100%;
  height: 48px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(2, 6, 23, 0.54);
  cursor: pointer;
}

.hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.88rem;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  width: fit-content;
  color: #e5ecff;
  font-weight: 700;
  cursor: pointer;
}

.switch-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

button {
  border: none;
  border-radius: 15px;
  padding: 13px 17px;
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

button:active {
  transform: translateY(0);
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 14px 30px rgba(79, 140, 255, 0.28);
}

.secondary-btn {
  background: rgba(53, 211, 153, 0.18);
  border: 1px solid rgba(53, 211, 153, 0.34);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.link-box {
  position: relative;
}

.link-box button {
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 8px 12px;
  border-radius: 11px;
  background: rgba(79, 140, 255, 0.95);
}

.notice {
  min-height: 24px;
  margin-top: 12px;
  color: var(--success);
  font-weight: 750;
}

.info-card {
  margin-top: 20px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.11);
}

.info-card h3 {
  margin: 0 0 10px;
}

.info-card p {
  color: var(--muted);
  line-height: 1.55;
  margin: 9px 0;
}

code {
  display: inline-block;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 8px;
  color: #bfdbfe;
  background: rgba(15, 23, 42, 0.92);
  overflow-wrap: anywhere;
}

.preview-panel {
  margin-top: 24px;
}

.preview-screen {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #050816;
}

.preview-screen::before,
.tv-view::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.7), transparent 10%, transparent 90%, rgba(0, 0, 0, 0.7));
  z-index: 2;
}

.preview-marquee {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-weight: 950;
  letter-spacing: -0.035em;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.25);
  animation-name: marqueeMove;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.tv-view {
  display: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #050816;
  z-index: 999;
}

.tv-marquee {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.045em;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.32), 0 0 58px rgba(79, 140, 255, 0.32);
  animation-name: marqueeMove;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
}

body.tv-mode {
  background: #050816;
  overflow: hidden;
}

body.tv-mode .admin-shell {
  display: none;
}

body.tv-mode .tv-view {
  display: block;
}

@keyframes marqueeMove {
  from {
    transform: translate3d(0, -50%, 0);
  }
  to {
    transform: translate3d(calc(-100vw - 100%), -50%, 0);
  }
}

@media (max-width: 880px) {
  .admin-shell {
    width: min(100% - 22px, 680px);
    padding-top: 18px;
  }

  .hero-card,
  .grid-layout {
    display: block;
  }

  .hero-card {
    padding: 24px;
  }

  .status-box {
    margin-top: 20px;
  }

  .link-panel {
    margin-top: 20px;
  }
}

@media (max-width: 560px) {
  .panel,
  .hero-card {
    border-radius: 22px;
    padding: 20px;
  }

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

  .button-row button {
    width: 100%;
  }

  input[type="text"] {
    padding-right: 14px;
  }

  .link-box button {
    position: static;
    width: 100%;
    margin-top: 10px;
  }

  .hero-card h1 {
    font-size: 2.25rem;
  }
}
