/* Pomodoro page: compact layout and one clear type scale.
   Sizes: clock 58 / sheet title 20 / section 16 / body 15 / meta 12–13. */

/* ---------- Page head: back, title, description and guide on one line ---------- */
main:has(.pom-tool) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-top: 18px;
}
main:has(.pom-tool) > * {
  min-width: 0;
}
main:has(.pom-tool) > .back {
  margin: 0;
  min-height: 38px;
  padding: 4px 16px 4px 6px;
  font-size: 14px;
}
main:has(.pom-tool) > .back::before {
  width: 26px;
  height: 22px;
  font-size: 20px;
}
main:has(.pom-tool) > h1 {
  margin: 0;
  padding: 2px 24px 4px 10px;
  font-size: 28px;
}
main:has(.pom-tool) > .desc {
  margin: 0;
  font-size: 14px;
}
main:has(.pom-tool) > .panel {
  flex: 1 1 100%;
  padding: 16px;
}
.guide-open {
  margin-left: auto;
  min-height: 38px;
  padding: 6px 14px;
  background: var(--ink);
  color: #fff;
  border-left: 5px solid var(--red);
  font-size: 14px;
  font-weight: 700;
}
.guide-open::before {
  content: "？";
  color: #ff3754;
  font-weight: 900;
}

/* ---------- Guide dialog (opens over the page instead of pushing it down) ---------- */
.guide-dialog {
  width: min(760px, 94vw);
  max-height: 86vh;
  max-height: 86dvh;
  padding: 0;
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 var(--red);
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
.guide-dialog[open] {
  display: flex;
  flex-direction: column;
}
.guide-dialog::backdrop {
  background: rgb(23 21 25 / 0.6);
}
.guide-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 18px;
  background: var(--ink);
  color: #fff;
  border-bottom: 4px solid var(--red);
}
.guide-dialog-head h2 {
  margin: 0;
  font-size: 20px;
  font-style: italic;
}
.guide-dialog .guide-dialog-close {
  min-height: 36px;
  padding: 4px 14px;
  background: var(--red);
  color: #fff;
}
.guide-dialog .guide-content {
  margin: 0;
  padding: 4px 20px 16px;
  border: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.guide-dialog .guide-content p {
  font-size: 15px;
}
@media (prefers-reduced-motion: no-preference) {
  .guide-dialog[open] {
    animation: guide-in 200ms cubic-bezier(0.2, 1.4, 0.4, 1);
  }
  @keyframes guide-in {
    from {
      opacity: 0;
      transform: translateX(-28px) skewX(-6deg);
    }
  }
}

/* ---------- Timer card ---------- */
.pom-tool {
  font-size: 15px;
}
.pom-tool .pom-stage {
  padding: 0;
}
.pom-tool .pom-face {
  width: min(236px, 74%);
  margin: 2px auto 8px;
}
.pom-tool .pom-core .clock {
  font-size: 58px;
  line-height: 1.1;
}
.pom-tool .pom-core p {
  font-size: 13px;
  letter-spacing: 0.08em;
}
.pom-tool .timer-card > label {
  margin: 4px 0 8px;
  font-size: 14px;
}
.pom-tool .timer-card > label input {
  margin-top: 4px;
  font-size: 15px;
}
.pom-tool .timer-card > button {
  width: 100%;
  min-height: 38px;
  font-size: 14px;
}
.pom-tool .timer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.pom-tool .timer-controls button {
  flex: 1 1 auto;
  width: auto;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 14px;
  white-space: nowrap;
}
.pom-tool .timer-controls button.comic-action {
  padding: 12px 14px;
}
.pom-tool .timer-controls .focus-action {
  flex-grow: 1.6;
}
.pom-tool .completion-prompt {
  margin: 10px 0;
  padding: 8px 12px;
  font-size: 14px;
}
.pom-tool .completion-prompt button {
  min-height: 36px;
  margin-top: 6px;
  padding: 4px 12px;
  font-size: 14px;
}
.pom-tool .pom-notes {
  margin-top: 12px;
}
.pom-tool .pom-notes select,
.pom-tool .pom-notes textarea {
  font-size: 14px;
}
.pom-tool .pom-notes textarea {
  margin-top: 6px;
}
.pom-tool .pom-notes > small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #6a6062;
}

/* Settings: rest length, test bell, notifications and full export. */
.pom-settings {
  margin-top: 12px;
  padding-top: 2px;
  border-top: 2px solid var(--ink);
  font-size: 14px;
}
.pom-tool .pom-settings > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0;
  color: #463f41;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}
.pom-tool .pom-settings > summary::-webkit-details-marker {
  display: none;
}
.pom-tool .pom-settings > summary::before {
  content: "▸";
  color: var(--red);
}
.pom-tool .pom-settings[open] > summary::before {
  content: "▾";
}
.pom-rest-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pom-rest-settings label {
  margin: 0 0 8px;
  font-size: 13px;
}
.pom-tool .pom-rest-settings input {
  min-height: 36px;
  padding: 4px 8px;
}
.pom-settings .timer-top-actions {
  gap: 6px;
  margin: 0 0 6px;
}
.pom-tool .pom-settings .timer-top-actions button {
  min-height: 36px;
  padding: 5px 10px;
  font-size: 13px;
}
.pom-settings .status,
.pom-settings .timer-sound-status {
  margin: 0 0 6px;
  font-size: 12.5px;
}

/* ---------- Record sheet ---------- */
.pom-tool .pom-sheet {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 30%);
}
.pom-tool .sheet-main,
.pom-tool .sheet-memo {
  padding: 14px 16px;
}
.pom-tool .sheet-main h2 {
  margin: 0 0 10px;
  padding: 0 0 6px;
  font-size: 20px;
}

/* Date + "before + today = total" + focus time in one strip. */
.sheet-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  margin: 0 0 12px;
}
.sheet-stats > div {
  min-width: 62px;
  padding: 2px 10px 4px;
  border: 1.5px solid var(--ink);
  background: #fff;
  text-align: center;
}
.sheet-stats dt {
  font-size: 11.5px;
  line-height: 1.5;
  color: #5a5153;
}
.sheet-stats dd {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.sheet-stats .stat-date dd,
.sheet-stats .stat-time dd {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.75;
}
.sheet-stats .stat-total {
  background: var(--ink);
  color: #fff;
  box-shadow: 2px 2px 0 var(--red);
}
.sheet-stats .stat-total dt {
  color: #ddd;
}
.sheet-stats .stat-op {
  align-self: center;
  font-weight: 900;
}
.sheet-stats .stat-time {
  margin-left: auto;
}

/* Section head: title left, small export on the right. */
.pom-tool .sheet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin: 0 0 4px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--ink);
}
.pom-tool .sheet-head h3 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 16px;
  text-align: left;
}
.pom-tool .sheet-head .status {
  flex-basis: 100%;
  margin: 0;
  font-size: 12px;
}
.pom-tool .export-mini {
  min-height: 28px;
  margin: 0;
  padding: 2px 10px;
  background: transparent;
  color: #5a5153;
  border: 1px solid #b3a9a3;
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
}
.pom-tool .export-mini:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  box-shadow: none;
  transform: none;
}
.pom-tool .sheet-block,
.pom-tool .sheet-urgent {
  margin-top: 14px;
}

/* Inline add forms: input, estimate and button on one row. */
.pom-tool .pom-add > summary {
  display: flex;
  align-items: center;
  width: fit-content;
  min-height: 34px;
  padding: 0;
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
  list-style: none;
}
.pom-tool .pom-add > summary::-webkit-details-marker {
  display: none;
}
.pom-tool .pom-add[open] {
  margin: 2px 0 8px;
  padding: 4px 8px 8px;
  background: #fff;
  border: 1px dashed var(--ink);
}
.pom-tool .pom-add > label,
.pom-tool .pom-add > button,
.pom-tool .timer-todo .pom-add > label {
  display: inline-block;
  vertical-align: bottom;
  min-height: 0;
  margin: 4px 6px 0 0;
}
/* The placeholder names the field; the label text stays for screen readers. */
.pom-tool .pom-add > label:not(.pom-estimate) {
  width: min(100%, 17rem);
  font-size: 0;
}
.pom-tool .todo-children .pom-add > label:not(.pom-estimate) {
  width: min(100%, 13rem);
}
.pom-tool .pom-add > label:not(.pom-estimate) :is(input, select) {
  font-size: 14px;
}
.pom-tool .pom-add > label + label:not(.pom-estimate) {
  width: auto;
}
.pom-tool .pom-add > label.pom-estimate,
.pom-tool .timer-todo .pom-add > label.pom-estimate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
}
.pom-tool .pom-add > label.pom-estimate input {
  width: 4rem;
}
.pom-tool .pom-add :is(input, select) {
  min-height: 38px;
  margin: 0;
  padding: 5px 8px;
}
.pom-tool .pom-add select {
  padding-right: 32px;
}
.pom-tool .pom-add > button {
  min-height: 38px;
  padding: 6px 14px;
  font-size: 14px;
}
.pom-tool .pom-add > :is(p, small):empty {
  display: none;
}
.pom-tool .pom-add > :is(p, small) {
  margin: 4px 0 0;
  font-size: 13px;
}

/* Task rows: [✓ name · actual] [estimate] [set current] on one line. */
.pom-tool .pom-sheet ol.todo-checklist {
  padding-left: 0;
}
.pom-tool .todo-checklist .timer-todo {
  padding: 6px 4px;
}
.pom-tool .sheet-block li.timer-todo {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 2px 8px;
}
.pom-tool .sheet-block .timer-todo > label:first-child {
  grid-column: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
  min-height: 36px;
  font-size: 15px;
  font-weight: 600;
}
.pom-tool .todo-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.pom-tool .todo-actual {
  color: #6a6062;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.pom-tool .sheet-block .timer-todo > .pom-estimate {
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #5a5153;
  margin: 0;
}
.pom-tool .sheet-block .timer-todo > .pom-estimate input {
  width: 3.2rem;
  min-height: 32px;
  padding: 2px 6px;
  font-size: 14px;
}
.pom-tool .todo-checklist .todo-pick {
  min-height: 32px;
  padding: 3px 10px;
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  font-size: 12.5px;
}
.pom-tool .todo-checklist .todo-pick:hover {
  background: var(--ink);
  color: #fff;
}
.todo-current-tag {
  padding: 2px 10px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  transform: skewX(-8deg);
  white-space: nowrap;
}
.pom-tool .timer-todo.is-current {
  background: #fdecec;
  box-shadow: inset 4px 0 0 var(--red);
}
.pom-tool .todo-children {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 16px;
  margin-inline-start: 26px;
  padding-inline-start: 8px;
}
.pom-tool .todo-children:empty {
  display: none;
}
.pom-tool .todo-children > details[open] {
  flex-basis: 100%;
}
.pom-tool .todo-children > details > summary {
  min-height: 30px;
  padding-block: 2px;
  font-size: 13px;
}
.pom-tool .todo-children .pom-add > summary {
  min-height: 30px;
  font-size: 13px;
}
.pom-tool .completed-tasks > summary {
  min-height: 36px;
  font-size: 14px;
}

/* Urgency check and memo lists. */
.pom-tool .sheet-urgent {
  padding: 10px 12px;
}
.pom-tool .sheet-urgent .timer-todo,
.pom-tool .sheet-memo .timer-todo {
  font-size: 14px;
}
.pom-tool .sheet-urgent .urgency-decisions button {
  min-height: 30px;
  padding: 2px 8px;
  font-size: 12.5px;
}
.pom-tool .sheet-urgent select {
  min-height: 34px;
  padding-block: 3px;
  font-size: 13px;
}
.pom-tool .sheet-memo .timer-todo small,
.pom-tool .sheet-urgent .timer-todo small {
  font-size: 12px;
}

/* ---------- Narrow screens ---------- */
@media (max-width: 760px) {
  .pom-tool .pom-sheet,
  .pom-tool .pom-sheet:has(.sheet-memo) {
    grid-template-columns: minmax(0, 1fr);
  }
  .pom-tool .sheet-memo {
    border-left: 0;
    border-top: 2px solid var(--ink);
  }
}
@media (max-width: 590px) {
  main:has(.pom-tool) {
    gap: 8px 12px;
    padding-top: 12px;
  }
  main:has(.pom-tool) > h1 {
    font-size: 24px;
  }
  main:has(.pom-tool) > .desc {
    display: none;
  }
  main:has(.pom-tool) > .panel {
    padding: 10px;
  }
  .pom-tool .pom-face {
    width: min(200px, 62%);
  }
  .pom-tool .pom-core .clock {
    font-size: 48px;
  }
  .pom-tool .sheet-main,
  .pom-tool .sheet-memo {
    padding: 10px;
  }
  .pom-tool .sheet-block li.timer-todo {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .pom-tool .sheet-block .timer-todo > label:first-child {
    grid-column: 1 / -1;
  }
  .sheet-stats .stat-date,
  .sheet-stats .stat-time {
    order: -1;
    flex: 1 1 calc(50% - 3px);
    margin-left: 0;
  }
  .sheet-stats > div:not(.stat-date, .stat-time) {
    flex: 1 1 0;
    min-width: 56px;
  }
  .pom-tool .todo-children {
    margin-inline-start: 12px;
  }
}
