:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-elev: #121826;
  --bg-card: #141c2b;
  --text: #f2f6ff;
  --muted: #b9c6d9;
  --border: rgba(255, 255, 255, 0.12);
  --accent: #2dd4bf;
  --accent-strong: #22c1b3;
  --danger: #ff6b6b;
  --shadow: 0 20px 60px rgba(4, 9, 20, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Avenir", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(1200px 520px at 15% -10%, rgba(45, 212, 191, 0.22), transparent 60%),
    radial-gradient(900px 460px at 110% 10%, rgba(59, 130, 246, 0.18), transparent 55%),
    linear-gradient(180deg, #0b0f16 0%, #0f1624 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px;
  touch-action: manipulation;
}

body.auth-page {
  display: grid;
  place-items: center;
}

.lang-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(17, 24, 39, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.auth-bubble {
  position: fixed;
  top: 16px;
  right: 80px;
  display: grid;
  gap: 6px;
  z-index: 10;
}

.auth-toggle {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 8px 12px;
  background: rgba(17, 24, 39, 0.9);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.auth-caret {
  font-size: 10px;
  opacity: 0.7;
}

.auth-menu {
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.96);
  border-radius: 12px;
  padding: 6px;
  display: grid;
  gap: 4px;
  min-width: 180px;
  box-shadow: var(--shadow);
}

.auth-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

.auth-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.auth-logout {
  color: var(--danger);
}

.hidden {
  display: none;
}

.card {
  width: min(460px, 100%);
  background: linear-gradient(160deg, rgba(20, 28, 43, 0.98), rgba(12, 19, 31, 0.98));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  display: grid;
  gap: 16px;
  box-shadow: var(--shadow);
}

h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.hint {
  margin: 0;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.field input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 20, 0.9);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 20, 0.9);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(45, 212, 191, 0.6);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.15);
}

.actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

button {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #051319;
  font-weight: 700;
  transition: transform 0.08s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button:hover {
  box-shadow: 0 10px 24px rgba(45, 212, 191, 0.35);
  transform: translateY(-1px);
}

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

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(10, 16, 26, 0.9);
  color: var(--text);
  font-weight: 700;
  transition: border-color 0.2s ease, transform 0.08s ease, box-shadow 0.2s ease;
}

.link-btn:hover {
  border-color: #3a3a3a;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

.link-btn:active {
  transform: translateY(0);
}

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

.status {
  min-height: 20px;
  font-size: 14px;
  color: #f2c46d;
}

.divider {
  height: 1px;
  background: #2a2a2a;
  margin: 4px 0;
}

.section-title {
  margin: 0;
  font-size: 18px;
}

.auth-card {
  background: #141414;
  border-color: #2a2a2a;
}

.auth-page .auth-card {
  width: min(560px, 100%);
}

.auth-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

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

.auth-head h3 {
  margin: 0;
  font-size: 16px;
}

.auth-note {
  font-size: 11px;
  color: #8d8d8d;
  text-align: right;
}

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

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: #b9b9b9;
}

.auth-switch .link-btn {
  padding: 8px 12px;
  font-size: 13px;
}

.captcha-box {
  border: 1px dashed #3b3b3b;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  color: #b9b9b9;
  text-align: center;
}

.preview {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(45, 212, 191, 0.25);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(18, 26, 42, 0.95), rgba(12, 19, 31, 0.96));
  box-shadow: 0 18px 40px rgba(6, 12, 22, 0.55);
}

.preview-anchor {
  position: relative;
}

.preview-bubble {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(420px, 90vw);
  z-index: 5;
  box-shadow: var(--shadow);
}

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

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.preview-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preview-video {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.12);
  min-height: 160px;
}

.preview-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 12px;
  background: rgba(8, 14, 24, 0.78);
  color: #e8fbf8;
  border: 1px solid rgba(45, 212, 191, 0.35);
  padding: 4px 8px;
  border-radius: 999px;
}

.preview-panel {
  border-radius: 10px;
  border: 1px solid #222;
  background: rgba(0, 0, 0, 0.4);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.mock-title {
  font-size: 12px;
  color: #aaa;
}

.mock-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(34px, 1fr));
  gap: 6px;
  font-size: 12px;
  color: #ddd;
}

.mock-grid span {
  display: grid;
  place-items: center;
  padding: 6px 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.pill-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #333;
  background: rgba(8, 14, 24, 0.85);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

@media (max-width: 700px) {
  .preview-body {
    grid-template-columns: 1fr;
  }

  .auth-bubble {
    right: 16px;
    top: 60px;
  }
}

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

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-card {
  position: relative;
  width: min(420px, 92vw);
  background: #1b1b1b;
  border: 1px solid #333;
  border-radius: 14px;
  padding: 20px;
  display: grid;
  gap: 12px;
  z-index: 1;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-desc {
  margin: 0;
  color: #bdbdbd;
  font-size: 13px;
}

.modal-link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.modal-link-row input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #0f0f0f;
  color: #fff;
  font-size: 13px;
}

.icon-btn {
  padding: 6px 10px;
  border-radius: 8px;
  background: #1a1a1a;
  border: 1px solid #333;
  font-weight: 600;
}

.ghost-btn {
  background: rgba(8, 14, 24, 0.85);
  border: 1px solid rgba(45, 212, 191, 0.25);
  font-weight: 600;
  color: var(--text);
}

.primary-btn {
  width: 100%;
}

@media (max-width: 520px) {
  .modal-link-row {
    grid-template-columns: 1fr;
  }
}
