.thoughts {
  min-height: 100svh;
  padding: clamp(112px, 17vh, 170px) 32px max(96px, calc(64px + env(safe-area-inset-bottom)));
}
.thoughts-app,
.thoughts-login { width: min(100%, 680px); margin: 0 auto; }
.thoughts h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.15rem;
  line-height: 1.4;
  letter-spacing: -.01em;
}
.thoughts-header { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; }
.sync-message {
  min-height: 1em;
  margin: 0;
  color: var(--quiet);
  font-family: var(--mono);
  font-size: .7rem;
}
.thought-form { margin-top: 42px; }
.thought-form textarea,
.edit-textarea {
  display: block;
  width: 100%;
  resize: none;
  overflow: hidden;
  padding: 2px 0 12px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.75;
  caret-color: var(--ink);
}
.thought-form textarea { min-height: 44px; }
.thought-form textarea::placeholder { color: #9b9b96; opacity: 1; }
.thought-form textarea:focus,
.edit-textarea:focus { border-bottom-color: var(--soft-line); }
.thought-form > button,
.edit-actions button,
.login-form button,
.confirm-actions button {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .76rem;
  cursor: pointer;
}
.thought-form > button { margin-top: 8px; }
.thought-form > button:hover,
.edit-actions button:hover,
.login-form button:hover,
.confirm-actions button:hover { color: var(--ink); }
.thought-form > button:focus-visible,
.edit-actions button:focus-visible,
.login-form button:focus-visible,
.confirm-actions button:focus-visible,
.thought-menu-trigger:focus-visible,
.thought-menu button:focus-visible { outline: 1px solid var(--focus); outline-offset: 3px; }
.thought-form > button:disabled,
.login-form button:disabled { opacity: .4; cursor: wait; }

.thought-list { margin-top: 76px; }
.thought-group + .thought-group { margin-top: 60px; }
.thought-date {
  margin: 0 0 25px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .76rem;
  font-weight: 500;
}
.thought-item { position: relative; padding: 0 76px 2px 0; }
.thought-item + .thought-item { margin-top: 34px; }
.thought-content {
  margin: 0;
  color: #292927;
  font-size: 1rem;
  line-height: 1.82;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pin-mark { margin-right: 7px; color: var(--quiet); }
.thought-controls {
  position: absolute;
  top: 1px;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 150ms ease;
}
.thought-item:hover .thought-controls,
.thought-item:focus-within .thought-controls,
.thought-controls.is-open { opacity: 1; }
.thought-time { color: var(--quiet); font-family: var(--mono); font-size: .65rem; }
.thought-menu-trigger {
  min-width: 28px;
  padding: 1px 0 7px;
  border: 0;
  background: transparent;
  color: var(--quiet);
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .08em;
  cursor: pointer;
}
.thought-menu {
  position: absolute;
  z-index: 5;
  top: 25px;
  right: 0;
  width: 92px;
  padding: 5px;
  border: 1px solid var(--soft-line);
  background: var(--paper);
}
.thought-menu button {
  display: block;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .7rem;
  text-align: left;
  cursor: pointer;
}
.thought-menu button:hover { color: var(--ink); }
.thought-menu .delete-action:hover { color: var(--danger); }
.edit-actions { display: flex; gap: 20px; margin-top: 7px; }
.thought-empty { margin: 76px 0 0; color: var(--quiet); font-size: .86rem; }

.thoughts-login { padding-top: 8px; }
.login-form { width: min(100%, 340px); margin-top: 48px; }
.login-form label { display: block; color: var(--muted); font-family: var(--mono); font-size: .76rem; }
.login-form input {
  display: block;
  width: 100%;
  margin-top: 17px;
  padding: 6px 0 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
}
.login-form input:focus { border-bottom-color: var(--focus); }
.login-form button { display: block; margin-top: 17px; }
.form-message { min-height: 1.2em; margin: 13px 0 0; color: var(--danger); font-size: .76rem; }

.confirm-layer {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(250, 250, 248, .72);
  backdrop-filter: blur(2px);
}
.confirm-box {
  width: min(100%, 310px);
  padding: 25px 27px 20px;
  border: 1px solid var(--soft-line);
  background: var(--paper);
}
.confirm-box p { margin: 0; font-family: var(--mono); font-size: .84rem; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 25px; margin-top: 25px; }
.confirm-actions #delete-confirm { color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  .thought-controls { transition-duration: .01ms; }
}
@media (max-width: 640px) {
  .thoughts { padding: 104px 24px max(100px, calc(72px + env(safe-area-inset-bottom))); }
  .thought-form { margin-top: 36px; }
  .thought-form textarea,
  .edit-textarea { font-size: 16px; }
  .thought-list { margin-top: 62px; }
  .thought-group + .thought-group { margin-top: 52px; }
  .thought-item { padding-right: 42px; }
  .thought-content { font-size: .96rem; line-height: 1.78; }
  .thought-controls { opacity: 1; }
  .thought-time { display: none; }
  .thought-menu-trigger { min-width: 36px; min-height: 36px; color: #aaa9a4; }
}
