:root {
  color-scheme: dark;
  --page: #080b10;
  --panel: rgba(16, 19, 24, 0.58);
  --panel-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.18);
  --text: #f4f6f0;
  --muted: #c8d6e5;
  --card: rgba(255, 255, 255, 0.72);
  --card-text: #12161d;
  --focus: #8ad4ff;
  --danger: #ff776e;
  --tier-5: #ff7478;
  --tier-4: #ffc47e;
  --tier-3: #ffe384;
  --tier-2: #fbff75;
  --tier-1: #b9ff75;
  --tier-unknown: #d7c7ff;
  --backlog: #8ad4ff;
  --card-width: 260px;
  --card-padding: 12px;
  --card-font-size: 1.08rem;
  --card-line-height: 1.22;
  --card-gap: 10px;
  --dropzone-padding: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(8, 11, 16, 0.56), rgba(8, 11, 16, 0.24)),
    url("assets/unicorn-liquid-glass.png") center / cover fixed,
    var(--page);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 10%, rgba(144, 241, 255, 0.22), transparent 28%),
    radial-gradient(circle at 74% 82%, rgba(255, 123, 221, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
  mix-blend-mode: screen;
}

body.allow-page-scroll {
  height: auto;
  min-height: 100vh;
  overflow: auto;
}

button,
textarea {
  font: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1920px, calc(100vw - 32px));
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 16px 0;
}

body.allow-page-scroll .app-shell {
  height: auto;
  min-height: 100vh;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "topbar topbar"
    "input board";
  gap: 16px;
  height: 100%;
  min-height: 0;
}

body.allow-page-scroll .workspace {
  grid-template-rows: auto auto;
  height: auto;
}

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 20px 60px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(22px) saturate(145%);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1 {
  margin: 0;
  background: linear-gradient(90deg, #ffffff, #bfeeff 38%, #ffd5fb 68%, #fff1b8);
  background-clip: text;
  color: transparent;
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 0.95;
  text-shadow: 0 0 36px rgba(176, 231, 255, 0.28);
}

.topbar-actions,
.input-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 10px 28px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px) saturate(150%);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.button:hover {
  border-color: rgba(210, 246, 255, 0.46);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 0 0 1px rgba(171, 231, 255, 0.12),
    0 14px 36px rgba(0, 0, 0, 0.28),
    0 0 28px rgba(155, 218, 255, 0.16);
  transform: translateY(-1px);
}

.button:active {
  box-shadow:
    inset 0 1px 10px rgba(0, 0, 0, 0.22),
    0 8px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(0);
}

.button:focus-visible,
.epic-card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.button.primary {
  background: linear-gradient(135deg, rgba(48, 177, 154, 0.8), rgba(64, 140, 255, 0.48));
}

.button.primary:hover {
  background: linear-gradient(135deg, rgba(66, 224, 186, 0.9), rgba(118, 176, 255, 0.62));
}

.button.secondary {
  background: var(--panel-strong);
  border-color: var(--line);
}

.button.secondary:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(174, 220, 255, 0.09));
}

.button.danger {
  background: rgba(86, 28, 39, 0.64);
  border-color: rgba(255, 140, 150, 0.3);
  color: #ffd9d6;
}

.button.danger:hover {
  background: rgba(132, 43, 57, 0.76);
  border-color: rgba(255, 174, 181, 0.52);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 14px 36px rgba(0, 0, 0, 0.28),
    0 0 28px rgba(255, 116, 128, 0.18);
}

.input-panel {
  grid-area: input;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 22px 70px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(22px) saturate(150%);
}

.input-panel label {
  color: var(--muted);
  font-weight: 700;
}

textarea {
  min-height: 0;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(4, 7, 11, 0.5);
  color: var(--text);
  line-height: 1.45;
  box-shadow: inset 0 1px 18px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(10px);
}

textarea:focus {
  border-color: var(--focus);
  outline: none;
}

.board-wrap {
  grid-area: board;
  min-width: 0;
  min-height: 0;
}

.board {
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025)),
    rgba(6, 8, 12, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 0 60px rgba(160, 215, 255, 0.04),
    0 26px 80px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(24px) saturate(150%);
}

body.allow-page-scroll .board {
  grid-template-rows: none;
  height: auto;
}

.tier-row {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  min-height: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.allow-page-scroll .tier-row {
  min-height: 132px;
}

.tier-row:last-child {
  border-bottom: 0;
}

.tier-label {
  display: grid;
  place-items: center;
  color: #20231f;
  font-size: 1.35rem;
  font-weight: 700;
  border-right: 1px solid rgba(255, 255, 255, 0.13);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.32);
}

.tier-dropzone {
  display: flex;
  align-content: flex-start;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--card-gap);
  min-height: 0;
  overflow: hidden;
  padding: var(--dropzone-padding);
  background: rgba(7, 10, 14, 0.42);
  transition:
    background 160ms ease,
    box-shadow 160ms ease;
}

body.allow-page-scroll .tier-dropzone {
  min-height: 132px;
  overflow: visible;
}

.tier-dropzone.is-over {
  background: rgba(138, 212, 255, 0.12);
  box-shadow:
    inset 0 0 0 2px rgba(189, 238, 255, 0.62),
    inset 0 0 36px rgba(255, 180, 238, 0.12);
}

.epic-card {
  width: var(--card-width);
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  padding: var(--card-padding);
  background: var(--card);
  color: var(--card-text);
  cursor: grab;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 28px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(10px) saturate(140%);
}

.epic-card:active {
  cursor: grabbing;
}

.epic-card.is-dragging {
  opacity: 0.48;
}

.epic-card p {
  overflow-wrap: anywhere;
  margin: 0;
  line-height: var(--card-line-height);
  font-size: var(--card-font-size);
  font-weight: 700;
}

.empty-hint {
  color: rgba(232, 244, 255, 0.48);
  padding: 8px;
}

@media (max-width: 880px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .app-shell {
    width: min(100vw - 20px, 760px);
    height: auto;
    min-height: 100vh;
    padding: 14px 0;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "topbar"
      "input"
      "board";
  }

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

  textarea {
    min-height: 180px;
  }

  .board {
    height: auto;
  }

  .tier-row {
    grid-template-columns: 72px minmax(0, 1fr);
    min-height: 118px;
  }

  .tier-dropzone {
    min-height: 118px;
  }

  .epic-card {
    width: min(160px, 100%);
  }

  .tier-label {
    font-size: 1.1rem;
  }
}
