@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --navy: #10264a;
  --blue: #38b6ff;
  --orange: #ff911d;
  --canvas: #f2f5f8;
  --line: #dfe6ed;
  --muted: #68798b;
  font-family: "Poppins", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--navy);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 7% 4%, rgba(56, 182, 255, 0.08), transparent 24rem),
    radial-gradient(circle at 92% 95%, rgba(255, 145, 29, 0.07), transparent 24rem),
    var(--canvas);
}

button,
input,
select {
  font: inherit;
}

button,
select,
label:has(input[type="file"]) {
  cursor: pointer;
}

.shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 120px;
}

.topbar {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.topbar p,
.panel-heading p {
  margin: 0 0 6px;
  color: #158ccc;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.topbar h1,
.panel-heading h2,
.login-card h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.topbar h1 {
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.status {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.status.online {
  border-color: #bce7d2;
  color: #168357;
}

.login-card {
  width: min(560px, 100%);
  margin: 12vh auto 0;
  padding: clamp(24px, 5vw, 44px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: white;
  box-shadow: 0 24px 70px rgba(16, 38, 74, 0.1);
}

.login-brand {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue), #178ccf);
  color: white;
  font-weight: 950;
}

.login-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.login-card form {
  grid-column: 1 / -1;
  margin-top: 8px;
  display: grid;
  gap: 13px;
}

.login-card label,
.mode-row label,
.interval-row {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.login-card input,
.mode-row select,
.interval-row input,
.video-copy input,
.ticker-item input {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  color: var(--navy);
}

.login-card input {
  height: 44px;
  padding: 0 12px;
}

.login-card button,
#save-button {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  background: var(--navy);
  color: white;
  font-weight: 850;
}

#login-error {
  min-height: 1rem;
  color: #aa4f49;
}

.connection-card {
  margin-bottom: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #cae5f5;
  border-radius: 16px;
  background: #f5fbfe;
}

.connection-card span,
.connection-card code {
  display: block;
}

.connection-card span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.62rem;
}

.connection-card code {
  overflow-wrap: anywhere;
  color: #147db6;
  font-size: 0.72rem;
  font-weight: 800;
}

.connection-card strong {
  color: #147db6;
  font-size: 0.7rem;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(360px, 0.78fr);
  gap: 20px;
  align-items: start;
}

.panel {
  padding: clamp(20px, 2.6vw, 32px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 55px rgba(16, 38, 74, 0.07);
}

.panel-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-heading h2 {
  font-size: 1.28rem;
}

.panel-heading span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.upload-button,
.secondary-button {
  min-height: 40px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #a9d8ef;
  border-radius: 11px;
  background: #f2faff;
  color: #1687c3;
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.mode-row {
  margin-bottom: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.mode-row select {
  width: auto;
  min-width: 220px;
  height: 39px;
  padding: 0 32px 0 10px;
}

.mode-row > span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #eaf7fe;
  color: #1785bf;
  font-size: 0.62rem;
  font-weight: 850;
}

.video-list,
.ticker-list {
  display: grid;
  gap: 10px;
}

.video-item {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 36px 98px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 1px solid #e1e8ee;
  border-radius: 15px;
  background: #fbfcfd;
}

.video-number {
  color: #4b718a;
  font-size: 0.68rem;
  font-weight: 950;
  text-align: center;
}

.video-preview {
  width: 98px;
  height: 118px;
  display: block;
  border-radius: 9px;
  background: #e6eef4;
  object-fit: cover;
}

.video-copy {
  min-width: 0;
}

.video-copy label,
.ticker-item label {
  display: block;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
}

.video-copy input,
.ticker-item input {
  height: 37px;
  padding: 0 10px;
  font-size: 0.72rem;
}

.video-copy code {
  margin: 7px 0 8px;
  display: block;
  overflow: hidden;
  color: #7b8995;
  font-size: 0.55rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enabled-row {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  color: var(--navy) !important;
  cursor: pointer;
}

.enabled-row input {
  width: auto;
  height: auto;
  margin: 0;
}

.item-actions {
  display: grid;
  grid-template-columns: repeat(2, 30px);
  gap: 5px;
}

.item-actions button {
  width: 30px;
  height: 29px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: #60758a;
  font-weight: 900;
}

.item-actions .delete-item {
  grid-column: 1 / -1;
  width: 65px;
  color: #a55d58;
}

.empty-state {
  min-height: 220px;
  padding: 36px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed #bcdcee;
  border-radius: 16px;
  background: #f8fcff;
  text-align: center;
}

.empty-state strong {
  font-size: 0.85rem;
}

.empty-state span {
  max-width: 25rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.interval-row {
  margin-bottom: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.interval-row input {
  width: 58px;
  height: 37px;
  margin: 0;
  padding: 0 8px;
  font-weight: 850;
}

.ticker-item {
  padding: 12px;
  border: 1px solid #e1e8ee;
  border-radius: 14px;
  background: #fbfcfd;
}

.ticker-topline {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ticker-topline strong {
  font-size: 0.68rem;
}

.ticker-fields {
  display: grid;
  gap: 8px;
}

.publish-bar {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 84px;
  padding: 14px max(20px, calc((100vw - 1480px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 -10px 40px rgba(16, 38, 74, 0.09);
  backdrop-filter: blur(15px);
}

.publish-bar strong,
.publish-bar span {
  display: block;
}

.publish-bar strong {
  font-size: 0.78rem;
}

.publish-bar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.63rem;
}

#save-button {
  min-width: 170px;
  padding: 0 18px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

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

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

  .topbar,
  .connection-card,
  .panel-heading,
  .mode-row,
  .publish-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    align-items: flex-start;
  }

  .video-item {
    grid-template-columns: 28px 76px minmax(0, 1fr);
  }

  .video-preview {
    width: 76px;
    height: 104px;
  }

  .video-item .item-actions {
    grid-column: 2 / -1;
    display: flex;
    justify-content: flex-end;
  }

  .item-actions .delete-item {
    width: 30px;
  }

  .publish-bar {
    min-height: 112px;
  }
}
