:root {
  --bg-0: #0e1116;
  --bg-1: #141923;
  --bg-2: #1b2230;
  --fg: #e8eef8;
  --muted: #a7b1c3;
  --line: #2a3446;
  --ok: #22c55e;
  --off: #ef4444;
  --stale: #f59e0b;
  --card: #161d29;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--fg);
  background: radial-gradient(circle at 20% -10%, #24304a 0%, transparent 40%),
    radial-gradient(circle at 80% 120%, #1d283d 0%, transparent 45%),
    var(--bg-0);
}

.page-auth,
.page-dashboard,
.page-share {
  min-height: 100vh;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 420px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.auth-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

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

label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

input,
button {
  font: inherit;
}

input[type="text"],
input[type="password"],
input[type="url"] {
  background: var(--bg-1);
  border: 1px solid var(--line);
  color: var(--fg);
  border-radius: 10px;
  padding: 10px 12px;
}

button {
  border: 0;
  border-radius: 10px;
  background: #2f6fec;
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 16, 24, 0.85);
  backdrop-filter: blur(4px);
}

.topbar a {
  color: #b7d2ff;
  text-decoration: none;
}

.logout-form {
  margin: 0;
}

.link-button {
  background: transparent;
  border: 0;
  color: #b7d2ff;
  padding: 0;
}

.dashboard-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: grid;
  gap: 16px;
}

.share-wrap {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 52px 20px 64px;
  display: grid;
  gap: 28px;
}

.page-share {
  min-height: 100vh;
  color: #f2ecdf;
  background:
    radial-gradient(circle at top, rgba(76, 225, 143, 0.08), transparent 28%),
    radial-gradient(circle at 20% 20%, rgba(103, 86, 167, 0.1), transparent 25%),
    linear-gradient(180deg, rgba(14, 16, 25, 0.88), rgba(10, 11, 18, 0.98)),
    #090a10;
  position: relative;
  overflow-x: hidden;
}

.share-hero {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 58vh;
  padding: 28px 20px 18px;
}

.share-aura {
  position: absolute;
  inset: auto auto 18% 50%;
  width: min(76vw, 600px);
  height: min(76vw, 600px);
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(40, 219, 121, 0.06) 0%, rgba(40, 219, 121, 0.02) 25%, transparent 68%);
  filter: blur(16px);
  pointer-events: none;
}

.share-profile-cluster {
  position: relative;
  margin-bottom: 28px;
}

.share-profile-frame {
  width: clamp(156px, 24vw, 208px);
  aspect-ratio: 1;
  padding: 3px;
  border-radius: 50%;
  background: rgba(21, 24, 35, 0.92);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.45),
    0 0 40px rgba(63, 229, 135, 0.08);
  overflow: visible;
}

.share-profile-frame::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background:
    conic-gradient(
      from 0deg,
      rgba(83, 242, 156, 0.92) 0deg,
      rgba(83, 242, 156, 0.22) 72deg,
      rgba(83, 242, 156, 0.02) 150deg,
      rgba(83, 242, 156, 0.18) 232deg,
      rgba(83, 242, 156, 0.88) 320deg,
      rgba(83, 242, 156, 0.92) 360deg
    );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  filter: drop-shadow(0 0 10px rgba(83, 242, 156, 0.28));
  animation: share-ring-spin 3.2s linear infinite;
}

.share-profile-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(160, 170, 211, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.share-profile-frame .profile-image {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(143, 152, 203, 0.24);
  background:
    radial-gradient(circle at top, rgba(57, 54, 84, 0.9), rgba(28, 26, 40, 0.96));
}

.share-copy {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.share-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: rgba(180, 188, 215, 0.55);
}

.display-name {
  margin: 0;
  font-family: "Baskerville Old Face", "Times New Roman", serif;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 0.95;
}

.share-handle {
  margin: 0;
  color: rgba(176, 179, 194, 0.7);
  font-size: 0.94rem;
  letter-spacing: 0.08em;
}

.share-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid rgba(72, 239, 146, 0.24);
  background: rgba(10, 18, 17, 0.62);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  font-size: 0.88rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.share-status-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.share-status-pill.is-online {
  color: #53f29c;
}

.share-status-pill.is-offline {
  color: #ff7a90;
}

.share-meta {
  margin: 18px 0 0;
  color: rgba(198, 202, 218, 0.6);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.share-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(118, 124, 155, 0.28), transparent);
}

.share-sources {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.share-source-card {
  min-height: 220px;
  padding: 24px 22px;
  border: 1px solid rgba(134, 142, 174, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(24, 24, 33, 0.94), rgba(18, 18, 28, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 20px 55px rgba(0, 0, 0, 0.28);
  display: grid;
  align-content: start;
  justify-items: center;
  text-align: center;
  gap: 10px;
}

.share-source-card h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(198, 203, 220, 0.74);
}

.share-source-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  margin-bottom: 12px;
  color: #b8bef6;
  background: linear-gradient(180deg, rgba(61, 67, 102, 0.72), rgba(42, 44, 67, 0.72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.share-source-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-source-state {
  margin: 2px 0 0;
  font-size: 0.96rem;
  letter-spacing: 0.14em;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.share-source-state.is-online {
  color: #53f29c;
}

.share-source-state.is-offline {
  color: rgba(186, 189, 208, 0.56);
}

.share-source-state::before {
  content: "•";
  margin-right: 0.35em;
}

.share-source-meta {
  margin: 0;
  color: rgba(167, 171, 189, 0.58);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 16ch;
}

.hero-card,
.source-card,
.manage-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.hero-card {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}

.profile-image {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
}

.state-dot {
  position: absolute;
  right: 8px;
  bottom: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 5px solid #13151f;
  box-shadow:
    0 0 0 10px rgba(83, 242, 156, 0.12),
    0 0 28px currentColor;
}

.state-dot.is-online {
  background: #53f29c;
  color: #53f29c;
  animation: share-dot-pulse 2.5s ease-in-out infinite;
}

.state-dot.is-offline {
  background: #ff7a90;
  color: #ff7a90;
  box-shadow:
    0 0 0 10px rgba(255, 122, 144, 0.12),
    0 0 28px currentColor;
}

@keyframes share-ring-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes share-dot-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 10px rgba(83, 242, 156, 0.12),
      0 0 28px currentColor;
  }

  50% {
    box-shadow:
      0 0 0 15px rgba(83, 242, 156, 0.06),
      0 0 34px currentColor;
  }
}

@media (prefers-reduced-motion: reduce) {
  .share-profile-frame::before,
  .state-dot.is-online {
    animation: none;
  }
}

.last-update {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.source-card {
  padding: 16px;
}

.source-card h2 {
  margin: 0 0 10px;
}

.source-state {
  display: inline-block;
  margin-bottom: 10px;
  font-weight: 700;
}

.source-state.is-online {
  color: var(--ok);
}

.source-state.is-offline {
  color: var(--off);
}

.source-state.is-stale {
  color: var(--stale);
}

.source-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.source-card ul span {
  color: var(--fg);
}

.manage-card {
  padding: 16px;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
}

.error-box,
.ok-box {
  border-radius: 10px;
  padding: 10px 12px;
}

.error-box {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.ok-box {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.45);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

@media (max-width: 600px) {
  .profile-image {
    width: 100%;
    height: 100%;
  }

  .dashboard-wrap {
    padding-top: 16px;
  }

  .share-wrap {
    padding: 24px 16px 40px;
  }

  .share-hero {
    min-height: auto;
    padding-top: 18px;
  }

  .share-kicker {
    letter-spacing: 0.36em;
  }

  .share-source-card {
    min-height: 180px;
    border-radius: 20px;
  }

  .state-dot {
    right: 0;
    bottom: 4px;
  }
}
