:root {
  --bg: #0f1117;
  --card: #1a1d27;
  --card2: #20243a;
  --border: #2a2d3e;
  --text: #e2e8f0;
  --muted: #8892a4;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-dim: rgba(124, 58, 237, 0.12);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Header ──────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.logo span { color: var(--accent); }

.tabs {
  display: flex;
  gap: 4px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s, background .15s;
}

.tab-btn:hover { color: var(--text); background: rgba(255,255,255,.05); }
.tab-btn.active { color: var(--text); background: var(--accent-dim); }

/* ── Page Layout ─────────────────────────────────────── */
.page-layout {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  gap: 24px;
  max-width: 960px;
  margin: 32px auto;
  padding: 0 16px;
  align-items: start;
}

.ad-slot {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding: 12px 8px;
  gap: 6px;
}

.ad-slot .ad-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .8px;
  opacity: .6;
}

.ad-left, .ad-right { min-height: 480px; }

.ad-bottom-wrap {
  max-width: 960px;
  margin: 0 auto 40px;
  padding: 0 16px;
}

.ad-bottom {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-direction: row;
}

/* ── Card ────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 28px;
}

/* ── Tab content ─────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Form ────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

input[type="text"],
input[type="url"],
textarea,
select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}

input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }

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

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238892a4' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select option { background: var(--card2); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s, opacity .15s;
  text-decoration: none;
  font-family: inherit;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:not(:disabled):active { transform: scale(.97); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 12px;
  font-size: 12px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.btn-full { width: 100%; }

/* ── Image Upload ────────────────────────────────────── */
.image-upload-wrap {
  position: relative;
  cursor: pointer;
}

.image-upload-wrap input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.image-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  transition: border-color .15s, background .15s;
  background: var(--bg);
}

.image-drop-zone:hover,
.image-upload-wrap:hover .image-drop-zone {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.image-drop-zone.has-image {
  padding: 0;
  border: 2px solid var(--accent);
  overflow: hidden;
}

.image-preview-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 16px auto 8px;
}

.drop-icon { font-size: 32px; margin-bottom: 10px; }
.drop-text { font-size: 14px; color: var(--muted); }
.drop-text strong { color: var(--text); }
.drop-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Social Links ────────────────────────────────────── */
.add-link-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.add-link-row select { flex: 1; }

.link-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.link-item-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.link-item-icon svg { width: 18px; height: 18px; }

.link-item-name {
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 80px;
  color: var(--text);
}

.link-item input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 13px;
}

.link-item input:focus { border: none; box-shadow: none; }

.link-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}

.link-remove:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* ── Result Box ──────────────────────────────────────── */
.result-box {
  display: none;
  margin-top: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.result-box.show { display: block; }

.result-box .result-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}

.result-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}

.result-url-row .url-text {
  flex: 1;
  font-size: 14px;
  word-break: break-all;
  color: var(--accent);
}

.copy-feedback {
  font-size: 12px;
  color: var(--success);
  margin-top: 8px;
  display: none;
}

.copy-feedback.show { display: block; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 720px) {
  .page-layout { grid-template-columns: 1fr; }
  .ad-left, .ad-right { display: none; }
  .card { padding: 24px 20px; }
  .header-inner { padding: 0 16px; }
}

@media (max-width: 480px) {
  .add-link-row { flex-direction: column; }
}
