:root {
  --bg: #f3f4f1;
  --surface: #ffffff;
  --ink: #1b1c1e;
  --sub: #6b7178;
  --line: #dfe2dc;
  --accent: #2a5674;
  --accent-press: #1e425a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181a;
    --surface: #1f2326;
    --ink: #e9eaeb;
    --sub: #9aa1a7;
    --line: #32373b;
    --accent: #3e7ca6;
    --accent-press: #34688c;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'BIZ UDPGothic', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  touch-action: manipulation;
}

header,
main {
  max-width: 560px;
  margin-inline: auto;
}

.wordmark {
  margin: 0;
  font-family: 'Zen Maru Gothic', 'BIZ UDPGothic', sans-serif;
  font-weight: 500;
  font-size: 22px;
}

.tagline {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--sub);
}

main {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 20px;
}

button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Compose */

.compose {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#input {
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 20px;
  line-height: 1.5;
  resize: none;
  padding: 6px 4px;
  min-height: 90px;
}

#input::placeholder {
  color: var(--sub);
}

.compose-actions {
  display: flex;
  gap: 10px;
}

.primary {
  flex: 1;
  height: 52px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
}

.primary:active {
  background: var(--accent-press);
}

.ghost {
  height: 52px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--sub);
  font-size: 15px;
}

/* Sections */

.section-label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--sub);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 15px;
  color: var(--ink);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip:active {
  background: var(--line);
}

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.rows:empty {
  display: none;
}

.row {
  display: flex;
  align-items: stretch;
}

.row + .row {
  border-top: 1px solid var(--line);
}

.row-text {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
  padding: 12px 0 12px 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.icon-btn {
  width: 44px;
  border: 0;
  background: none;
  color: var(--sub);
  font-size: 20px;
  flex: none;
}

.del {
  font-size: 22px;
}

.empty {
  margin: 0;
  font-size: 14px;
  color: var(--sub);
}

.empty[hidden] {
  display: none;
}

/* Display overlay: always black on white, by design */

#overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #ffffff;
  color: #111111;
  display: flex;
  flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(12px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  cursor: pointer;
}

#overlay[hidden] {
  display: none;
}

#stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#display-text {
  width: 100%;
  text-align: center;
  font-weight: 700;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
