:root {
  color-scheme: dark;
  font-family: "Segoe UI", sans-serif;
  background: #141210;
  color: #f4efe8;
  --menu-h: 3.2rem;
  --sub-h: 2.9rem;
}

body {
  margin: 0;
}

main {
  max-width: 32rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

body.signed-in main {
  padding-bottom: calc(var(--menu-h) + 1.6rem + env(safe-area-inset-bottom));
}

body.signed-in.has-submenu main {
  padding-bottom: calc(var(--menu-h) + var(--sub-h) + 1.6rem + env(safe-area-inset-bottom));
}

h1, h2, h3 {
  font-weight: 600;
  margin: 0 0 0.5rem;
}

h2 {
  margin-top: 0.25rem;
}

h3 {
  margin-top: 1.25rem;
  font-size: 1rem;
}

label {
  display: block;
  margin: 0.75rem 0;
}

input:not([type="checkbox"]):not([type="radio"]), select, textarea, button {
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  margin-top: 0.25rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid #3a342c;
  border-radius: 0.4rem;
  background: #1e1a17;
  color: inherit;
}

button {
  margin-top: 0.5rem;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: 0.4rem;
  background: #c4553a;
  color: #fff;
  font-weight: 600;
}

button:disabled {
  opacity: 0.55;
}

button[hidden], img[hidden], section[hidden], a[hidden], nav[hidden], canvas[hidden], p[hidden], div[hidden], svg[hidden] {
  display: none;
}

.quiet {
  color: #b7aa9c;
  margin: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

#who {
  flex: 1 1 8rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row button {
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}

.thumbs, .pick {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0.6rem 0 0;
  padding: 0;
}

.thumbs li, .pick label, .pick .pick-card {
  margin: 0;
  min-width: 0;
}

.thumbs img, .pick img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.35rem;
  background: #2a241f;
  display: block;
}

.thumbs .remove, .thumbs .shot {
  width: 100%;
}

.thumbs .remove {
  margin-top: 0.35rem;
  padding: 0.55rem 0.2rem;
  background: #2a241f;
  color: #f4efe8;
  font-size: 0.85rem;
}

.thumbs .shot {
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0.35rem;
}

.thumbs .shot[aria-pressed="true"] img,
.pick label:has(input:checked) img {
  outline: 3px solid #c4553a;
  outline-offset: -3px;
}

.thumbs .empty, .pick .empty {
  grid-column: 1 / -1;
  color: #b7aa9c;
}

.pick label {
  position: relative;
  display: block;
}

.pick input[type="checkbox"],
.pick input[type="radio"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.pick .pick-card:has(input:checked) {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  column-gap: 0.55rem;
  align-items: start;
}

.when, .prompt-line {
  display: block;
  margin-top: 0.2rem;
  color: #b7aa9c;
  font-size: 0.7rem;
  line-height: 1.2;
}

.prompt-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mods {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.mod {
  margin: 0;
  font-size: 0.75rem;
  color: #b7aa9c;
}

.mods input,
.mods select {
  margin-top: 0.15rem;
  padding: 0.4rem 0.35rem;
}

.prompt-choices {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.prompt-choices button {
  margin: 0;
  text-align: left;
  background: #2a241f;
  color: #f4efe8;
}

.prompt-choices button[aria-pressed="true"] {
  background: #c4553a;
  color: #fff;
}

.prompt-choices .empty {
  margin: 0;
}

.ref-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.ref-tabs button {
  width: auto;
  margin: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0.45rem 0.6rem;
  background: #2a241f;
  color: #f4efe8;
  font-size: 0.8rem;
}

.ref-tabs button[aria-selected="true"] {
  background: #c4553a;
  color: #fff;
}

.tools, .stamps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.tools button, .stamps button {
  width: auto;
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: #2a241f;
  color: #f4efe8;
}

.tools button[aria-pressed="true"], .stamps button[aria-pressed="true"] {
  background: #c4553a;
  color: #fff;
}

#editor {
  width: 100%;
  height: auto;
  margin-top: 0.85rem;
  border-radius: 0.4rem;
  touch-action: none;
  background: #2a241f;
}

#result {
  width: 100%;
  height: auto;
  border-radius: 0.4rem;
  margin-top: 0.5rem;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.result-actions button, .result-actions a {
  width: auto;
  margin-top: 0.5rem;
  white-space: nowrap;
}

.result-actions a {
  color: #f0c7a2;
  font-weight: 600;
  padding: 0.8rem 0.2rem;
}

#status {
  min-height: 1.2rem;
  margin: 0.75rem 0;
  color: #f0c7a2;
}

#full-prompt {
  width: 100%;
}

#full-prompt {
  min-height: 10rem;
  margin-bottom: 1rem;
}

#generate-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: end;
  margin: 0.75rem 0 0;
}

#generate-status,
#her-place-label {
  grid-column: 1 / -1;
}

#generate-status {
  min-height: 1.15rem;
  margin: 0;
  color: #f0c7a2;
}

#her-place-label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
}

#her-place-label[hidden] {
  display: none;
}

#her-place-label select {
  flex: 1;
  min-width: 0;
  margin: 0;
}

#generate-form textarea {
  margin: 0;
  min-height: 2.7rem;
}

#generate-form button {
  width: auto;
  min-width: 6.75rem;
  margin: 0;
}

.lock-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
  text-align: center;
}

.lock-icon {
  width: 4.5rem;
  height: 5.6rem;
}

.lock-icon .shackle {
  fill: none;
  stroke: #f4efe8;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lock-icon .body {
  fill: #c4553a;
}

.lock-icon.is-open .shackle {
  transform: translate(14px, -18px);
}

.lock-counters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
  margin: 1.25rem 0 0;
}

.lock-days {
  margin: 0;
  font-size: 3rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.lock-clock {
  margin: 0.35rem 0 0;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.idea-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.idea-focus button {
  width: auto;
  margin: 0;
  padding: 0.55rem 0.7rem;
  background: #2a241f;
  color: #f4efe8;
}

.idea-focus button[aria-pressed="true"] {
  background: #c4553a;
  color: #fff;
}

#idea-result {
  margin-top: 0.9rem;
  padding: 0.85rem 0.9rem;
  border-radius: 0.4rem;
  background: #1e1a17;
}

#idea-result h3 {
  margin-top: 0;
}

#idea-text {
  margin: 0.35rem 0 0;
}

#idea-next {
  width: auto;
  min-width: 6.75rem;
}

.events {
  list-style: none;
  margin: 0;
  padding: 0;
}

.events li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0.35rem 0;
  color: #b7aa9c;
  font-size: 0.9rem;
}

.events li > span {
  min-width: 0;
  overflow-wrap: break-word;
}

.time-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.time-fields label {
  margin: 0.75rem 0;
}

.tasks {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.tasks:empty {
  display: none;
}

.tasks li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin: 0;
  padding: 0.75rem 0;
  border-top: 1px solid #3a342c;
}

.tasks p {
  margin: 0;
}

.tasks .effect {
  color: #b7aa9c;
  font-variant-numeric: tabular-nums;
}

.tasks .row {
  margin: 0;
}

.tasks.home {
  width: 100%;
  margin-top: 1.25rem;
}

.tasks.home li {
  border-top: 0;
  padding: 0.35rem 0;
}

.tasks.home button {
  width: 100%;
}

button.ghost {
  background: transparent;
  color: #b7aa9c;
}

#home-task-status:empty,
#task-status:empty,
#chastity-status:empty {
  display: none;
}

fieldset.kind {
  border: 0;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

fieldset.kind legend {
  width: 100%;
  padding: 0;
}

fieldset.kind label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  margin: 0;
  width: auto;
}

.duration-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.duration-fields label {
  margin-bottom: 0;
}

.length-summary {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.length-summary h3,
.length-summary p {
  margin: 0.15rem 0;
}

.length-chart {
  display: block;
  width: 100%;
  height: 8rem;
  margin: 0.75rem 0 0;
  background: #1e1a17;
  border: 1px solid #3a342c;
  border-radius: 0.4rem;
}

.length-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.length-log li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0.45rem 0;
  color: #b7aa9c;
  font-size: 0.9rem;
}

.length-log li > span {
  min-width: 0;
  overflow-wrap: break-word;
}

.length-log button {
  width: auto;
  flex-shrink: 0;
  margin: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  background: #2a241f;
  color: #f4efe8;
  font-size: 0.8rem;
}

.events button {
  width: auto;
  flex-shrink: 0;
  margin: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.people {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.people li {
  margin: 0;
}

.people .count {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.people .quiet {
  margin: 0.25rem 0 0;
}

.cal-label {
  flex: 1;
  margin: 0;
  text-align: center;
  font-weight: 600;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: 0.2rem;
  margin-top: 0.75rem;
}

.calendar .dow,
.calendar .pad {
  min-height: 2.2rem;
}

.calendar .dow {
  text-align: center;
  color: #b7aa9c;
  font-size: 0.68rem;
  padding-top: 0.35rem;
}

.calendar button {
  margin: 0;
  min-height: 44px;
  padding: 0.3rem 0;
  border-radius: 0.35rem;
  background: #1e1a17;
  color: inherit;
  font-size: 0.85rem;
  font-weight: 600;
}

.calendar button.has-event {
  box-shadow: inset 0 -3px 0 #c4553a;
}

.calendar button[aria-pressed="true"] {
  background: #c4553a;
  color: #fff;
}

.events button.remove {
  width: auto;
  margin: 0.35rem 0 0.6rem;
  padding: 0.35rem 0.7rem;
  background: transparent;
  color: #b7aa9c;
  border: 1px solid #3a342c;
}

.submenu,
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  display: grid;
  gap: 0;
  background: #1e1a17;
  z-index: 2;
}

.submenu {
  bottom: calc(var(--menu-h) + env(safe-area-inset-bottom));
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border-top: 1px solid #3a342c;
}

.tabs {
  bottom: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #3a342c;
  padding-bottom: env(safe-area-inset-bottom);
}

.submenu button,
.tabs button {
  width: 100%;
  margin: 0;
  min-width: 24px;
  min-height: 24px;
  border-radius: 0;
  background: transparent;
  color: #b7aa9c;
  padding: 0.85rem 0.1rem;
  font-size: 0.82rem;
}

.submenu button {
  font-size: 0.78rem;
  padding: 0.75rem 0.1rem;
}

.tabs button {
  font-size: 0.68rem;
  padding: 0.85rem 0.05rem;
  white-space: nowrap;
}

.submenu button[aria-current="page"],
.tabs button[aria-current="page"] {
  background: #c4553a;
  color: #fff;
}

/* Four 44px tabs fit from 176px up, including a 390px phone. */
@media (min-width: 176px) {
  .submenu button,
  .tabs button {
    min-width: 44px;
    min-height: 44px;
  }
}
