:root {
  --ink: #fff5d6;
  --muted: #d8bd7a;
  --line: #9d681c;
  --panel: rgba(18, 9, 4, .92);
  --page: #050302;
  --accent: #d6a02a;
  --accent-2: #ffe8a3;
  --danger: #b91c1c;
  --good: #0f8f68;
  --wine: #5a0506;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(5, 3, 2, .74), rgba(5, 3, 2, .9)),
    url("/swaranjali-theme.png") center top / min(100vw, 1500px) auto no-repeat,
    radial-gradient(circle at 50% -10%, rgba(246, 205, 112, .22), transparent 35%),
    linear-gradient(180deg, #080402, #150703);
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

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

button,
.admin-link {
  border: 1px solid #f4c56a;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffe8a3 0%, #d89b24 52%, #884e0d 100%);
  color: #170b02;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  text-decoration: none;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(216, 155, 36, .25), inset 0 1px 0 rgba(255, 255, 255, .62);
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.danger-button {
  background: linear-gradient(180deg, #ffddd6, #c33125 58%, #68130d);
  color: #fff7ed;
}

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

.hero,
.admin-top,
.display-head {
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0;
}

.audio-status {
  min-height: 24px;
  margin: 0 0 10px;
  color: #d6c184;
  font-weight: 800;
}

.audio-status.ok {
  color: #7ef0a2;
}

.audio-status.error {
  color: #ff8a8a;
}

.branded-hero {
  min-height: auto;
  display: grid;
  grid-template-columns: minmax(260px, .95fr) 1fr auto;
  align-items: center;
}

.login-hero {
  min-height: min(720px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(320px, 1fr);
  align-items: center;
  gap: clamp(22px, 4vw, 58px);
  padding: clamp(22px, 4vw, 48px);
}

.branded-hero img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 16px 55px rgba(0, 0, 0, .48);
}

.login-hero img {
  width: 100%;
  max-height: 470px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 16px 55px rgba(0, 0, 0, .48);
}

.login-hero h1 {
  font-size: clamp(3rem, 7.2vw, 7rem);
  white-space: nowrap;
}

.login-hero .compact {
  max-width: 720px;
}

.login-hero .form-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.login-hero button {
  grid-column: 1 / -1;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  color: var(--accent-2);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 7vw, 5.5rem);
  line-height: .95;
  margin-bottom: 12px;
  text-shadow: 0 0 18px rgba(215, 161, 43, .6), 0 2px 0 #5a3309;
}

h2 {
  color: var(--accent-2);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.eyebrow {
  color: var(--accent-2);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.panel,
.live-board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .36), inset 0 1px 0 rgba(255, 232, 163, .12);
}

.admin-dashboard,
.control-grid,
.live-board {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .75fr);
  gap: 16px;
}

.form-grid,
.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.compact {
  max-width: 450px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: 10px 12px;
  color: #fff4cc;
  background: #100904;
  box-shadow: inset 0 0 0 1px rgba(255, 232, 163, .05);
}

textarea {
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.message {
  color: var(--muted);
  margin: 12px 0 0;
}

.hidden {
  display: none !important;
}

.nav-row,
.ticket-head,
.button-row,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-control {
  display: inline-flex;
  align-items: center;
  grid-auto-flow: column;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(16, 9, 4, .82);
}

.inline-control input {
  width: 120px;
  min-height: auto;
  padding: 0;
}

.switch-control {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(16, 9, 4, .82);
  color: var(--accent-2);
}

.switch-control input {
  display: none;
}

.switch-control span {
  width: 54px;
  height: 28px;
  border-radius: 999px;
  background: #4b1f16;
  border: 1px solid var(--line);
  position: relative;
}

.switch-control span::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 2px;
  border-radius: 50%;
  background: #f7dec0;
  transition: transform .18s ease;
}

.switch-control input:checked + span {
  background: #0f8f68;
}

.switch-control input:checked + span::after {
  transform: translateX(25px);
}

.claim-picker {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.claim-picker legend {
  color: var(--accent-2);
  font-weight: 900;
}

.claim-picker div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 232, 163, .08);
  border: 1px solid rgba(255, 232, 163, .18);
  border-radius: 6px;
  padding: 8px;
}

.check-line input {
  min-height: auto;
}

.mini-stage,
.current {
  background: linear-gradient(145deg, #1c0e04 0%, #090402 100%);
  color: white;
  border: 1px solid #9d6719;
  border-radius: 8px;
  padding: 20px;
}

.mini-stage {
  display: grid;
  justify-items: center;
  text-align: center;
  margin-bottom: 14px;
}

.mini-stage span {
  font-size: 4rem;
  color: #ffd36a;
  font-weight: 900;
}

.mini-stage strong,
.current strong {
  display: block;
  font-size: clamp(1.5rem, 4vw, 2.8rem);
  line-height: 1.05;
  margin-bottom: 10px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stats span,
.media-item,
.mini-list span {
  background: #100904;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.stats b {
  display: block;
  font-size: 1.75rem;
}

.signal-box {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-weight: 900;
  background: #100904;
}

.signal-box.green {
  background: linear-gradient(180deg, #0f8f68, #064533);
  color: white;
  box-shadow: 0 0 24px rgba(15, 143, 104, .52);
}

.pulse {
  animation: pulse 1s ease-in-out infinite;
}

.mini-list,
.media-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.folder-list {
  display: grid;
  gap: 10px;
}

.folder-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 9, 4, .92);
  padding: 12px;
}

.folder-card.active {
  border-color: var(--accent-2);
  box-shadow: 0 0 20px rgba(255, 232, 163, .22);
}

.folder-card b {
  color: var(--accent-2);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.folder-card span,
.folder-card small {
  color: var(--muted);
}

.folder-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.media-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.table-wrap {
  overflow: auto;
  margin-top: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

.status {
  border-radius: 999px;
  padding: 4px 9px;
  color: white;
  background: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  font-size: .72rem;
}

.status.valid {
  background: var(--good);
}

.ticket-template-card {
  position: relative;
  width: min(100%, 980px);
  aspect-ratio: 1470 / 1076;
  margin: 14px auto;
  color: #4d0809;
  background: #f7eed5;
}

.ticket-template-card > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ticket-no-card {
  position: absolute;
  top: 45.2%;
  left: 69.8%;
  width: 16%;
  height: 4%;
  display: grid;
  place-items: center;
  color: #5a0506;
  font-weight: 900;
  font-size: clamp(.9rem, 2.2vw, 1.6rem);
}

.ticket-grid.overlay-grid {
  position: absolute;
  left: 4.75%;
  right: 4.3%;
  top: 51.4%;
  bottom: 7.1%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: .9%;
  border: 0;
  background: transparent;
  box-shadow: none;
  margin: 0;
}

.ticket-cell {
  position: relative;
  border: 1px solid rgba(178, 119, 27, .35);
  border-radius: 6px;
  background: rgba(255, 253, 244, .78);
  color: #4d0809;
  padding: 6px;
  display: grid;
  place-items: center;
  text-align: center;
  min-width: 0;
  min-height: 0;
  font-weight: 900;
}

button.ticket-cell {
  box-shadow: none;
}

.ticket-cell span {
  color: #4d0809;
  font-size: clamp(.78rem, 1.95vw, 1.45rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.ticket-cell.marked {
  background: rgba(28, 140, 92, .88);
  color: white;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55), 0 0 16px rgba(28, 140, 92, .45);
}

.ticket-cell.marked::after {
  content: "✓";
  position: absolute;
  font-size: 2rem;
  color: white;
}

.ticket-cell.marked span {
  color: white;
}

.invalid-blink {
  animation: invalidBlink .65s linear infinite;
}

.claim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.called-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 250px;
  overflow: auto;
}

.called-list span,
.song-directory span {
  border: 1px solid #8a5b17;
  background: #100904;
  border-radius: 999px;
  padding: 7px 10px;
  color: #e0c17c;
}

.song-directory {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.song-directory span.done {
  background: #0f513d;
  color: white;
}

.winners {
  display: grid;
  gap: 8px;
}

.winners div {
  border-left: 4px solid var(--accent-2);
  background: rgba(255, 232, 163, .1);
  padding: 10px 12px;
  display: grid;
  gap: 3px;
}

.display-body {
  overflow-x: hidden;
  background:
    linear-gradient(rgba(0, 0, 0, .64), rgba(10, 2, 0, .9)),
    url("/swaranjali-theme.png") center / cover fixed,
    #050302;
}

.display {
  width: min(1440px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0;
  position: relative;
}

.progress-pill {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .55);
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--accent-2);
  font-weight: 900;
}

.progress-pill.audio-on {
  background: linear-gradient(180deg, #0f8f68, #064533);
  color: white;
}

.display-layout {
  min-height: 62vh;
  display: grid;
  grid-template-columns: 20% 1fr;
  gap: 22px;
}

.called-rail {
  border-right: 1px solid var(--line);
  padding-right: 14px;
}

.called-list.vertical {
  display: grid;
  align-content: start;
  max-height: 62vh;
}

.display-current {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  min-height: 62vh;
  border: 1px solid rgba(255, 232, 163, .28);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 38%, rgba(255, 211, 106, .2), transparent 34%), rgba(0, 0, 0, .35);
  overflow: hidden;
  position: relative;
}

.display-current span#displayNumber {
  display: none;
  font-size: 0;
  line-height: .9;
  color: #ffd36a;
  font-weight: 900;
  text-shadow: 0 0 34px rgba(255, 211, 106, .7);
  z-index: 1;
}

.display-current strong {
  font-size: clamp(3rem, 8vw, 7.8rem);
  line-height: 1;
  z-index: 1;
  color: white;
  text-shadow: 0 0 26px rgba(0, 0, 0, .8);
}

.display-current small {
  margin-top: 12px;
  color: var(--accent-2);
  font-weight: 900;
  z-index: 1;
}

.shuffle-strip {
  position: absolute;
  inset: 8% 0 auto;
  display: flex;
  gap: 18px;
  white-space: nowrap;
  opacity: 0;
  color: #ffe8a3;
  font-size: clamp(1.2rem, 3vw, 2.2rem);
  font-weight: 900;
  text-shadow: 0 0 18px #000;
}

.shuffle-strip.spin {
  animation: shuffleStrip 1.25s ease-out;
}

.media-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  display: grid;
  place-items: center;
}

.media-overlay img,
.media-overlay video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.music-notes::before,
.music-notes::after {
  content: "♪ ♫ ♬ ♪ ♫";
  position: fixed;
  color: rgba(255, 211, 106, .16);
  font-size: 8rem;
  animation: floatNotes 12s linear infinite;
  pointer-events: none;
}

.music-notes::after {
  right: 2%;
  bottom: 8%;
  animation-duration: 16s;
}

.print-area {
  display: none;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes invalidBlink {
  0%, 100% { background: rgba(185, 28, 28, .95); }
  50% { background: rgba(255, 255, 255, .85); }
}

@keyframes shuffleStrip {
  0% { opacity: 1; transform: translateX(55%); }
  80% { opacity: 1; transform: translateX(-35%); }
  100% { opacity: 0; transform: translateX(-50%); }
}

@keyframes floatNotes {
  from { transform: translateY(100vh) rotate(-8deg); }
  to { transform: translateY(-120vh) rotate(8deg); }
}

@media (max-width: 820px) {
  .hero,
  .admin-top,
  .branded-hero,
  .login-hero,
  .admin-dashboard,
  .control-grid,
  .live-board,
  .display-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .login-hero h1 {
    white-space: normal;
  }

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

  .display-layout {
    min-height: auto;
  }

  .called-rail {
    border-right: 0;
    padding-right: 0;
  }

  .display-current {
    min-height: 54vh;
  }
}

@media print {
  body {
    background: white;
  }

  body * {
    visibility: hidden;
  }

  #ticketCard,
  #ticketCard *,
  #printArea,
  #printArea * {
    visibility: visible;
  }

  #ticketCard {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100vw;
  }

  #printArea {
    display: block;
    position: absolute;
    inset: 0;
  }

  .print-ticket {
    width: 100vw;
    page-break-after: always;
    margin: 0;
  }
}
