:root {
  color-scheme: dark light;
  --bg: #000000;
  --fg: #ffffff;
  --muted: #888888;
  --border: #444444;
  --danger: #cccccc;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --fg: #000000;
    --muted: #666666;
    --border: #bbbbbb;
    --danger: #000000;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.prompt {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.cursor {
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

header h1 {
  margin: 0.25rem 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.sub {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.composer {
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.75rem;
  margin-bottom: 1.5rem;
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.4;
}

textarea::placeholder {
  color: var(--muted);
}

.code-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.4;
  padding: 0;
}

.code-input::placeholder {
  color: var(--muted);
}

.error {
  margin: 0.75rem 0 0;
  color: var(--fg);
  font-size: 0.85rem;
}

.error.hidden {
  display: none;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover,
.btn:focus-visible {
  background: var(--fg);
  color: var(--bg);
  outline: none;
}

.btn-primary {
  font-weight: 700;
}

.btn-icon {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-icon:hover {
  color: var(--bg);
}

.btn-danger {
  color: var(--danger);
}

button:active {
  transform: translateY(1px);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item {
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.75rem 0.9rem;
}

.item pre {
  margin: 0 0 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.9rem;
  max-height: 220px;
  overflow-y: auto;
}

.item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.5rem;
}

.ttl {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.ttl.soon {
  color: var(--fg);
  font-weight: 700;
}

.item-btns {
  display: flex;
  gap: 0.25rem;
}

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2rem;
}

.empty.hidden {
  display: none;
}
