:root {
  --theme-color: #99F6E4;
  --background: #F8FAFC;
  --card: rgba(255, 255, 255, 0.88);
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --soft-border: rgba(148, 163, 184, 0.26);
  --shadow: 0 18px 50px rgba(31, 41, 55, 0.08);
  --shadow-small: 0 10px 28px rgba(31, 41, 55, 0.08);
  --radius-card: 8px;
  --radius-button: 999px;
  --danger: #B91C1C;
  --danger-bg: #FEE2E2;
  --success: #047857;
  --success-bg: #D1FAE5;
  --focus: rgba(37, 99, 235, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(248, 250, 252, 0.9)),
    var(--background);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.public-page {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 28px 18px 42px;
}

.public-header {
  position: relative;
  overflow: hidden;
  padding: 30px 24px 26px;
  text-align: center;
}

.public-header::before {
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: var(--theme-color);
  content: "";
}

.soft-card,
.admin-card,
.inline-panel {
  border: 1px solid var(--soft-border);
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.centered-card {
  display: grid;
  min-height: 240px;
  place-items: center;
  padding: 30px 22px;
  text-align: center;
}

.avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.avatar {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  overflow: hidden;
  border: 5px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: color-mix(in srgb, var(--theme-color) 54%, white);
  box-shadow: 0 16px 32px rgba(31, 41, 55, 0.12);
  color: #111827;
  font-size: 34px;
  font-weight: 750;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.public-title {
  margin: 0;
  color: var(--text);
  font-size: 30px;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.13;
}

.public-description {
  max-width: 38rem;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 15px;
}

.link-stack {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.link-row,
.accordion-trigger,
.sub-link-row {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-small);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.link-row,
.accordion-trigger {
  padding: 12px 15px;
}

.link-row:hover,
.accordion-trigger:hover,
.sub-link-row:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--theme-color) 68%, #94A3B8);
  box-shadow: 0 16px 34px rgba(31, 41, 55, 0.12);
}

.link-row:focus-visible,
.accordion-trigger:focus-visible,
.sub-link-row:focus-visible,
.admin-button:focus-visible,
.text-button:focus-visible,
.danger-button:focus-visible,
.ghost-button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.link-icon,
.fallback-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.link-icon {
  object-fit: cover;
  background: #F8FAFC;
}

.fallback-icon {
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--theme-color) 48%, white);
  color: #111827;
  font-size: 13px;
  font-weight: 780;
}

.link-title {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
  text-align: left;
  font-weight: 700;
}

.link-arrow {
  color: var(--muted);
  font-weight: 800;
}

.accordion-trigger {
  justify-content: flex-start;
}

.accordion-trigger[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--theme-color) 74%, #94A3B8);
  background: color-mix(in srgb, var(--theme-color) 18%, white);
}

.accordion-panel {
  display: none;
  gap: 9px;
  margin: -2px 0 4px;
  padding-left: 16px;
}

.accordion-panel.is-open {
  display: grid;
}

.sub-link-row {
  min-height: 48px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: none;
}

.empty-state {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.setup-banner {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  border: 1px solid color-mix(in srgb, var(--theme-color) 62%, var(--border));
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.82);
  padding: 13px 15px;
  color: var(--text);
  box-shadow: var(--shadow-small);
}

.setup-banner span {
  color: var(--muted);
  font-size: 13px;
}

.notice-title {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
}

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

.loader {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(148, 163, 184, 0.24);
  border-top-color: var(--theme-color);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.admin-shell {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 28px 18px 56px;
}

.admin-top {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-title-block {
  padding: 24px;
}

.admin-title-block h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.18;
}

.admin-title-block p,
.section-help,
.field-help,
.card-meta,
.small-muted {
  color: var(--muted);
}

.admin-title-block p {
  margin: 8px 0 0;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-button,
.text-button,
.danger-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  padding: 10px 16px;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

.admin-button {
  background: color-mix(in srgb, var(--theme-color) 50%, white);
  color: #111827;
  box-shadow: var(--shadow-small);
}

.admin-button.is-active {
  border-color: color-mix(in srgb, var(--theme-color) 80%, #64748B);
  background: color-mix(in srgb, var(--theme-color) 76%, white);
}

.admin-button:hover,
.text-button:hover,
.danger-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.text-button {
  border-color: color-mix(in srgb, var(--theme-color) 48%, var(--border));
  background: white;
  color: var(--text);
}

.danger-button {
  border-color: #FECACA;
  background: var(--danger-bg);
  color: var(--danger);
}

.ghost-button,
.icon-button {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.icon-button {
  width: 42px;
  padding: 0;
}

.admin-card {
  padding: 22px;
}

.admin-section {
  display: grid;
  gap: 16px;
}

.admin-section h2,
.admin-section h3 {
  margin: 0;
  line-height: 1.2;
}

.admin-section h2 {
  font-size: 23px;
}

.admin-section h3 {
  font-size: 18px;
}

.section-help {
  margin: -8px 0 0;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.help-grid div,
.status-grid div {
  display: grid;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.72);
  padding: 13px;
}

.help-grid strong,
.status-grid strong {
  color: var(--text);
}

.help-grid span,
.status-grid span {
  color: var(--muted);
  font-size: 13px;
}

.quick-action {
  min-height: 92px;
  justify-content: flex-start;
  border-radius: var(--radius-card);
  padding: 18px;
  text-align: left;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label,
.switch-label {
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 10px 12px;
}

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

input[type="color"] {
  min-height: 46px;
  padding: 4px;
}

.field-help {
  margin: 0;
  font-size: 12px;
}

.switch-row {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
}

.switch-row input {
  width: 18px;
  min-height: 18px;
}

.form-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.project-list,
.link-list {
  display: grid;
  gap: 12px;
}

.data-card {
  display: grid;
  gap: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.74);
  padding: 16px;
}

.data-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.data-card-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.data-card-description {
  margin: 4px 0 0;
  color: var(--muted);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-button);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 760;
}

.pill {
  background: #F1F5F9;
  color: #475569;
}

.status-pill {
  background: var(--success-bg);
  color: var(--success);
}

.status-pill.is-off {
  background: #F3F4F6;
  color: #4B5563;
}

.color-swatch {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 50%;
  background: var(--swatch, var(--theme-color));
}

.message {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  background: #F8FAFC;
  color: var(--text);
}

.message.success {
  border-color: #A7F3D0;
  background: var(--success-bg);
  color: var(--success);
}

.message.error {
  border-color: #FECACA;
  background: var(--danger-bg);
  color: var(--danger);
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px 18px;
}

.login-card {
  width: min(100%, 430px);
  padding: 24px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 25px;
  line-height: 1.2;
}

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

.inline-panel {
  padding: 16px;
  box-shadow: none;
}

.guide-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-list li {
  border-left: 4px solid var(--theme-color);
  padding: 4px 0 4px 12px;
}

.guide-list strong {
  display: block;
  margin-bottom: 2px;
}

.nested-link-card {
  margin-left: 20px;
  border-left: 3px solid color-mix(in srgb, var(--theme-color) 65%, #CBD5E1);
}

.noscript-box {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  border: 1px solid #FECACA;
  border-radius: var(--radius-card);
  background: #FEF2F2;
  color: #991B1B;
  padding: 14px;
  text-align: center;
}

@media (max-width: 720px) {
  .public-page,
  .admin-shell {
    padding-inline: 14px;
  }

  .public-title {
    font-size: 26px;
  }

  .admin-title-block,
  .admin-card {
    padding: 18px;
  }

  .quick-actions,
  .help-grid,
  .status-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .data-card-header {
    display: grid;
  }

  .admin-button,
  .text-button,
  .danger-button,
  .ghost-button {
    width: 100%;
  }

  .admin-nav .admin-button,
  .admin-nav .ghost-button {
    width: auto;
    flex: 1 1 170px;
  }
}

@supports not (color: color-mix(in srgb, white, black)) {
  .avatar,
  .fallback-icon,
  .admin-button {
    background: var(--theme-color);
  }

  .link-row:hover,
  .accordion-trigger:hover,
  .sub-link-row:hover {
    border-color: #94A3B8;
  }
}
