:root {
  --bg: #f5f6f7;
  --ink: #1a1d21;
  --muted: #5e676f;
  --line: #cfd4d9;
  --err: #8a3030;
  --paper: #ffffff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0 24px;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.top {
  margin: 0;
  padding: 24px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
}

main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10vh 0 48px;
  overflow-wrap: break-word;
}

h1 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
}

.lead {
  margin: 0 0 36px;
  color: var(--muted);
}

.lead strong {
  color: var(--ink);
  font-weight: 600;
}

.err {
  margin: -18px 0 28px;
  color: var(--err);
  overflow-wrap: anywhere;
}

form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 24px;
  min-width: 0;
}

label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
}

input:focus {
  outline: none;
  border-bottom-color: var(--ink);
}

input[name="captcha"] {
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

button.refresh {
  display: grid;
  place-items: center;
  align-self: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

button.refresh:disabled {
  cursor: default;
}

button.refresh svg {
  display: block;
  transform-box: fill-box;
  transform-origin: center;
}

button.refresh svg.spin {
  animation: refresh-spin 0.65s linear infinite;
}

@keyframes refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

input[type="hidden"] {
  display: none;
  min-height: 0;
  padding: 0;
  border: 0;
}

input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--bg) inset;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  background: var(--paper);
}

button {
  align-self: flex-start;
  height: 44px;
  margin: 4px 0 0;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: var(--ink);
  box-shadow: none;
  color: var(--paper);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 40px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.col {
  width: 100%;
  min-width: 0;
}

.hen {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  background: transparent;
  object-fit: contain;
}

.swap {
  margin: 32px 0 0;
  color: var(--muted);
  font-size: 15px;
}

body.desk {
  padding: 0;
  background: #e7eaed;
}

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 20px 16px;
  background: #f5f6f7;
  border-bottom: 1px solid var(--line);
}

.side-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.side-user {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
}

.menu a {
  display: block;
  padding: 8px 12px;
  border-left: 2px solid transparent;
  color: var(--ink);
  text-decoration: none;
}

.menu a[aria-current="page"] {
  border-left-color: var(--ink);
  background: var(--paper);
  font-weight: 600;
}

.nest {
  display: flex;
  flex-direction: column;
  margin: 0 0 6px 12px;
}

.nest a {
  padding: 6px 12px;
  color: var(--muted);
  font-size: 15px;
}

.side form {
  margin-top: auto;
}

main.pane {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 28px 22px 64px;
  background: var(--paper);
}

main.pane > * {
  width: 100%;
  max-width: 640px;
}

.shell:has(.talk) {
  height: 100dvh;
  overflow: hidden;
}

main.pane:has(.talk) {
  flex: 1;
  align-self: stretch;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

main.pane:has(.talk) > .talk {
  max-width: none;
  flex: 1;
  min-height: 0;
}

.talk {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #f7f8f9;
}

.talk-bar {
  flex: 0 0 auto;
  padding: 14px 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.talk-bar h1 {
  margin: 0;
  font-size: 18px;
}

.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 14px 8px;
}

.thread .empty {
  margin: auto;
}

.bubble {
  align-self: flex-start;
  max-width: min(78%, 520px);
  padding: 8px 10px 6px;
  border-bottom: 0;
  border-radius: 16px 16px 16px 4px;
  background: var(--paper);
}

.bubble.mine {
  align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
  background: var(--ink);
  color: var(--paper);
}

.bubble .who {
  margin: 0 0 2px;
  color: #3d6f8f;
  font-size: 13px;
  font-weight: 600;
}

.bubble .text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble time {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.bubble.mine time {
  color: #c5c8cc;
}

.composer {
  flex: 0 0 auto;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  margin: 0;
  padding: 10px 12px 12px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  padding: 11px 14px;
  border: 0;
  border-radius: 22px;
  background: #eef0f2;
  resize: none;
}

button.send {
  display: grid;
  place-items: center;
  align-self: flex-end;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
}

.talk .err {
  margin: 0;
  padding: 8px 14px 0;
}

.days {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 15px;
}

.days b {
  display: block;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 64px;
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.9;
}

h2 {
  margin: 28px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.quiet {
  color: var(--muted);
}

ul.plain {
  margin: 0;
  padding: 0;
  list-style: none;
}

ul.plain li,
.sub a,
.msg {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.sub a {
  display: block;
}

.who {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.msg p {
  margin: 0;
}

textarea {
  width: 100%;
  min-height: 88px;
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

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

a {
  color: var(--ink);
  text-underline-offset: 0.2em;
}

@media (min-width: 641px) {
  body {
    padding-left: 10vw;
    padding-right: 10vw;
  }

  .top {
    padding-top: 36px;
  }

  main {
    max-width: 400px;
    padding-top: 14vh;
    padding-bottom: 80px;
  }

  main.pane {
    padding: 48px 56px 88px;
  }

  .days b {
    font-size: 84px;
  }

  h1 {
    font-size: 34px;
  }
}

@media (min-width: 860px) {
  .shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    align-items: stretch;
  }

  .side {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 16px 22px;
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }

  .side-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 0 12px;
  }

  main.pane {
    min-height: 100vh;
    padding: 56px 64px 96px;
  }
}

@media (min-width: 900px) {
  .stage {
    display: grid;
    grid-template-columns: minmax(0, 400px) minmax(0, min(34vw, 420px));
    align-items: center;
    justify-content: space-between;
    column-gap: 6vw;
  }

  .col {
    width: 100%;
    max-width: 400px;
  }

  .hen {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 8vh;
  }
}
