@property --fill {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

:root {
  color-scheme: light;
  font: 16px/1.5 system-ui, sans-serif;
  color: #24292c;
  background: #e9edeb;
  animation: ambient 24s ease-in-out infinite alternate;
}

* { box-sizing: border-box; }

body {
  --page-gutter: clamp(1rem, 5vw, 3rem);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: var(--page-gutter);
}

.workspace {
  width: min(100%, 42rem);
  min-height: calc(100vh - 2 * var(--page-gutter));
  min-height: calc(100svh - 2 * var(--page-gutter));
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  gap: 1rem;
}

.entry {
  grid-row: 2;
}

.composer {
  overflow: hidden;
  border-radius: 1.125rem;
  background: #fff;
  box-shadow: 0 12px 36px #2633310a;
}

.composer:has(textarea:focus-visible) { box-shadow: 0 12px 36px #26333126; }

textarea {
  display: block;
  width: 100%;
  min-height: 11.5rem;
  max-height: 65svh;
  padding: 1.375rem 1.5rem 0.75rem;
  border: 0;
  border-radius: 0;
  outline: 0;
  resize: vertical;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.65;
}

textarea::placeholder { color: #646d69; }

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem 1rem 1.5rem;
}

.count {
  font-size: 0.75rem;
  color: #5a6460;
  font-variant-numeric: tabular-nums;
}

.count[data-invalid] { color: #a13932; }

button {
  border: 0;
  border-radius: 999px;
  padding: 0.625rem 1.125rem;
  background: #263d36;
  color: white;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 650;
  cursor: pointer;
}

button:not(:disabled):hover { background: #34554a; }
button:focus-visible { outline: 2px solid #263d36; outline-offset: 3px; }

button:disabled {
  background: #e8edeb;
  color: #56645e;
  cursor: default;
}

.ratings {
  grid-row: 3;
  align-self: end;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rating {
  --surface: #1d302b;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.25rem 0.875rem 0.25rem 0.25rem;
  border-radius: 999px;
  background: var(--surface);
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.2;
}

.ring {
  --indicator: #80d5bf;
  display: grid;
  place-items: center;
  flex: none;
  order: -1;
  width: 2.375rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--indicator) var(--fill), #51665e 0);
  transition: --fill 550ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

[data-flagged] .ring { --indicator: #ff9a8b; }

.value {
  display: grid;
  place-items: center;
  width: calc(100% - 5px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--surface);
  font-size: 0.625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.feedback {
  margin: 0.625rem 0 0;
  color: #8d302a;
  font-size: 0.875rem;
}

.feedback:empty { margin: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

@keyframes ambient {
  0% { background-color: #e9edeb; }
  50% { background-color: #e8edf2; }
  100% { background-color: #f0ebee; }
}

@media (max-width: 36rem) {
  .ratings { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  :root { animation: none; }
  .ring { transition: none; }
}
