:root {
  color-scheme: light;
  --black: #000000;
  --white: #ffffff;
  --gray-1: #f5f5f5;
  --gray-2: #dedede;
  --gray-3: #777777;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.35;
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

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

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--black);
  padding: 14px max(20px, calc((100vw - 900px) / 2));
  background: var(--black);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #faf7f2;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 132px;
  height: auto;
}

.brand span {
  border-left: 1px solid #666666;
  padding-left: 10px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plain-button,
.connect-button,
.dialog-submit,
.close-button {
  border: 1px solid currentColor;
  border-radius: 0;
  padding: 9px 13px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
}

.plain-button {
  border-color: #555555;
  background: var(--black);
  color: var(--white);
}

.connect-button {
  background: var(--white);
  color: var(--black);
}

.plain-button:hover,
.connect-button:hover {
  text-decoration: underline;
}

.plain-button:disabled {
  color: #777777;
  cursor: wait;
}

main {
  width: min(900px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 130px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 40px;
  margin-bottom: 52px;
  border-bottom: 1px solid var(--black);
  padding-bottom: 28px;
}

.eyebrow {
  display: block;
  margin-bottom: 13px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  letter-spacing: -0.065em;
  line-height: 0.88;
}

.workflow {
  display: flex;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow li {
  display: grid;
  gap: 5px;
  min-width: 52px;
  font-size: 0.7rem;
  font-weight: 700;
}

.workflow span {
  color: var(--gray-3);
  font-size: 0.6rem;
  font-weight: 400;
}

.notice {
  margin-bottom: 24px;
  border: 1px solid var(--black);
  padding: 12px 14px;
  font-size: 0.8rem;
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 2px solid var(--black);
  padding-bottom: 14px;
}

.list-head h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
  line-height: 1;
}

.list-head span {
  color: var(--gray-3);
  font-size: 0.75rem;
}

.feed-list {
  display: grid;
}

.post {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 14px;
  border-bottom: 1px solid var(--black);
  padding: 24px 0;
}

.post.selected {
  background: var(--gray-1);
  box-shadow: 20px 0 var(--gray-1), -20px 0 var(--gray-1);
}

.post-check {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  border-radius: 0;
  accent-color: var(--black);
  cursor: pointer;
}

.post-content {
  min-width: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  color: var(--gray-3);
  font-size: 0.68rem;
}

.post-subreddit {
  color: var(--black);
  font-weight: 700;
}

.post-open {
  margin-left: auto;
  color: var(--black);
  font-size: 0.9rem;
  text-decoration: none;
}

.post-title {
  display: block;
  color: var(--black);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.post-title:hover,
.post-open:hover {
  text-decoration: underline;
}

.post-excerpt {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0 0;
  color: #333333;
  font-size: 0.82rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reply {
  margin-top: 20px;
  border-top: 1px solid var(--black);
  padding-top: 16px;
}

.reply-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.7rem;
}

.reply-head strong {
  text-transform: uppercase;
}

.reply-head span,
.reply-loading,
.reply-result {
  color: var(--gray-3);
}

.reply-loading {
  padding: 18px 0;
  font-size: 0.75rem;
}

.reply-text {
  display: block;
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--black);
  border-radius: 0;
  padding: 13px;
  background: var(--white);
  color: var(--black);
  font-size: 0.82rem;
  line-height: 1.5;
}

.reply-result {
  display: block;
  margin-top: 7px;
  font-size: 0.7rem;
}

.reply-result.success {
  color: var(--black);
  font-weight: 700;
}

.empty {
  border-bottom: 1px solid var(--black);
  padding: 42px 0;
  color: var(--gray-3);
  font-size: 0.85rem;
}

.go-bar {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--white);
  padding: 14px max(20px, calc((100vw - 900px) / 2));
  background: var(--black);
  color: var(--white);
}

.go-bar div {
  display: grid;
  gap: 3px;
}

.go-bar strong {
  font-size: 0.85rem;
}

.go-bar span {
  color: #aaaaaa;
  font-size: 0.68rem;
}

#goButton {
  min-width: 150px;
  min-height: 58px;
  border: 1px solid var(--white);
  border-radius: 0;
  background: var(--white);
  color: var(--black);
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

#goButton:hover:not(:disabled) {
  background: var(--black);
  color: var(--white);
}

#goButton:disabled {
  border-color: #444444;
  background: #222222;
  color: #666666;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .topbar {
    min-height: 58px;
    gap: 10px;
    padding: 10px 16px;
  }

  .brand {
    min-width: 0;
    gap: 6px;
  }

  .brand img {
    width: 96px;
  }

  .brand span {
    padding-left: 6px;
    font-size: 0.9rem;
  }

  .top-actions {
    flex: 0 0 auto;
  }

  .plain-button,
  .connect-button {
    min-height: 40px;
    padding: 8px 11px;
  }

  main {
    width: calc(100% - 32px);
    padding: 26px 0 112px;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 22px;
    margin-bottom: 32px;
    padding-bottom: 22px;
  }

  .eyebrow {
    margin-bottom: 10px;
    font-size: 0.6rem;
  }

  .intro h1 {
    max-width: 10ch;
    font-size: clamp(2.6rem, 14vw, 4rem);
    letter-spacing: -0.06em;
    line-height: 0.92;
  }

  .workflow {
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--gray-2);
    padding-top: 14px;
  }

  .workflow li {
    min-width: 0;
    flex: 1;
  }

  .list-head {
    padding-bottom: 12px;
  }

  .post {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    padding: 20px 0;
  }

  .post.selected {
    box-shadow: 16px 0 var(--gray-1), -16px 0 var(--gray-1);
  }

  .post-check {
    width: 20px;
    height: 20px;
  }

  .post-meta {
    flex-wrap: wrap;
    gap: 6px 8px;
  }

  .post-open {
    min-width: 32px;
    margin-top: -8px;
    padding: 8px 0;
    text-align: right;
  }

  .post-title {
    font-size: 1.05rem;
    line-height: 1.25;
  }

  .post-excerpt {
    font-size: 0.8rem;
    line-height: 1.45;
    -webkit-line-clamp: 3;
  }

  .reply {
    margin-top: 16px;
    padding-top: 14px;
  }

  .reply-text {
    min-height: 170px;
    padding: 12px;
    font-size: 1rem;
  }

  .go-bar {
    min-height: 76px;
    gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }

  #goButton {
    min-width: 104px;
    min-height: 52px;
    font-size: 1.25rem;
  }

  dialog {
    max-height: calc(100dvh - 24px);
    padding: 18px;
  }

  .setup-field code {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

dialog {
  width: min(520px, calc(100% - 32px));
  border: 1px solid var(--black);
  border-radius: 0;
  padding: 22px;
  background: var(--white);
  color: var(--black);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--black);
  padding-bottom: 14px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.6rem;
}

.close-button {
  border: 0;
  padding: 2px 7px;
  background: transparent;
  color: var(--black);
  font-size: 1.5rem;
}

.setup-link {
  display: inline-block;
  margin: 20px 0;
  color: var(--black);
  font-size: 0.8rem;
  font-weight: 700;
}

.setup-field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.setup-field > span {
  color: var(--gray-3);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.setup-field code {
  overflow-x: auto;
  border: 1px solid var(--gray-2);
  padding: 10px;
  font-size: 0.7rem;
  white-space: nowrap;
}

.setup-field input {
  min-height: 42px;
  border: 1px solid var(--black);
  border-radius: 0;
  padding: 9px 10px;
}

.dialog-submit {
  width: 100%;
  background: var(--black);
  color: var(--white);
}

.dialog-submit:disabled {
  color: var(--gray-3);
}

.form-error {
  margin: 0 0 12px;
  font-size: 0.75rem;
}

@media (max-width: 420px) {
  .plain-button {
    display: none;
  }

  .intro h1 {
    font-size: clamp(2.45rem, 13.5vw, 3.2rem);
  }

  .go-bar strong {
    font-size: 0.78rem;
  }

  .go-bar span {
    max-width: 42vw;
  }

  #goButton {
    min-width: 96px;
  }
}
