:root {
  color-scheme: light;
  --bg: #f4f1ec;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #141816;
  --muted: #68716c;
  --line: #ded8ce;
  --accent: #0f766e;
  --accent-dark: #0b5f58;
  --accent-soft: #dff3ef;
  --danger: #a13d2d;
  --danger-soft: #f8e7e1;
  --shadow: 0 28px 80px rgba(43, 39, 32, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.12), transparent 300px),
    var(--bg);
  font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(22px, 5vw, 56px);
}

.workspace {
  display: grid;
  width: min(980px, 100%);
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.25fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro {
  display: flex;
  min-height: 560px;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 5vw, 48px);
  background:
    linear-gradient(145deg, rgba(20, 24, 22, 0.92), rgba(15, 118, 110, 0.84)),
    #121816;
  color: #fffdf8;
}

.intro::after {
  width: 86px;
  height: 6px;
  border-radius: 999px;
  background: #f0b35a;
  content: "";
}

.eyebrow {
  margin: 0 0 18px;
  color: #a9ded7;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 420px;
  margin-bottom: 18px;
  font-size: clamp(2.45rem, 6vw, 4.85rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.summary {
  max-width: 360px;
  margin-bottom: 0;
  color: rgba(255, 253, 248, 0.76);
  font-size: 1.03rem;
  line-height: 1.65;
}

.tool-panel {
  display: grid;
  align-content: start;
  gap: 24px;
  padding: clamp(24px, 5vw, 46px);
}

.shortener {
  display: grid;
  gap: 12px;
  align-self: start;
}

label,
.panel-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.input-row,
.input-grid {
  display: grid;
  gap: 12px;
}

.input-row {
  grid-template-columns: 1fr auto;
}

.input-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}


input {
  width: 100%;
  min-width: 0;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 15px;
  color: var(--ink);
  background: var(--surface-strong);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input::placeholder {
  color: #a1a8a4;
}

input:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
}

button {
  min-height: 50px;
  border-radius: 8px;
  padding: 0 18px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 850;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.22);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.message {
  min-height: 24px;
  margin: 0;
  color: var(--danger);
  font-size: 0.94rem;
  line-height: 1.5;
}

.result-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: var(--accent-soft);
}

.result-panel[hidden] {
  display: none;
}

.result-panel a {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: var(--accent-dark);
  font-size: 1.05rem;
  font-weight: 850;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.secondary-button {
  background: #1d2622;
}

.secondary-button:hover {
  background: #101614;
  box-shadow: 0 12px 28px rgba(29, 38, 34, 0.18);
}


.history {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

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

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.text-button {
  min-height: 36px;
  padding: 0 10px;
  color: var(--accent-dark);
  background: transparent;
}

.text-button:hover {
  background: rgba(15, 118, 110, 0.08);
  box-shadow: none;
}

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

.link-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.link-card a {
  overflow-wrap: anywhere;
  color: var(--accent-dark);
  font-weight: 850;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.original-url {
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-button {
  min-width: 48px;
  width: 48px;
  padding: 0;
  color: var(--danger);
  background: var(--danger-soft);
}

.delete-button:hover {
  background: #f1d1c7;
  box-shadow: none;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 820px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .intro {
    min-height: auto;
    gap: 40px;
  }
}

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

  .tool-panel {
    padding: 22px;
  }

  .input-row,
  .input-grid,
  .result-panel,
  .link-card {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .text-button,
  .delete-button {
    width: auto;
  }
}
