:root {
  color-scheme: light dark;
  --bg: #f6f5f2;
  --fg: #1f2328;
  --muted: #6b6f76;
  --accent: #3d6b5a;
  --card: #ffffff;
  --line: #e4e2dd;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --fg: #ecebe8;
    --muted: #9a9ea6;
    --accent: #7fb59f;
    --card: #1f2228;
    --line: #2c3036;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  /* No double-tap zoom, so taps register immediately. */
  touch-action: manipulation;
  /* Keep content clear of the notch, Dynamic Island and home bar. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.screen[hidden] {
  display: none;
}

h1 {
  margin: 8px 0 0;
  font-size: 28px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

p {
  margin: 0;
}

.rock {
  width: min(100%, 280px);
  margin: 0 auto;
}

.rock svg {
  display: block;
  width: 100%;
  height: auto;
}

.adopt-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-weight: 600;
}

input[type="text"] {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--muted);
  border-radius: 12px;
  background: transparent;
  color: var(--fg);
  font: inherit;
}

input[type="text"]:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 1px var(--accent);
}

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

button {
  min-width: 44px;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-weight: 600;
}

button:active {
  opacity: 0.7;
}

button:disabled {
  opacity: 0.4;
}

.event {
  padding: 10px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--card);
}

.event-when {
  color: var(--muted);
  font-size: 14px;
}

/* Three lines tall, so a new event doesn't push the buttons down mid-tap. */
.event-text {
  min-height: calc(1.4em * 3);
  line-height: 1.4;
}

.event.fresh {
  animation: flash 1.2s ease-out;
}

@keyframes flash {
  from {
    background: var(--accent);
    color: var(--bg);
  }
}

.stats {
  display: grid;
  gap: 1px;
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--line);
}

.stats > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card);
}

.stats dt {
  color: var(--muted);
}

.stats dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Three lines tall, so the buttons below don't move as replies change length. */
.reply {
  min-height: calc(1.4em * 3 + 28px);
  padding: 14px;
  border-radius: 12px;
  background: var(--card);
}

.reply.fresh {
  animation: fade-in 0.25s ease-out;
}

@keyframes fade-in {
  from {
    color: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reply.fresh,
  .event.fresh {
    animation: none;
  }
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.actions button {
  min-height: 52px;
  padding: 10px 4px;
}

/* Below 16px, Safari zooms the page when an input gets focus. */
input,
select,
textarea {
  font-size: 16px;
}
