:root {
  --bg: #06121c;
  --panel: rgba(13, 30, 44, 0.82);
  --panel-border: rgba(127, 178, 204, 0.25);
  --text: #e7f3ff;
  --muted: #94b4c9;
  --brand: #00c9a8;
  --brand-2: #ffb74d;
  --danger: #ff5d73;
  --ok: #7adf8f;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Space Grotesk", "Noto Sans SC", "PingFang SC", sans-serif;
  color: var(--text);
  background: radial-gradient(130% 150% at 10% 5%, #12385a 0%, #081a2a 45%, #050e16 100%);
  min-height: 100%;
}

body[data-admin-theme="forest"] {
  --panel: rgba(21, 36, 31, 0.84);
  --panel-border: rgba(148, 197, 165, 0.24);
  --brand: #7ad66f;
  --brand-2: #d8f28a;
}

body[data-admin-theme="sunset"] {
  --panel: rgba(42, 28, 23, 0.84);
  --panel-border: rgba(228, 165, 128, 0.24);
  --brand: #ffb05a;
  --brand-2: #ffd59b;
}

a {
  color: inherit;
}

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

button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 14px;
  cursor: pointer;
  color: #062632;
  background: linear-gradient(130deg, var(--brand), #66f3d8);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 201, 168, 0.25);
}

button.secondary {
  color: var(--text);
  background: rgba(12, 32, 47, 0.7);
  border-color: rgba(143, 178, 200, 0.28);
}

button.warn {
  color: #30140e;
  background: linear-gradient(130deg, #ffce70, #ff9d5c);
}

button.danger {
  color: #fff;
  background: linear-gradient(130deg, #ff4f6f, #ff7a59);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(127, 178, 204, 0.22);
  border-radius: 10px;
  background: rgba(5, 23, 36, 0.74);
  color: var(--text);
  padding: 8px 10px;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

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

.page {
  width: min(1300px, 95vw);
  margin: 22px auto;
  display: grid;
  gap: 16px;
}

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

.title {
  font-weight: 700;
  letter-spacing: 0.3px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: stretch;
}

.auth-side {
  border: 1px solid rgba(127, 178, 204, 0.18);
  border-radius: 18px;
  padding: 22px;
  background:
    radial-gradient(110% 130% at 0% 0%, rgba(0, 201, 168, 0.16) 0%, transparent 48%),
    linear-gradient(155deg, rgba(7, 29, 43, 0.92), rgba(8, 22, 33, 0.72));
  display: grid;
  gap: 14px;
  align-content: center;
  min-height: 250px;
}

.auth-title {
  font-size: clamp(24px, 2.4vw, 38px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.auth-copy {
  display: grid;
  gap: 8px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 48ch;
}

.auth-stack {
  display: grid;
  gap: 14px;
}

.auth-card {
  border: 1px solid rgba(127, 178, 204, 0.22);
  border-radius: 18px;
  padding: 18px;
  background: rgba(7, 24, 38, 0.66);
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 14px;
  min-height: 72vh;
}

.admin-sidebar {
  border: 1px solid rgba(127, 178, 204, 0.2);
  border-radius: 18px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(0, 201, 168, 0.14), transparent 40%),
    rgba(8, 25, 38, 0.84);
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
  box-shadow: var(--shadow);
}

.admin-sidebar-head {
  display: grid;
  gap: 4px;
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.admin-nav-btn {
  width: 100%;
  text-align: left;
  color: var(--text);
  background: rgba(10, 29, 43, 0.72);
  border-color: rgba(127, 178, 204, 0.18);
}

.admin-nav-btn.active {
  color: #062632;
  background: linear-gradient(130deg, var(--brand), #66f3d8);
}

.admin-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.admin-inner-panel {
  padding-bottom: 12px;
}

.admin-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.admin-section-panel {
  display: grid;
  gap: 14px;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-kpi {
  padding: 16px;
}

.admin-kpi-value {
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 700;
  margin-top: 8px;
}

.admin-kpi-text {
  font-size: 18px;
  line-height: 1.4;
}

.theme-option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.theme-option {
  color: var(--text);
  background: rgba(12, 32, 47, 0.7);
  border-color: rgba(143, 178, 200, 0.28);
}

.theme-option.active {
  color: #062632;
  background: linear-gradient(130deg, var(--brand), #66f3d8);
}

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

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

.row > * {
  flex: 1;
  min-width: 120px;
}

.list {
  display: grid;
  gap: 7px;
  max-height: 340px;
  overflow: auto;
  padding-right: 3px;
}

.item {
  border: 1px solid rgba(127, 178, 204, 0.21);
  border-radius: 12px;
  padding: 10px;
  background: rgba(7, 24, 38, 0.6);
}

.item.active {
  border-color: rgba(0, 201, 168, 0.7);
  box-shadow: inset 0 0 0 1px rgba(0, 201, 168, 0.3);
}

.item-title {
  font-size: 14px;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(127, 178, 204, 0.3);
  color: var(--muted);
}

.badge.brand {
  border-color: rgba(0, 201, 168, 0.55);
  color: #8bffe3;
}

.badge.warn {
  border-color: rgba(255, 183, 77, 0.55);
  color: #ffd89a;
}

.badge.danger {
  border-color: rgba(255, 93, 115, 0.55);
  color: #ff9cad;
}

.stage-card {
  border: 1px solid rgba(127, 178, 204, 0.25);
  border-radius: 12px;
  padding: 10px;
  background: rgba(6, 26, 40, 0.72);
}

.stage-action-row {
  flex-wrap: nowrap;
}

.stage-action-row > * {
  min-width: 0;
  flex: 1 1 0;
}

.rich-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.rich-toolbar button {
  min-width: 34px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
}

.rich-toolbar button.swatch {
  color: transparent;
  border: 1px solid rgba(127, 178, 204, 0.38);
}

.rich-editor {
  margin-top: 8px;
  border: 1px solid rgba(127, 178, 204, 0.25);
  border-radius: 10px;
  background: rgba(5, 23, 36, 0.74);
  color: var(--text);
  min-height: 120px;
  padding: 10px;
  line-height: 1.6;
  overflow: auto;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #7fa0b6;
}

.stage-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1.3fr 0.9fr 0.8fr 0.8fr;
}

.code {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  color: #9fd3ff;
}

.status-line {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

.display-page {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 85% 15%, rgba(255, 183, 77, 0.22) 0%, transparent 46%),
    radial-gradient(130% 120% at 12% 8%, rgba(0, 201, 168, 0.28) 0%, transparent 52%),
    linear-gradient(160deg, #030b12 0%, #071422 45%, #0c2233 100%);
}

.display-shell {
  height: 100%;
  padding: min(3vh, 24px) min(2.5vw, 30px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}

.display-top {
  display: grid;
  gap: 6px;
}

.display-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.display-hero {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 18px;
}

.display-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: clamp(20px, 2.1vw, 34px);
  font-weight: 700;
  line-height: 1.15;
}

.title-timer-wrap {
  border: 1px solid rgba(127, 178, 204, 0.3);
  background: rgba(7, 24, 38, 0.7);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.top-timer-label {
  color: #b7e9ff;
  font-size: clamp(13px, 0.82vw, 15px);
  letter-spacing: 0.3px;
}

.top-timer-value {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: clamp(30px, 4.7vw, 74px);
  line-height: 1;
  letter-spacing: 2px;
  color: #ebfffa;
  text-shadow: 0 0 26px rgba(0, 201, 168, 0.35);
  transition: color 0.3s ease;
}

.top-timer-value.warn {
  color: #ffe2b5;
  text-shadow: 0 0 36px rgba(255, 183, 77, 0.45);
}

.clock {
  font-size: clamp(16px, 1.2vw, 24px);
  color: var(--muted);
  white-space: nowrap;
}

.display-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 14px;
  min-height: 0;
}

.timer-zone {
  border: 1px solid rgba(127, 178, 204, 0.27);
  border-radius: 24px;
  background: rgba(8, 23, 37, 0.58);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 16px;
  gap: 12px;
}

.task-head h3 {
  margin: 0;
  font-size: clamp(24px, 1.85vw, 36px);
  color: #f3fbff;
}

.task-head {
  display: grid;
  gap: 6px;
}

.progress-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: rgba(9, 34, 53, 0.72);
  border: 1px solid rgba(127, 178, 204, 0.22);
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 0.3s ease;
}

.info-content {
  flex: 1;
  min-height: 240px;
  font-size: clamp(22px, 1.6vw, 36px);
  color: #dff3ff;
  overflow: auto;
  line-height: 1.78;
  font-weight: 500;
  border: 1px solid rgba(127, 178, 204, 0.28);
  border-radius: 14px;
  background: rgba(4, 19, 31, 0.78);
  padding: 18px 20px;
}

.info-content p,
.info-content ul,
.info-content ol {
  margin: 0 0 0.6em;
}

.info-content strong,
.info-content b {
  color: #ffffff;
}

.next-box,
.track-box {
  border: 1px solid rgba(127, 178, 204, 0.25);
  border-radius: 18px;
  background: rgba(7, 22, 34, 0.56);
  padding: 12px;
}

.stage-track {
  display: grid;
  gap: 8px;
  max-height: 58vh;
  overflow: auto;
}

.track-item {
  border-radius: 10px;
  padding: 8px;
  border: 1px solid rgba(127, 178, 204, 0.25);
  background: rgba(7, 24, 38, 0.75);
  color: #8fb0c3;
}

.track-item.done {
  color: #7adf8f;
  border-color: rgba(122, 223, 143, 0.45);
}

.track-item.current {
  color: #eafffb;
  border-color: rgba(0, 201, 168, 0.62);
  box-shadow: inset 0 0 0 1px rgba(0, 201, 168, 0.35);
}

.display-footer {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: clamp(13px, 1vw, 16px);
}

.error-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 15, 24, 0.94);
  display: grid;
  place-items: center;
  z-index: 50;
}

.error-card {
  width: min(560px, 92vw);
  border: 1px solid rgba(255, 93, 115, 0.45);
  border-radius: 18px;
  padding: 18px;
  background: rgba(28, 10, 16, 0.9);
}

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

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-kpi-grid,
  .theme-option-grid {
    grid-template-columns: 1fr 1fr;
  }

  .display-main {
    grid-template-columns: 1fr;
  }

  .display-top-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .display-hero {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

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

  .stage-track {
    max-height: 34vh;
  }

  .title-timer-wrap {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .top-timer-value {
    font-size: clamp(30px, 9vw, 56px);
  }
}

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

  .admin-kpi-grid,
  .theme-option-grid {
    grid-template-columns: 1fr;
  }
}
