:root {
  color-scheme: light;
  --ink: #182019;
  --ink-soft: #5f685f;
  --paper: #f2efe7;
  --paper-deep: #e5dfd3;
  --card: #fbfaf6;
  --acid: #c7f36a;
  --forest: #1f3a2b;
  --line: rgba(24, 32, 25, 0.1);
  --curve: cubic-bezier(0.32, 0.72, 0, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 78% 6%, rgba(199, 243, 106, 0.3), transparent 27rem),
    var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", "Futura", "Century Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(1180px, calc(100% - 64px));
  margin: 28px auto 0;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.04em;
}

.brand-light { color: var(--ink-soft); font-weight: 450; }

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
}

.brand-mark span { position: absolute; width: 12px; height: 2px; border-radius: 2px; background: var(--acid); }
.brand-mark span:first-child { transform: translateY(-3px) rotate(-10deg); }
.brand-mark span:last-child { transform: translateY(3px) rotate(10deg); }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.account-nav { display: flex; align-items: center; gap: 18px; color: var(--ink-soft); font-size: 12px; }
.account-nav form { margin: 0; }
.nav-link { color: inherit; font-weight: 650; text-decoration: none; transition: color 400ms var(--curve), transform 400ms var(--curve); }
.nav-link:hover { color: var(--ink); transform: translateY(-1px); }
.nav-button { display: inline-flex; align-items: center; min-height: 38px; padding: 0 17px; border-radius: 999px; background: var(--ink); color: white; font-size: 11px; font-weight: 700; text-decoration: none; transition: transform 450ms var(--curve), background-color 450ms var(--curve); }
.nav-button:hover { background: var(--forest); transform: translateY(-2px); }
.nav-button-reset { border: 0; cursor: pointer; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ab46c; box-shadow: 0 0 0 5px rgba(74,180,108,.1); }

main { overflow: hidden; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(520px, 1.14fr);
  gap: clamp(48px, 8vw, 120px);
  align-items: center;
  width: min(1180px, calc(100% - 64px));
  min-height: 680px;
  margin: 0 auto;
  padding: 108px 0 124px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(24,32,25,.06);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 560px;
  margin: 24px 0 30px;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(62px, 7vw, 102px);
  font-weight: 400;
  line-height: .87;
  letter-spacing: -.065em;
}

.hero h1 em { color: #758571; font-weight: 400; }

.hero-copy > p {
  max-width: 440px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.75;
}

.guest-note { display: inline-flex; align-items: center; gap: 9px; margin-top: 28px; color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.guest-note span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--acid); color: var(--ink); }

.creator-shell, .library-shell, .metric-shell {
  padding: 7px;
  border: 1px solid rgba(24,32,25,.06);
  border-radius: 31px;
  background: rgba(24,32,25,.04);
}

.creator-shell { transform: rotate(1.2deg); box-shadow: 0 40px 100px rgba(55,55,40,.12); }

.creator {
  padding: 38px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
  transform: rotate(-1.2deg);
}

.form-heading, .form-footer, .section-heading, .top-link-card, .short-link-cell, .row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.step { color: #80907b; font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.form-heading h2 { margin: 6px 0 0; font-size: 25px; letter-spacing: -.04em; }
.spark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--acid); font-size: 20px; }

.field { display: grid; gap: 9px; margin-top: 28px; }
.field > span { font-size: 10px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.field small { color: #929a92; font-size: 9px; font-weight: 500; text-transform: lowercase; letter-spacing: 0; }

.field input, .search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.field > input, .alias-input {
  min-height: 58px;
  padding: 0 18px;
  border-radius: 17px;
  background: #f0eee7;
  box-shadow: inset 0 0 0 1px rgba(24,32,25,.055), inset 0 1px 2px rgba(24,32,25,.025);
  transition: box-shadow 450ms var(--curve), transform 450ms var(--curve);
}

.field > input:focus, .alias-input:focus-within { box-shadow: inset 0 0 0 2px rgba(31,58,43,.45), 0 0 0 5px rgba(199,243,106,.28); transform: translateY(-1px); }
.field input::placeholder { color: #a0a59f; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.alias-input { display: flex; align-items: center; gap: 3px; }
.alias-input > span { color: #758071; }
.form-footer { gap: 24px; margin-top: 30px; }
.form-footer p { margin: 0; color: #848d84; font-size: 11px; line-height: 1.45; }
.form-footer p.error { color: #b44444; }

.primary-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 6px 7px 6px 21px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  transition: transform 500ms var(--curve), background-color 500ms var(--curve);
}

.primary-button:hover { background: var(--forest); transform: translateY(-2px); }
.primary-button:active { transform: scale(.98); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.button-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--acid); color: var(--ink); transition: transform 500ms var(--curve); }
.primary-button:hover .button-icon { transform: translate(3px,-1px) scale(1.04); }

.workspace {
  position: relative;
  padding: 110px max(32px, calc((100vw - 1180px) / 2)) 140px;
  background: #172019;
  color: #f4f1e9;
}

.workspace::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 12% 0%, rgba(199,243,106,.1), transparent 30rem);
}

.workspace > * { position: relative; }
.section-heading { margin-bottom: 42px; }
.section-heading .eyebrow { color: #cad1c9; background: rgba(255,255,255,.07); }
.section-heading h2 { margin: 16px 0 0; font-family: "Iowan Old Style", Georgia, serif; font-size: clamp(36px, 5vw, 58px); font-weight: 400; letter-spacing: -.045em; }

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 230px;
  padding: 12px 15px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: #aeb7ae;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.search-field input { color: white; }
.search-field input::placeholder { color: #8e998e; }

.light-button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px; background: var(--acid); color: var(--ink); font-size: 11px; font-weight: 750; text-decoration: none; transition: transform 450ms var(--curve); }
.light-button:hover { transform: translateY(-2px); }

.stats-grid { display: grid; grid-template-columns: .72fr .72fr 1.56fr; gap: 13px; margin-bottom: 24px; }
.metric-shell { border-color: rgba(255,255,255,.05); background: rgba(255,255,255,.035); border-radius: 24px; }
.metric-card { min-height: 178px; padding: 26px; border-radius: 17px; background: #202a22; box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.metric-card > span, .top-link-card > div > span { display: block; color: #94a095; font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.metric-card > strong { display: block; margin: 18px 0 13px; font-family: "Iowan Old Style", Georgia, serif; font-size: 52px; font-weight: 400; letter-spacing: -.06em; }
.metric-card > small { color: #7c887e; font-size: 11px; }
.metric-primary .metric-card { background: var(--acid); color: var(--ink); }
.metric-primary .metric-card > span, .metric-primary .metric-card > small { color: rgba(24,32,25,.62); }
.top-link-card { overflow: hidden; }
.top-link-card > div > strong { display: block; max-width: 260px; margin-top: 24px; overflow: hidden; font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.mini-orbit { position: relative; width: 106px; height: 106px; border: 1px solid rgba(199,243,106,.22); border-radius: 50%; }
.mini-orbit::before, .mini-orbit::after { content: ""; position: absolute; inset: 18px; border: 1px solid rgba(199,243,106,.14); border-radius: 50%; }
.mini-orbit::after { inset: 37px; background: var(--acid); border: 0; }
.mini-orbit i { position: absolute; top: 5px; left: 48px; width: 9px; height: 9px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 18px var(--acid); }

.library-shell { border-color: rgba(255,255,255,.05); background: rgba(255,255,255,.035); }
.library-card { min-height: 240px; overflow: hidden; border-radius: 24px; background: #f4f1e9; color: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.7); }
.table-heading, .link-row { display: grid; grid-template-columns: minmax(220px,1.15fr) minmax(220px,1fr) 80px 110px 90px; align-items: center; gap: 20px; padding: 18px 24px; }
.table-heading { color: #8d958d; font-size: 9px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.link-row { border-top: 1px solid rgba(24,32,25,.075); transition: background-color 400ms var(--curve), transform 400ms var(--curve); }
.link-row:hover { background: #fbfaf6; transform: translateX(3px); }
.link-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--ink); }
.link-avatar::after { content: "↗"; color: var(--acid); font-size: 13px; }
.short-link-cell { justify-content: flex-start; gap: 12px; min-width: 0; }
.short-link-cell > div { min-width: 0; }
.short-url { display: block; max-width: 100%; padding: 0; overflow: hidden; border: 0; background: none; cursor: pointer; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.link-title { display: block; max-width: 100%; margin-top: 4px; overflow: hidden; color: #909790; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.destination { overflow: hidden; color: #677067; font-size: 11px; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.destination:hover { color: var(--ink); }
.click-count { font-family: "Iowan Old Style", Georgia, serif; font-size: 18px; font-weight: 500; }
.created-at { color: #737d74; font-size: 10px; }
.row-actions { justify-content: flex-end; gap: 6px; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(24,32,25,.06); cursor: pointer; transition: transform 400ms var(--curve), background-color 400ms var(--curve); }
.icon-button:hover { background: var(--acid); transform: translateY(-2px); }
.delete-button:hover { background: #ffd2c8; }

.empty-state { display: grid; place-items: center; padding: 55px 24px 66px; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-glyph { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; background: var(--paper-deep); font-size: 20px; }
.empty-state h3 { margin: 20px 0 7px; font-family: "Iowan Old Style", Georgia, serif; font-size: 24px; font-weight: 500; }
.empty-state p { margin: 0; color: #7d867d; font-size: 12px; }

.toast {
  position: fixed;
  z-index: 3;
  right: 24px;
  bottom: 24px;
  padding: 13px 18px;
  border-radius: 999px;
  background: var(--acid);
  color: var(--ink);
  box-shadow: 0 15px 45px rgba(0,0,0,.18);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 500ms var(--curve), transform 500ms var(--curve);
}
.toast.visible { opacity: 1; transform: translateY(0); }

.flash { position: fixed; z-index: 5; top: 24px; left: 50%; padding: 12px 18px; border-radius: 999px; background: var(--acid); color: var(--ink); box-shadow: 0 15px 45px rgba(0,0,0,.14); font-size: 12px; font-weight: 700; transform: translateX(-50%); }
.flash-error { background: #ffd2c8; }

body.modal-open { overflow: hidden; }
.modal-backdrop[hidden] { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; background: rgba(13,19,14,.74); backdrop-filter: blur(18px); }
.save-modal { position: relative; width: min(500px, 100%); padding: 48px; border-radius: 30px; background: var(--card); color: var(--ink); box-shadow: 0 45px 120px rgba(0,0,0,.28), inset 0 1px 0 white; animation: modal-in 650ms var(--curve) both; text-align: center; }
.save-modal::before { content: ""; position: absolute; inset: -7px; z-index: -1; border: 1px solid rgba(255,255,255,.18); border-radius: 37px; background: rgba(255,255,255,.09); }
.modal-close { position: absolute; top: 18px; right: 18px; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(24,32,25,.06); cursor: pointer; font-size: 20px; transition: transform 400ms var(--curve), background-color 400ms var(--curve); }
.modal-close:hover { background: var(--paper-deep); transform: rotate(8deg); }
.modal-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 25px; border-radius: 21px; background: var(--acid); font-size: 25px; }
.save-modal h2 { margin: 18px 0 14px; font-family: "Iowan Old Style", Georgia, serif; font-size: 38px; font-weight: 400; letter-spacing: -.045em; }
.save-modal > p { max-width: 390px; margin: 0 auto; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.modal-actions { display: grid; gap: 10px; margin-top: 30px; }
.modal-primary { justify-content: space-between; text-decoration: none; }
.secondary-button { display: grid; place-items: center; min-height: 50px; border-radius: 999px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 700; text-decoration: none; transition: transform 450ms var(--curve), background-color 450ms var(--curve); }
.secondary-button:hover { background: var(--paper-deep); transform: translateY(-1px); }
.continue-guest { margin-top: 20px; border: 0; background: none; color: #7e887f; cursor: pointer; font-size: 11px; text-decoration: underline; text-underline-offset: 4px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(30px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.dashboard-page { min-height: calc(100dvh - 90px); padding: 80px max(32px, calc((100vw - 1180px) / 2)) 120px; }
.dashboard-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; padding-bottom: 65px; }
.dashboard-hero h1 { margin: 18px 0 12px; font-family: "Iowan Old Style", Georgia, serif; font-size: clamp(50px, 7vw, 82px); font-weight: 400; letter-spacing: -.06em; line-height: .95; }
.dashboard-hero p { max-width: 520px; margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.dashboard-workspace { padding: 36px; border-radius: 36px; background: #172019; color: white; box-shadow: 0 35px 90px rgba(55,55,40,.12); }
.dashboard-tools { display: flex; justify-content: space-between; align-items: center; margin: 45px 0 20px; }
.dashboard-tools h2 { margin: 0; font-family: "Iowan Old Style", Georgia, serif; font-size: 35px; font-weight: 400; }
.dashboard-library { border-color: rgba(255,255,255,.05); background: rgba(255,255,255,.035); }
.light-search { background: rgba(255,255,255,.08); }
.link-row[hidden] { display: none; }
.row-actions form { margin: 0; }

.auth-page { display: grid; place-items: center; min-height: calc(100dvh - 90px); padding: 70px 24px 110px; }
.auth-shell { width: min(520px, 100%); padding: 7px; border: 1px solid rgba(24,32,25,.06); border-radius: 34px; background: rgba(24,32,25,.04); box-shadow: 0 40px 100px rgba(55,55,40,.12); }
.auth-card { padding: 48px; border-radius: 27px; background: var(--card); box-shadow: inset 0 1px 0 white; }
.auth-card h1 { margin: 20px 0 12px; font-family: "Iowan Old Style", Georgia, serif; font-size: 46px; font-weight: 400; line-height: 1; letter-spacing: -.055em; }
.auth-intro { margin: 0 0 32px; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.auth-form .field { margin-top: 18px; }
.auth-submit { justify-content: space-between; width: 100%; margin-top: 28px; }
.remember-field { display: flex; align-items: center; gap: 8px; margin-top: 17px; color: var(--ink-soft); font-size: 11px; }
.remember-field input { accent-color: var(--forest); }
.auth-links { display: grid; gap: 9px; margin-top: 24px; text-align: center; }
.auth-links a { color: var(--ink-soft); font-size: 11px; text-decoration: none; }
.auth-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
#error_explanation { margin: 22px 0; padding: 18px; border-radius: 16px; background: #fff0eb; color: #8e3f34; font-size: 11px; }
#error_explanation h2 { margin: 0 0 8px; font: inherit; font-weight: 750; }
#error_explanation ul { margin: 0; padding-left: 18px; }

.reveal { opacity: 0; transform: translateY(32px); transition: opacity 900ms var(--curve), transform 900ms var(--curve); }
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 90px; }
  .hero-copy { max-width: 640px; }
  .creator-shell { transform: none; }
  .creator { transform: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .metric-wide { grid-column: 1 / -1; }
  .table-heading { display: none; }
  .link-row { grid-template-columns: 1fr auto; gap: 14px; padding: 22px; }
  .destination { grid-column: 1; }
  .click-count { position: relative; grid-column: 2; grid-row: 1; }
  .click-count::after { content: " clicks"; color: #8a928a; font-family: "Avenir Next", sans-serif; font-size: 9px; font-weight: 500; }
  .created-at { grid-column: 1; }
  .row-actions { grid-column: 2; grid-row: 2 / span 2; }
  .dashboard-workspace { padding: 25px; }
}

@media (max-width: 620px) {
  .topbar, .hero { width: calc(100% - 32px); }
  .topbar { margin-top: 20px; }
  .topbar-meta { display: none; }
  .account-nav > span { display: none; }
  .account-nav { gap: 10px; }
  .account-nav .nav-link { display: none; }
  .nav-button { min-height: 36px; padding: 0 13px; }
  .hero { gap: 50px; padding: 76px 0 88px; }
  .hero h1 { font-size: clamp(55px, 18vw, 76px); }
  .hero-copy > p { font-size: 14px; }
  .creator { padding: 26px 20px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-footer { align-items: flex-start; flex-direction: column; }
  .primary-button { justify-content: space-between; width: 100%; }
  .workspace { padding: 84px 16px 100px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 24px; }
  .search-field { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 145px; padding: 21px; }
  .metric-card > strong { font-size: 42px; }
  .top-link-card { min-height: 150px; }
  .mini-orbit { width: 80px; height: 80px; }
  .mini-orbit::after { inset: 28px; }
  .mini-orbit i { left: 35px; }
  .link-row { grid-template-columns: minmax(0,1fr) auto; }
  .destination { max-width: 220px; }
  .save-modal { padding: 42px 22px 30px; }
  .save-modal h2 { font-size: 32px; }
  .dashboard-page { padding: 60px 16px 90px; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; padding-bottom: 45px; }
  .dashboard-hero .primary-button { width: auto; }
  .dashboard-workspace { padding: 16px; border-radius: 26px; }
  .dashboard-tools { align-items: flex-start; flex-direction: column; gap: 18px; }
  .dashboard-tools .search-field { width: 100%; }
  .auth-card { padding: 38px 22px; }
  .auth-card h1 { font-size: 39px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
