:root {
  --row-h: 66px;
  --green: #34d058;
  --danger: #ff3b30;
  --done: #9a9a9a;
  --bg: #000;
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "Liberation Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: #fff;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body { min-height: 100dvh; }

button, input { font: inherit; color: inherit; }

button {
  background: none;
  border: 0;
  padding: 0;
  color: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.noscript {
  margin: 24px 16px;
  color: #9a9a9a;
  font-size: 17px;
}

.screen {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #000;
}

header {
  position: relative;
  flex: 0 0 auto;
  height: calc(46px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: #000;
  z-index: 10;
}

header h1,
#heading {
  position: absolute;
  left: 48px;
  right: 48px;
  top: env(safe-area-inset-top);
  height: 46px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

#title-text {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app.can-rename #title-text { cursor: pointer; }

#title-input,
.face input {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  border-radius: 0;
  caret-color: #fff;
  -webkit-appearance: none;
  appearance: none;
}

#title-input {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}

header button {
  position: absolute;
  top: env(safe-area-inset-top);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  z-index: 2;
}

#back { left: 0; }
#add { right: 0; }

#scroller {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
  padding-bottom: env(safe-area-inset-bottom);
}

#scroller::-webkit-scrollbar { display: none; }

#pull-hint {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  font-weight: 600;
  background: #000;
}

#rows {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

#empty {
  margin: 22px 20px;
  color: #8d8d92;
  font-size: 16px;
  text-align: center;
}

.row {
  position: relative;
  height: var(--row-h);
  background: #000;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.row.dragging {
  z-index: 5;
  overflow: visible;
}

.under {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 22px;
}

.under svg {
  display: block;
  opacity: 0;
}

.under-done {
  background: var(--green);
  justify-content: flex-start;
}

.under-delete {
  background: var(--danger);
  justify-content: flex-end;
}

.row.list .under-done {
  background: #000;
}

.face {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--bg, #e40e0c);
  color: #fff;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.011em;
}

.row.dragging .face {
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.48);
}

.text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 22px;
}

.face input.edit,
#composer .face input {
  flex: 1;
  min-width: 0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.011em;
}

#composer {
  height: 0;
  transition: height 0.18s ease;
}

#composer.pulling { transition: none; }

#composer.open { height: var(--row-h); }

.row.done .face {
  background: #000;
  color: var(--done);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.row.done .text {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--done);
}

#composer input::placeholder,
.face input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: 12px;
  background: #2a2a2c;
  color: #fff;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

input:-webkit-autofill {
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  transition: background-color 9999s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  #composer,
  #toast {
    animation: none;
    transition: none;
  }
}
