:root {
  color-scheme: dark;
  --green: #0f8a5f;
  --green-hot: #13c779;
  --ink: #f4f7f5;
  --muted: rgba(244, 247, 245, 0.62);
  --panel: rgba(18, 20, 19, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --deep: #030504;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 4%, rgba(15, 138, 95, 0.22), transparent 28rem),
    linear-gradient(135deg, #020302 0%, #101312 46%, #030504 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.035), transparent),
    radial-gradient(circle at 18% 50%, rgba(255, 255, 255, 0.05), transparent 24rem);
  opacity: 0.8;
}

.shell {
  position: relative;
  min-height: 100vh;
  padding: clamp(18px, 4vw, 56px);
  display: grid;
  place-items: center;
}

.hub {
  width: min(100%, 660px);
  min-height: min(920px, calc(100vh - 36px));
  padding: clamp(26px, 5vw, 52px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: clamp(28px, 5vw, 48px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), transparent 24%),
    linear-gradient(180deg, rgba(15, 18, 17, 0.96), rgba(4, 5, 5, 0.96));
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.64),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
}

.wordmark {
  color: var(--ink);
  font-size: clamp(1.25rem, 3vw, 1.58rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-shadow:
    0 0 18px rgba(15, 138, 95, 0.48),
    0 12px 28px rgba(0, 0, 0, 0.42);
}

.wordmark::after {
  content: "";
  display: block;
  width: 64%;
  height: 3px;
  margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green-hot), transparent);
  box-shadow: 0 0 16px rgba(15, 138, 95, 0.62);
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--green-hot);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.settings-trigger img {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 0 14px rgba(15, 138, 95, 0.46));
}

.brand-mark {
  width: min(45vw, 250px);
  margin: clamp(42px, 9vh, 96px) auto clamp(42px, 7vh, 72px);
  filter: drop-shadow(0 22px 28px rgba(15, 138, 95, 0.22));
}

.brand-mark img {
  display: block;
  width: 100%;
}

.cards {
  display: grid;
  gap: 14px;
}

.link-card {
  min-height: 94px;
  padding: 14px 20px 14px 14px;
  display: grid;
  grid-template-columns: 68px 1fr 20px;
  align-items: center;
  gap: 18px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025) 38%, rgba(255, 255, 255, 0.015)),
    rgba(14, 16, 15, 0.84);
  box-shadow:
    0 20px 42px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.link-card:hover {
  transform: translateY(-2px);
  border-color: rgba(19, 199, 121, 0.4);
  box-shadow:
    0 24px 52px rgba(0, 0, 0, 0.42),
    0 0 32px rgba(15, 138, 95, 0.16);
}

.icon-tile {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    #181b19;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 12px 26px rgba(0, 0, 0, 0.26);
}

.icon-tile img {
  width: 48px;
  height: 48px;
}

.card-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.card-copy strong {
  font-size: clamp(1.08rem, 2.5vw, 1.32rem);
  line-height: 1.1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.card-copy small {
  color: var(--green-hot);
  font-size: clamp(0.88rem, 2vw, 1.02rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.chevron {
  width: 16px;
  height: 16px;
  border-top: 3px solid var(--green-hot);
  border-right: 3px solid var(--green-hot);
  transform: rotate(45deg);
  filter: drop-shadow(0 0 8px rgba(15, 138, 95, 0.45));
}

.password-gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 22%, rgba(15, 138, 95, 0.24), transparent 24rem),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(18px);
}

.password-gate.is-hidden {
  display: none;
}

.gate-panel {
  width: min(100%, 390px);
  padding: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: linear-gradient(160deg, rgba(27, 31, 29, 0.94), rgba(5, 6, 6, 0.94));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.gate-logo {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  display: block;
  box-shadow: 0 18px 38px rgba(15, 138, 95, 0.36);
}

.gate-kicker,
.panel-kicker {
  margin: 18px 0 6px;
  color: var(--green-hot);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
}

.gate-panel h1,
.panel-head h2 {
  margin: 0;
  font-size: 1.75rem;
}

form,
.panel-section {
  margin-top: 22px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
  outline: none;
}

.field input:focus {
  border-color: rgba(19, 199, 121, 0.68);
  box-shadow: 0 0 0 3px rgba(15, 138, 95, 0.2);
}

.primary-button,
.ghost-button,
.danger-button {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  font-weight: 850;
}

.primary-button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, #18c47b, var(--green));
  box-shadow: 0 16px 36px rgba(15, 138, 95, 0.32);
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.danger-button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, #ff5a42, #b92317);
  box-shadow: 0 16px 34px rgba(185, 35, 23, 0.28);
}

.form-error {
  min-height: 18px;
  margin: 10px 0 12px;
  color: #ffb2a4;
  font-size: 0.9rem;
}

.settings-panel {
  position: fixed;
  z-index: 9;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100vw - 36px));
  padding: 22px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(26, 31, 29, 0.96), rgba(4, 6, 5, 0.96));
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.5);
  transform: translateX(calc(100% + 40px));
  transition: transform 220ms ease;
}

.settings-panel.is-open {
  transform: translateX(0);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.panel-head .panel-kicker {
  margin-top: 0;
}

.close-settings {
  font-size: 2rem;
  line-height: 1;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(3px);
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(14px);
}

.confirm-modal.is-open {
  display: grid;
}

.confirm-box {
  width: min(100%, 360px);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(28, 34, 31, 0.97), rgba(4, 6, 5, 0.97));
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.62),
    0 0 38px rgba(15, 138, 95, 0.12);
}

.confirm-box .panel-kicker {
  margin-top: 0;
}

.confirm-box h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.confirm-box p:not(.panel-kicker) {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.editor-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.editor-card {
  display: grid;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.editor-card-head {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.editor-card-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drag-handle {
  color: var(--green-hot);
  font-size: 1.45rem;
  line-height: 1;
}

.move-controls {
  display: flex;
  gap: 6px;
}

.move-controls button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--green-hot);
  background: rgba(255, 255, 255, 0.055);
}

.move-controls [data-action="expand"] {
  font-size: 1.15rem;
  transition: transform 160ms ease, background 160ms ease;
}

.editor-card.is-expanded .move-controls [data-action="expand"] {
  transform: rotate(180deg);
  background: rgba(15, 138, 95, 0.18);
}

.editor-details {
  display: none;
  gap: 12px;
  margin-top: 14px;
}

.editor-card.is-expanded .editor-details {
  display: grid;
}

.field input[type="file"] {
  min-height: 54px;
  padding: 9px 10px;
  line-height: 34px;
  color: var(--muted);
}

.field input[type="file"]::file-selector-button {
  min-height: 34px;
  margin: 0 12px 0 0;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 850;
  background: linear-gradient(135deg, #18c47b, var(--green));
  box-shadow: 0 8px 18px rgba(15, 138, 95, 0.24);
}

.icon-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.icon-preview span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.icon-preview img {
  max-width: 30px;
  max-height: 30px;
}

.icon-preview small {
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 640px) {
  .shell {
    padding: 0;
  }

  .hub {
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    padding: max(22px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
  }

  .wordmark {
    font-size: 1.2rem;
  }

  .icon-button {
    width: 46px;
    height: 46px;
  }

  .brand-mark {
    width: 174px;
    margin: 44px auto 48px;
  }

  .cards {
    gap: 13px;
  }

  .link-card {
    min-height: 88px;
    grid-template-columns: 58px 1fr 16px;
    gap: 14px;
    padding: 13px;
  }

  .icon-tile {
    width: 54px;
    height: 54px;
  }

  .icon-tile img {
    width: 40px;
    height: 40px;
  }
}

@media (min-width: 980px) {
  .hub {
    width: min(100%, 680px);
  }
}
