:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #1f2428;
  --muted: #707a75;
  --line: #dfe6e2;
  --green: #03c75a;
  --green-strong: #00a84f;
  --green-dark: #008f47;
  --warning: #d74725;
  --shadow: 0 10px 30px rgba(26, 45, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.topbar {
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(20px, calc((100vw - 1120px) / 2));
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  color: var(--green);
  font-size: 1.65rem;
  font-weight: 950;
  letter-spacing: 0;
  text-decoration: none;
}

.status-pill {
  border: 1px solid #cdeee0;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--green-dark);
  background: #effbf5;
  font-size: 0.86rem;
  font-weight: 800;
}

.app {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
  display: flex;
  justify-content: center;
}

.workspace,
.links-panel,
.result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.workspace {
  width: 100%;
  padding: 28px;
}

.masthead {
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.1rem, 4.8vw, 3.85rem);
  line-height: 1;
}

h2 {
  font-size: 1.22rem;
}

.shortener {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(126px, 152px) 118px;
  gap: 10px;
  align-items: end;
}

.url-field {
  grid-column: 1 / -1;
}

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

.field span,
.label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  font: inherit;
  background: #fff;
  outline: none;
}

.url-field input {
  height: 58px;
  border: 2px solid var(--green);
  border-radius: 8px;
  font-size: 1.04rem;
  box-shadow: 0 8px 18px rgba(3, 199, 90, 0.1);
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(3, 199, 90, 0.16);
}

button {
  height: 50px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button {
  height: 50px;
  color: #fff;
  background: var(--green);
}

.primary-button:hover {
  background: var(--green-strong);
}

.secondary-button,
.icon-button {
  color: var(--ink);
  background: #edf3f0;
}

.secondary-button:hover,
.icon-button:hover {
  background: #e2ece7;
}

.message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--warning);
  font-weight: 800;
}

.result {
  margin-top: 18px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 172px;
  gap: 18px;
  align-items: stretch;
  background: #f8fffb;
  border-color: #bfead4;
}

.result-copy {
  min-height: 226px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  min-width: 0;
}

.result-copy > div {
  min-height: 172px;
  border: 1px solid #d8e8df;
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  display: grid;
  align-content: center;
}

.result-copy .icon-button,
.qr-copy-button {
  width: 100%;
  height: 42px;
}

.result a {
  display: block;
  margin-top: 5px;
  color: var(--green-dark);
  font-size: 1.05rem;
  font-weight: 900;
  word-break: break-all;
}

.qr-result {
  display: grid;
  gap: 12px;
  justify-items: center;
  align-content: start;
}

.qr-result img {
  width: 172px;
  height: 172px;
  border: 1px solid #d8e8df;
  border-radius: 8px;
  background: #fff;
}

.qr-copy-button {
  min-width: 0;
}

.links-panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.link-list {
  display: grid;
  gap: 10px;
}

.link-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

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

.short-link {
  color: var(--green-dark);
  font-weight: 950;
  text-decoration: none;
  word-break: break-all;
}

.short-link:hover,
.long-link:hover {
  text-decoration: underline;
}

.long-link {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.meta span {
  border: 1px solid #dbe7e1;
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff;
}

.empty {
  padding: 28px 0;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .app {
    padding-top: 24px;
  }
}

@media (max-width: 620px) {
  .topbar {
    height: 58px;
    padding: 0 16px;
  }

  .brand {
    font-size: 1.38rem;
  }

  .status-pill {
    display: none;
  }

  .app {
    width: min(100% - 24px, 760px);
    padding-bottom: 32px;
  }

  .workspace,
  .links-panel {
    padding: 18px;
  }

  .shortener {
    grid-template-columns: 1fr 112px;
  }

  .alias-field {
    grid-column: 1 / -1;
  }

  .lifetime-field {
    grid-column: 1;
  }

  .primary-button {
    grid-column: 2;
  }

  .result {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .result-copy {
    min-height: 0;
    align-items: stretch;
  }

  .result-copy > div {
    min-height: 0;
    align-content: start;
  }

  .qr-result {
    justify-items: stretch;
  }

  .qr-result img {
    justify-self: center;
  }
}
