:root {
  --bg: #080c12;
  --bg-soft: #0f1722;
  --panel: #131d2b;
  --panel-2: #101827;
  --line: #2a3850;
  --text: #e9f1ff;
  --muted: #8fa2c3;
  --primary: #1d9bf0;
  --primary-2: #0d7bd4;
  --danger: #ff4b6e;
  --ok: #1cc37b;
  --radius: 14px;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", "Inter", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(29, 155, 240, 0.24), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(47, 129, 247, 0.2), transparent 34%),
    linear-gradient(180deg, #070b12, #0b121d 48%, #080d14);
}

.shell {
  max-width: 1420px;
  margin: 12px auto 26px;
  padding: 0 14px;
}

.hero {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(19, 29, 43, 0.96), rgba(11, 17, 28, 0.96));
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 10px;
  display: grid;
  gap: 10px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.1;
}

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

.hero p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  margin: 2px 0 0;
  padding: 0 6px;
  border-bottom: 1px solid #4f6488;
}

.hero .tab-nav {
  width: min(980px, 100%);
  justify-self: center;
}

.tab-btn {
  border: 1px solid #5f769d;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #2b3e5d, #1f314b);
  color: var(--text);
  padding: 6px 12px 5px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  min-width: 148px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.tab-btn:nth-child(1) {
  background: linear-gradient(180deg, #314865, #22344f);
}

.tab-btn:nth-child(2) {
  background: linear-gradient(180deg, #345468, #244050);
}

.tab-btn:nth-child(3) {
  background: linear-gradient(180deg, #41486d, #2d3454);
}

.tab-btn:hover {
  transform: translateY(-1px);
  border-color: #a6d8ff;
  box-shadow: 0 8px 14px rgba(14, 30, 49, 0.34);
}

.tab-btn.active {
  transform: translateY(1px);
  border-color: #8bd2ff;
  background: linear-gradient(180deg, #2aa4f4, #1787da);
  box-shadow: 0 0 0 1px rgba(181, 227, 255, 0.22), 0 8px 14px rgba(18, 100, 160, 0.28);
}

.tab-main {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  line-height: 1;
}

.tab-btn .tab-main .icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.tab-hint {
  display: none;
}

.tab-btn.active .tab-hint {
  color: #eaf6ff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.grid {
  display: grid;
  gap: 10px;
  align-items: start;
}

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

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

.print-grid {
  grid-template-columns: 48% 52%;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
  padding: 12px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.panel h3 {
  margin: 0;
  font-size: 14px;
}

label {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b111b;
  color: var(--text);
  padding: 10px;
  font-size: 14px;
}

textarea {
  resize: vertical;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #213047;
  color: var(--text);
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.05);
}

.btn.primary {
  border-color: #2fa2f4;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
}

.btn.danger {
  border-color: #ff5f7f;
  background: rgba(255, 75, 110, 0.22);
}

.btn.mini {
  padding: 5px 8px;
  font-size: 11px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  flex: 0 0 14px;
}

.status-pill {
  border: 1px solid rgba(47, 162, 244, 0.35);
  border-radius: 999px;
  background: rgba(47, 162, 244, 0.14);
  color: #bee4ff;
  display: inline-block;
  padding: 6px 10px;
  font-size: 12px;
}

.status-pill.error {
  border-color: rgba(255, 75, 110, 0.45);
  background: rgba(255, 75, 110, 0.18);
  color: #ffd3dd;
}

.list {
  margin-top: 8px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0d1522;
  padding: 8px;
}

.empty {
  font-size: 12px;
  color: var(--muted);
  padding: 8px;
}

.list-head {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #121d2e;
  padding: 8px;
  margin-bottom: 8px;
}

.list-item:last-child {
  margin-bottom: 0;
}

.list-item h4 {
  margin: 0;
  font-size: 13px;
}

.list-item p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.list-item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
}

.check-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 8px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #121d2e;
  padding: 8px;
}

.check-item:last-child {
  margin-bottom: 0;
}

.check-item input {
  margin-top: 3px;
}

.check-item strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.check-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.preview-actions {
  display: grid;
  grid-template-columns: minmax(110px, 180px) auto auto;
  gap: 8px;
  align-items: end;
}

.preview-frame {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b111b;
  padding: 10px;
  min-height: 420px;
  display: grid;
  place-items: center;
}

.preview-frame img {
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
}

.link-btn {
  border: 1px dashed #3e8fda;
  background: rgba(47, 162, 244, 0.1);
  color: #cfeaff;
  border-radius: 10px;
  padding: 8px 10px;
  width: fit-content;
  font-weight: 700;
  margin-bottom: 10px;
  cursor: pointer;
}

.quiz-builder {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 999;
}

.overlay.hidden {
  display: none;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 13, 0.75);
}

.overlay-card {
  position: relative;
  width: min(820px, 94vw);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(170deg, #111c2e, #0d1625);
  box-shadow: var(--shadow);
  padding: 14px;
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.overlay-header h2 {
  margin: 0;
}

.overlay-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.quiz-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f1928;
  padding: 12px;
}

.quiz-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.answer-mask {
  width: 100%;
  border: 1px solid #68778f;
  border-radius: 10px;
  background: #59677d;
  color: #ecf2ff;
  padding: 12px;
  font-weight: 800;
  cursor: pointer;
}

.answer-text {
  margin: 10px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #121d2e;
}

.hidden {
  display: none;
}

.overlay-nav {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(460px, 95vw);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
  padding: 16px;
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
}

.login-card p {
  margin: 6px 0 12px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 8px;
}

@media (max-width: 1120px) {
  .grid.two,
  .print-grid,
  .quiz-builder {
    grid-template-columns: 1fr;
  }

  .preview-actions {
    grid-template-columns: 1fr;
  }

  .tab-nav {
    justify-content: stretch;
    gap: 5px;
  }

  .tab-btn {
    min-width: 0;
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .hero-top {
    flex-direction: column;
    align-items: stretch;
  }
}
