:root {
  --bg: #080a10;
  --bg-soft: #0d1119;
  --card: #121722;
  --card-2: #171e2b;
  --text: #e7ecf4;
  --muted: #8b96a8;
  --border: #232c3d;
  --primary: #7c6cfd;
  --primary-2: #b06dfc;
  --gradient: linear-gradient(135deg, #6d5dfc, #b06dfc);
  --danger: #f87171;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Segoe UI", Meiryo, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2 {
  margin: 0;
}

/* ---------- ナビゲーション ---------- */
.nav {
  background: rgba(13, 17, 25, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------- ボタン ---------- */
.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--card);
  color: var(--text);
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.1s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 6px 16px rgba(109, 93, 252, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-small {
  padding: 7px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

/* ---------- ランディング ---------- */
.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 20px 40px;
  text-align: center;
}

.hero-title {
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.hero-title em {
  font-style: normal;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
  margin: 20px 0 36px;
}

.auth-card {
  max-width: 420px;
  margin: 0 auto;
  text-align: left;
  padding: 0;
  overflow: hidden;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 14px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  color: var(--primary);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.form {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.form input {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg-soft);
  color: var(--text);
}

.form input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: transparent;
}

.url-preview {
  font-weight: 500;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.url-preview span {
  color: var(--primary);
}

.msg {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.msg.error {
  color: var(--danger);
}

.msg.ok {
  color: #16a34a;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 0 22px 22px;
}

.hint code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px 20px;
}

/* ---------- ダッシュボード ---------- */
.dashboard-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 80px;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.settings h2,
.links-head h2 {
  font-size: 18px;
  margin-bottom: 18px;
}

.settings {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 76px;
}

.settings label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.settings input,
.settings textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-soft);
  color: var(--text);
  resize: vertical;
}

.settings input:focus,
.settings textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: transparent;
}

.settings input:disabled {
  background: var(--bg);
  color: var(--muted);
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-actions {
  display: flex;
  gap: 8px;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.avatar-sm {
  width: 72px;
  height: 72px;
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  font-size: 40px;
  font-weight: 700;
}

.links-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.links-head .hint {
  padding: 0;
  text-align: left;
  margin: -10px 0 14px;
}

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.link-index {
  width: 24px;
  height: 24px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.link-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.link-fields input {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-soft);
  color: var(--text);
}

.link-fields input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: transparent;
}

.link-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}

.icon-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.icon-btn.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.save-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.password-card {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.password-card h2 {
  font-size: 18px;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.password-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.password-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-soft);
  color: var(--text);
}

.password-form input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: transparent;
}

.password-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.save-bar .msg {
  font-size: 14px;
}

/* ---------- 公開プロフィールページ ---------- */
.profile {
  max-width: 640px;
  margin: 0 auto;
  padding: 64px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-name {
  font-size: 28px;
  font-weight: 800;
  margin: 18px 0 0;
  letter-spacing: -0.02em;
}

.bio {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.7;
  margin: 12px 0 0;
  opacity: 0.85;
}

.links {
  width: 100%;
  max-width: 480px;
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-btn {
  display: block;
  padding: 16px 20px;
  border: 1.5px solid;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(6px);
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.link-btn:hover {
  transform: translateY(-2px);
  opacity: 0.85;
}

.powered {
  margin-top: 40px;
  font-size: 12px;
  opacity: 0.4;
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 720px) {
  .dashboard-main {
    grid-template-columns: 1fr;
  }
  .settings {
    position: static;
  }
  .hero {
    padding-top: 48px;
  }
}

.hidden {
  display: none !important;
}
