:root {
  --bg: #f4f6fb;
  --bg-accent: #eef2ff;
  --panel: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e0e9ff;
  --danger: #dc2626;
  --success: #16a34a;
  --border: #e2e8f0;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 320px);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 64px;
}

.wrap {
  width: 100%;
  max-width: 640px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.topbar .brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  display: block;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-right: auto;
  margin-left: 24px;
}

.topbar-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.topbar-nav a:hover {
  color: var(--accent);
}

.nav-highlight {
  color: var(--accent) !important;
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: 999px;
}

.qr-promo {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: var(--text);
  background: var(--accent-soft);
  border: 1.5px dashed var(--accent);
}

.qr-promo-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.qr-promo-text {
  flex: 1;
  min-width: 160px;
}

.qr-promo-text h3 {
  margin: 0 0 2px;
  font-size: 1.05rem;
}

.qr-promo-text p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.qr-promo-btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 18px;
  border-radius: 10px;
  white-space: nowrap;
}

.upgrade-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
  color: white;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  margin-right: 10px;
}

.topbar a#login-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.topbar a#login-link:hover {
  border-color: var(--accent);
}

.user-area {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.user-area .copy-btn {
  width: auto;
  padding: 6px 12px;
  font-size: 0.8rem;
}

.plan-badge {
  background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.ad-slot {
  margin-bottom: 20px;
  min-height: 0;
  text-align: center;
}

header {
  text-align: center;
  margin-bottom: 28px;
}

header h1 {
  font-size: 2.1rem;
  font-weight: 800;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

header p {
  color: var(--muted);
  margin: 0;
  font-size: 1.05rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

input[type="text"], input[type="url"] {
  width: 100%;
  padding: 12px 14px;
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.slug-row span {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

button {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover {
  background: var(--accent-hover);
}

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

.result {
  display: none;
  margin-top: 16px;
  padding: 16px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
}

.result.show {
  display: block;
}

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

.result-link-row a {
  flex: 1;
  color: var(--accent-hover);
  font-weight: 700;
  text-decoration: none;
  word-break: break-all;
}

.copy-btn {
  width: auto;
  padding: 8px 14px;
  font-size: 0.85rem;
  background: var(--text);
}

.copy-btn:hover {
  background: #334155;
}

.stats-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.error {
  display: none;
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 2px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.error.show {
  display: block;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.feature {
  text-align: center;
  padding: 16px 8px;
}

.feature .icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.feature h3 {
  font-size: 0.9rem;
  margin: 0 0 4px;
}

.feature p {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

.cta-panel {
  background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
  color: white;
  border: none;
  text-align: center;
}

.cta-panel h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.cta-panel p {
  margin: 0 0 18px;
  opacity: 0.9;
  font-size: 0.95rem;
}

.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.cta-btn {
  display: inline-block;
  width: auto;
  background: white;
  color: var(--accent-hover);
  font-weight: 700;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.95rem;
  cursor: pointer;
}

.cta-btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
}

.history {
  font-size: 0.9rem;
}

.history h2 {
  font-size: 1rem;
  margin: 0 0 12px;
  color: var(--text);
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.history-item:first-of-type {
  border-top: none;
}

.history-item .short {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.history-item .long {
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item .clicks {
  color: var(--accent);
  font-size: 0.8rem;
  white-space: nowrap;
  text-decoration: none;
  font-weight: 600;
}

.empty {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 12px 0;
}

footer.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 24px;
}

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