:root {
  color-scheme: light;
  --bg: #f8f9fd;
  --rail: #fff;
  --panel: #fff;
  --field: #f5f6fa;
  --text: #172039;
  --muted: #586379;
  --line: #e0e5ef;
  --blue: #304bd5;
  --on-blue: #fff;
  --tint: #edf0ff;
  --danger: #ae2530;
  --shadow: 0 12px 36px #1524490d;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151827;
  --rail: #1a1e2e;
  --panel: #202538;
  --field: #23293c;
  --text: #f1f4fb;
  --muted: #b2bed4;
  --line: #363e57;
  --blue: #acbaff;
  --on-blue: #151c41;
  --tint: #2b365d;
  --danger: #ff9c9c;
  --shadow: 0 12px 36px #080a1150;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]),
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #151827;
    --rail: #1a1e2e;
    --panel: #202538;
    --field: #23293c;
    --text: #f1f4fb;
    --muted: #b2bed4;
    --line: #363e57;
    --blue: #acbaff;
    --on-blue: #151c41;
    --tint: #2b365d;
    --danger: #ff9c9c;
    --shadow: 0 12px 36px #080a1150;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
a {
  color: inherit;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.skip {
  position: fixed;
  left: 12px;
  top: 12px;
  translate: 0 -160%;
  z-index: 5;
  background: var(--panel);
  padding: 10px;
}
.skip:focus {
  translate: 0;
}
.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--rail);
  border-right: 1px solid var(--line);
  padding: 24px 17px;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.025em;
  margin: 0 4px 29px;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  margin-top: 2px;
}
.logo {
  display: block;
  width: 37px;
  height: 37px;
  flex: none;
}
.mobile-logo {
  display: none;
  flex: none;
}
.primary,
.outline,
.quiet,
.credit {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 13px;
  background: none;
  font-weight: 650;
  font-size: 0.87rem;
}
.primary {
  background: var(--blue);
  color: var(--on-blue);
}
.primary:hover:not(:disabled) {
  filter: brightness(1.12);
}
.outline {
  border-color: var(--line);
  background: var(--panel);
}
.outline:hover:not(:disabled),
.quiet:hover {
  background: var(--field);
}
.new {
  text-align: left;
  margin-bottom: 15px;
  padding: 12px 13px;
}
.new span {
  margin-right: 7px;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--muted);
}
.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: none;
  padding: 9px 0;
  outline: 0;
  font-size: 0.85rem;
}
.search:focus-within {
  outline: 2px solid var(--blue);
}
.rail-label {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.085em;
  margin: 24px 6px 9px;
}
.history {
  min-height: 62px;
  flex: 1;
}
.history > p {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0 6px;
}
.history-row {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 8px;
}
.history-row:has([aria-current="true"]) {
  background: var(--tint);
}
.history-row button {
  border: 0;
  background: none;
  border-radius: 8px;
  font-size: 0.84rem;
  padding: 9px 6px;
}
.history-row button:first-child {
  flex: 1;
  min-width: 0;
  text-align: left;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.history-row button:hover {
  color: var(--blue);
}
.rail-bottom {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding: 10px 0 0;
}
.rail-bottom button {
  text-align: left;
}
.rail-bottom a {
  color: var(--muted);
  font-size: 0.79rem;
  text-decoration: none;
  padding: 0 13px;
}
.rail-bottom a:hover {
  text-decoration: underline;
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
.top {
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.top > p {
  font-size: 0.9rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
}
.top-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex: none;
}
.credit {
  background: var(--tint);
  color: var(--blue);
}
.mobile-toggle {
  display: none;
}
.thread {
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.welcome {
  width: min(100% - 62px, 680px);
  margin: clamp(35px, 9vh, 110px) auto 35px;
  text-align: center;
}
.hero-mark {
  display: grid;
  place-items: center;
  margin: auto;
  width: 83px;
  height: 83px;
  background: radial-gradient(
    circle at 35% 15%,
    #d9dcff,
    #eff1ff 58%,
    transparent 72%
  );
  border-radius: 26px;
}
.hero-mark img {
  width: 57px;
  height: 57px;
  filter: drop-shadow(0 7px 13px #304bd547);
}
.welcome h1 {
  margin: 14px 0 7px;
  font-size: clamp(2rem, 5.4vw, 3.45rem);
  letter-spacing: -0.065em;
  line-height: 1.06;
}
.welcome > p {
  color: var(--muted);
  margin: 0;
}
.starter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 25px;
}
.starter-grid button {
  position: relative;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 13px 33px 13px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: center;
}
.starter-grid button:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
}
.tile-icon {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  grid-row: span 2;
  border-radius: 8px;
  font-size: 1.05rem;
  color: #2c2860;
  background: #ece9ff;
}
.amber {
  background: #fff1d7;
  color: #795014;
}
.blue {
  background: #e4eeff;
  color: #214990;
}
.mint {
  background: #dcf8ee;
  color: #15634d;
}
.starter-grid strong {
  font-size: 0.87rem;
}
.starter-grid small {
  color: var(--muted);
  font-size: 0.74rem;
}
.tile-arrow {
  position: absolute;
  right: 13px;
  top: 14px;
  color: var(--muted);
}
.messages {
  width: min(100% - 56px, 760px);
  margin: 25px auto;
}
.messages:empty {
  display: none;
}
.message {
  padding: 14px 17px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.message.user {
  margin-left: clamp(0px, 8%, 70px);
  background: var(--tint);
  border-color: transparent;
}
.message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 0.79rem;
  font-weight: 750;
}
.message-head button {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
}
.message-body {
  line-height: 1.67;
  font-size: 0.95rem;
}
.message-body p {
  white-space: pre-wrap;
  margin: 0;
}
.message-body pre {
  white-space: pre-wrap;
  background: var(--field);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
}
.composer-dock {
  width: min(100% - 56px, 760px);
  margin: 0 auto;
  padding: 0 0 12px;
}
.composer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 11px;
  box-shadow: var(--shadow);
}
.composer:focus-within {
  border-color: var(--blue);
}
.composer textarea {
  display: block;
  width: 100%;
  resize: none;
  background: none;
  border: 0;
  padding: 5px;
  max-height: 160px;
  line-height: 1.45;
  outline: 0;
}
.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.composer-actions .quiet {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 5px 7px;
}
.send {
  font-size: 1.2rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  padding: 0;
}
.composer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  margin: 7px 0 0;
}
#notice {
  font-size: 0.83rem;
  color: var(--muted);
  margin: 0 0 7px;
}
#notice:empty {
  display: none;
}
dialog {
  width: min(100% - 28px, 480px);
  max-height: calc(100dvh - 28px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  padding: 21px;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #141b39a0;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.dialog-head h2 {
  margin: 0;
  font-size: 1.28rem;
}
.dialog-head button {
  background: none;
  border: 0;
  font-size: 1.55rem;
  padding: 0 4px;
}
.settings-body,
.packs {
  margin-top: 12px;
}
.setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  font-weight: 600;
}
.setting select,
#manage input {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px;
}
.setting input {
  accent-color: var(--blue);
}
.setting small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
}
.privacy-note,
.dialog-note,
#manage-status {
  font-size: 0.81rem;
  color: var(--muted);
}
.packs button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  margin-bottom: 7px;
}
.packs button:hover {
  border-color: var(--blue);
}
#manage label {
  display: grid;
  gap: 6px;
  margin-block: 14px;
}
.manage-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.danger {
  background: none;
  color: var(--danger);
  border: 1px solid var(--line);
  padding: 8px;
  border-radius: 8px;
}
@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
  }
  .rail {
    display: none;
    position: fixed;
    z-index: 2;
    left: 0;
    top: 59px;
    height: calc(100dvh - 59px);
    width: min(290px, 90vw);
    box-shadow: var(--shadow);
  }
  .app.history-open .rail {
    display: flex;
  }
  .mobile-logo {
    display: block;
  }
  .mobile-toggle {
    display: block;
  }
  .top {
    min-height: 59px;
    padding: 9px 12px;
  }
  .welcome,
  .messages,
  .composer-dock {
    width: calc(100% - 28px);
  }
  .welcome {
    margin-top: 25px;
  }
  .starter-grid {
    gap: 7px;
    margin-top: 19px;
  }
  .starter-grid button {
    padding: 9px 20px 9px 8px;
    gap: 2px 6px;
  }
  .tile-icon {
    width: 27px;
    height: 27px;
  }
  .starter-grid small {
    font-size: 0.68rem;
  }
  .tile-arrow {
    right: 6px;
    top: 7px;
  }
  .top .outline,
  .top .credit {
    padding: 7px 8px;
    font-size: 0.76rem;
  }
}
@media (max-width: 380px) {
  .starter-grid button {
    grid-template-columns: auto 1fr;
  }
  .starter-grid strong {
    font-size: 0.74rem;
  }
  .welcome h1 {
    font-size: 2rem;
  }
  .welcome > p {
    font-size: 0.9rem;
  }
}

.redeem-form {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.redeem-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 650;
}
.redeem-controls {
  display: flex;
  gap: 8px;
}
.redeem-controls input {
  min-width: 0;
  flex: 1;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  padding: 8px 10px;
}
#redeem-status:empty {
  display: none;
}
