:root {
  --ink: #17181c;
  --muted: #5d616c;
  --paper: #f3efe8;
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --line: rgba(255, 255, 255, 0.82);
  --shadow: 0 24px 60px rgba(48, 42, 32, 0.08);
  --radius: 28px;
  --font: "Instrument Sans", "Segoe UI", sans-serif;
  --max: 760px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

body.sheet-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 16px;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(255, 255, 255, 0.9), transparent 55%),
    var(--paper);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.85;
  animation: drift 22s ease-in-out infinite;
}

.blob-a {
  width: 46vw;
  height: 46vw;
  max-width: 620px;
  max-height: 620px;
  left: -8vw;
  top: -10vh;
  background: #ffd0b8;
}

.blob-b {
  width: 40vw;
  height: 40vw;
  max-width: 540px;
  max-height: 540px;
  right: -6vw;
  top: 8vh;
  background: #c9dcff;
  animation-delay: -6s;
}

.blob-c {
  width: 36vw;
  height: 36vw;
  max-width: 480px;
  max-height: 480px;
  left: 28vw;
  bottom: -18vh;
  background: #e4d4ff;
  animation-delay: -12s;
}

.blob-d {
  width: 28vw;
  height: 28vw;
  max-width: 360px;
  max-height: 360px;
  right: 12vw;
  bottom: 6vh;
  background: #d7f3e4;
  animation-delay: -3s;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(2%, -3%, 0) scale(1.06);
  }
}

.topbar,
main,
.sheet-wrap {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(var(--max), calc(100% - 32px));
  margin: 20px auto 0;
  padding: 10px 12px 10px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.42));
  border: 1px solid var(--line);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 10px 40px rgba(48, 42, 32, 0.06);
  backdrop-filter: blur(22px) saturate(1.6);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  position: sticky;
  top: max(12px, env(safe-area-inset-top));
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.logo {
  display: block;
  width: 52px;
  height: 52px;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 16px;
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-name {
  font-size: 1.05rem;
}

main {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 96px;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.lede,
.hint,
.meta,
.empty p {
  color: var(--muted);
}

.lede {
  max-width: 34rem;
  margin: 14px 0 0;
}

.stack {
  display: grid;
  gap: 12px;
}

.panel,
.dock,
.sheet,
.login-card,
.empty,
.banner {
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.4));
  border: 1px solid var(--line);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    var(--shadow);
  backdrop-filter: blur(26px) saturate(1.7);
  -webkit-backdrop-filter: blur(26px) saturate(1.7);
}

.login-card,
.empty {
  padding: 28px;
}

.login-card .stack,
.sheet .stack {
  margin-top: 18px;
}

.login-card {
  max-width: 440px;
}

.project {
  display: block;
  width: 100%;
  padding: 22px;
  text-align: left;
  color: inherit;
  border: 0;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.project h2,
.session h3 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.project-top,
.session-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.session-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.tools {
  margin: 8px 0 22px;
}

.rate-field {
  max-width: 220px;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.file-input {
  display: none;
}

.meta {
  margin: 6px 0 0;
  font-size: 0.95rem;
}

.pill {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: #d7f3e4;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  text-decoration: none;
}

.banner strong {
  display: block;
  letter-spacing: -0.03em;
}

.clock {
  margin: 0;
  font-size: clamp(2.2rem, 10vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.dock {
  display: grid;
  gap: 14px;
  margin: 8px 0 28px;
  padding: 22px;
}

.session {
  padding: 18px 20px;
}

.session p {
  margin: 10px 0 0;
  white-space: pre-wrap;
}

.back {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.repo-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 10px;
}

.repo-line a {
  font-weight: 600;
  text-underline-offset: 3px;
}

.btn,
.text-btn,
.choice {
  border-radius: 16px;
  border: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 14px 18px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--ink);
  color: #f6f3ee;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.sheet > .text-btn {
  display: inline-flex;
  margin-top: 14px;
  text-decoration: none;
}

.text-btn {
  min-height: 44px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.alert {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #ffd0b8;
  color: var(--ink);
  font-weight: 600;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(23, 24, 28, 0.08);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.45;
}

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(48, 42, 32, 0.28);
}

.sheet {
  width: min(520px, 100%);
  max-height: min(92dvh, 100%);
  overflow: auto;
  padding: 22px;
}

.sheet h2 {
  margin: 0 0 6px;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}

.choices {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 240px;
  overflow: auto;
}

.choice {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  border: 1px solid transparent;
}

.choice.is-selected {
  border-color: var(--ink);
}

.choice small {
  display: block;
  color: var(--muted);
  font-weight: 500;
}

.noscript {
  position: relative;
  z-index: 1;
  width: min(var(--max), calc(100% - 40px));
  margin: 24px auto;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #1c1e22;
  outline-offset: 3px;
}

@media (hover: hover) {
  .project,
  .banner,
  .btn-primary,
  .btn-ghost {
    transition: transform 0.35s ease, box-shadow 0.35s ease;
  }

  .project:hover,
  .banner:hover {
    transform: translateY(-3px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.95),
      0 22px 50px rgba(48, 42, 32, 0.12);
  }
}

@media (max-width: 800px) {
  .topbar {
    width: calc(100% - 20px);
    margin-top: max(8px, env(safe-area-inset-top));
    padding: 8px 8px 8px 10px;
    border-radius: 28px;
  }

  .logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  main {
    width: calc(100% - 28px);
    padding-top: 28px;
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
  }

  body.has-dock main {
    padding-bottom: calc(168px + env(safe-area-inset-bottom));
  }

  .stack > .btn-primary,
  .actions {
    width: 100%;
  }

  .actions {
    display: grid;
  }

  .login-card,
  .empty,
  .project,
  .session,
  .dock {
    padding: 18px;
  }

  .dock {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 6;
    margin: 0;
  }

  .sheet-wrap {
    align-items: flex-end;
    padding: 0;
  }

  .sheet {
    width: 100%;
    border-radius: 28px 28px 0 0;
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
  }

  .btn {
    min-height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blob,
  .project,
  .banner,
  .btn-primary,
  .btn-ghost {
    animation: none;
    transition: none;
  }
}
