:root {
  --ink: #243041;
  --muted: #667085;
  --paper: #fffdf6;
  --line: #d9e2e7;
  --sky: #dff4ff;
  --grass: #b9df79;
  --coral: #ff786f;
  --yellow: #ffd45d;
  --green: #72c6a6;
  --blue: #65a9ff;
  --violet: #a184d8;
  --rose: #f59ab2;
  --shadow: 0 14px 36px rgba(33, 45, 62, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #fff8df 0 140px, #f4fbf9 140px 100%);
  color: var(--ink);
  font-family:
    "Comic Sans MS",
    "Microsoft YaHei",
    "PingFang SC",
    system-ui,
    sans-serif;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

button,
input,
a {
  font: inherit;
}

button,
.file-button {
  min-height: 44px;
  border: 2px solid #243041;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 4px 0 #243041;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
}

button:hover,
.file-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #243041;
}

button:active,
.file-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #243041;
}

button:disabled,
button:disabled:hover,
button:disabled:active {
  cursor: not-allowed;
  opacity: 0.38;
  transform: none;
  box-shadow: 0 4px 0 #243041;
}

button:focus-visible,
.file-button:focus-within {
  outline: 4px solid rgba(101, 169, 255, 0.35);
  outline-offset: 2px;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 260px;
  gap: 12px;
}

.brand h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.mascot {
  position: relative;
  width: 58px;
  height: 58px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 5px 0 var(--ink);
}

.mascot::before,
.mascot::after {
  content: "";
  position: absolute;
  top: 17px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

.mascot::before {
  left: 15px;
}

.mascot::after {
  right: 15px;
}

.mascot-face {
  position: absolute;
  left: 50%;
  bottom: 13px;
  width: 22px;
  height: 12px;
  border-bottom: 3px solid var(--ink);
  border-radius: 0 0 18px 18px;
  transform: translateX(-50%);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  text-decoration: none;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 16px;
  align-items: start;
}

.dashboard > * {
  min-width: 0;
}

.stage {
  grid-column: 1 / -1;
}

.scene {
  position: relative;
  height: 180px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(180deg, var(--sky) 0 62%, #def5c9 62% 100%);
  box-shadow: var(--shadow);
}

.sun {
  position: absolute;
  top: 20px;
  right: 38px;
  width: 54px;
  height: 54px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
}

.cloud {
  position: absolute;
  width: 86px;
  height: 28px;
  border: 3px solid var(--ink);
  border-radius: 28px;
  background: #ffffff;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  bottom: 12px;
  border: 3px solid var(--ink);
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  background: #ffffff;
}

.cloud::before {
  left: 12px;
  width: 28px;
  height: 24px;
}

.cloud::after {
  right: 15px;
  width: 32px;
  height: 30px;
}

.cloud-a {
  top: 34px;
  left: 70px;
}

.cloud-b {
  top: 58px;
  left: 42%;
  transform: scale(0.82);
}

.hills {
  position: absolute;
  left: -40px;
  right: -40px;
  bottom: 34px;
  height: 70px;
  background:
    radial-gradient(circle at 18% 95%, var(--grass) 0 95px, transparent 96px),
    radial-gradient(circle at 48% 105%, #91d37f 0 130px, transparent 131px),
    radial-gradient(circle at 80% 100%, #c8e77f 0 110px, transparent 111px);
}

.track {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 32px;
  height: 12px;
  border-top: 4px solid var(--ink);
  border-bottom: 4px solid var(--ink);
}

.track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 22px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 28px,
    rgba(36, 48, 65, 0.28) 28px 34px
  );
}

.train {
  position: absolute;
  left: 28px;
  bottom: 50px;
  display: flex;
  align-items: center;
  width: 230px;
  height: 58px;
  transform: translateX(0);
  transition: transform 420ms ease;
}

.bullet-train {
  filter: drop-shadow(0 5px 0 var(--ink));
}

.train-nose,
.train-body,
.train-tail {
  position: relative;
  border: 3px solid var(--ink);
  background: #f7fbff;
}

.train-nose {
  width: 72px;
  height: 48px;
  border-right: 0;
  border-radius: 48px 10px 8px 48px;
  transform: skewX(-14deg);
}

.train-nose::before {
  content: "";
  position: absolute;
  right: 11px;
  top: 8px;
  width: 30px;
  height: 12px;
  border: 3px solid var(--ink);
  border-radius: 999px 6px 6px 999px;
  background: #8bcaee;
}

.train-nose::after,
.train-body::after,
.train-tail::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9px;
  height: 7px;
  background: var(--blue);
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
}

.train-body {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  width: 126px;
  height: 48px;
  border-left: 0;
  border-right: 0;
  padding: 9px 8px 0;
}

.train-body span {
  width: 18px;
  height: 12px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: #8bcaee;
}

.train-tail {
  width: 36px;
  height: 48px;
  border-left: 0;
  border-radius: 4px 10px 10px 4px;
}

.train-tail::before {
  content: "";
  position: absolute;
  right: 7px;
  top: 9px;
  width: 11px;
  height: 11px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
}

.timeline {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-height: 76px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.time-slice {
  position: relative;
  min-width: 92px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--slice-color, #ffffff);
  box-shadow: 0 4px 0 var(--ink);
  padding: 8px;
  overflow: hidden;
}

.time-slice.current {
  outline: 4px solid rgba(255, 120, 111, 0.34);
}

.time-slice.done {
  opacity: 0.68;
}

.time-slice strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-slice span {
  display: block;
  margin-top: 4px;
  color: rgba(36, 48, 65, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.focus-panel,
.plan-panel {
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.focus-panel {
  padding: 18px;
}

.phase-row,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--green);
  font-size: 14px;
  font-weight: 900;
}

.clock-range {
  color: var(--muted);
  font-weight: 800;
}

.time-settings {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #ffffff;
}

.time-row,
.time-settings > * {
  min-width: 0;
}

.time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 120px);
  gap: 10px;
  align-items: end;
  width: 100%;
}

.time-end-row {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 168px);
  align-items: stretch;
}

.time-locked-hint {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff4c9;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 900;
}

.time-field,
.time-lock {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.time-field {
  min-width: 0;
}

.time-field input {
  min-height: 42px;
  width: 100%;
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 900;
}

.time-field input:disabled {
  opacity: 0.48;
}

.time-lock {
  align-self: stretch;
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}

.time-lock input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.time-settings button {
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  background: var(--green);
}

.focus-panel h2 {
  min-height: 76px;
  margin: 16px 0 10px;
  font-size: 32px;
  line-height: 1.18;
  letter-spacing: 0;
}

.timer-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: 16px;
  align-items: center;
}

.timer-face {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--paper) 0 59%, transparent 60%),
    conic-gradient(var(--coral) calc(var(--fill) * 1%), #e7edf0 0);
  box-shadow: 0 7px 0 var(--ink);
  text-align: center;
}

.timer-face.overtime {
  background:
    radial-gradient(circle at center, var(--paper) 0 59%, transparent 60%),
    conic-gradient(var(--rose) 0 100%);
}

.timer-face strong {
  display: block;
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
}

.timer-face span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.stats {
  display: grid;
  gap: 10px;
}

.stats div {
  min-height: 64px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stats strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
  line-height: 1.1;
}

.bar-shell {
  height: 22px;
  margin: 18px 0;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #ffffff;
  overflow: hidden;
}

.segment-bar {
  width: 0%;
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    var(--blue) 0 14px,
    #8cc2ff 14px 28px
  );
  transition: width 200ms linear;
}

.overtime-notice {
  margin-bottom: 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #ffe5e1;
  padding: 10px 12px;
  color: #73322d;
  font-weight: 900;
}

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

.actions button {
  padding: 0 10px;
}

.actions .primary {
  background: var(--yellow);
}

.plan-panel {
  padding: 14px;
}

.panel-head {
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.panel-head span {
  color: var(--muted);
  font-weight: 900;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-actions button {
  min-width: 44px;
  padding: 0;
  background: var(--yellow);
  font-size: 24px;
  line-height: 1;
}

.task-list {
  display: grid;
  max-height: 510px;
  overflow: auto;
  gap: 10px;
  padding-right: 3px;
}

.task-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 88px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.task-card.current {
  background: #fff4c9;
}

.task-card.done {
  background: #e6f6ee;
}

.task-icon {
  display: grid;
  place-items: center;
  align-self: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--slice-color, var(--blue));
  color: var(--ink);
  font-weight: 900;
}

.task-card h3 {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0;
}

.task-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.task-duration {
  min-width: 54px;
  color: var(--ink);
  font-weight: 900;
  text-align: right;
}

.task-controls {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  gap: 6px;
}

.task-controls button {
  min-height: 32px;
  padding: 0 8px;
  border-width: 2px;
  border-radius: 7px;
  box-shadow: 0 3px 0 var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.task-controls button:hover:not(:disabled) {
  box-shadow: 0 4px 0 var(--ink);
}

.add-task-card {
  min-height: 54px;
  border-style: dashed;
  background: #eef8ff;
}

.panel-head button {
  padding: 0 12px;
}

.message-box {
  min-height: 24px;
  margin-top: 10px;
  color: #2f6c54;
  font-size: 14px;
  font-weight: 900;
}

.message-box.error {
  color: #9d312b;
}

.compress-dialog,
.task-dialog {
  width: min(620px, calc(100vw - 28px));
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.compress-dialog::backdrop,
.task-dialog::backdrop {
  background: rgba(36, 48, 65, 0.42);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

#closeCompressButton,
#cancelTaskButton {
  min-width: 44px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.compress-dialog p {
  margin: 12px 0;
  color: var(--muted);
  font-weight: 800;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 900;
}

.field input {
  min-height: 46px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 800;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--ink);
  font-weight: 900;
}

.check-field input {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
}

.compress-options {
  display: grid;
  gap: 10px;
}

.compress-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  text-align: left;
}

.compress-option strong {
  display: block;
  overflow-wrap: anywhere;
}

.compress-option span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.empty-state {
  border: 2px dashed #8ca0ad;
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 1080px) {
  .dashboard {
    grid-template-columns: 1fr 1fr;
  }

  .focus-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
  }

  .topbar {
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .toolbar button,
  .file-button {
    flex: 1 1 calc(50% - 6px);
  }

  .dashboard {
    grid-template-columns: 1fr;
  }

  .scene {
    height: 150px;
  }

  .cloud-b {
    display: none;
  }

  .focus-panel h2 {
    min-height: auto;
    font-size: 26px;
  }

  .timer-layout {
    grid-template-columns: 1fr;
  }

  .time-settings {
    grid-template-columns: 1fr;
  }

  .time-row,
  .time-end-row {
    grid-template-columns: 1fr;
  }

  .time-lock {
    min-height: 42px;
  }

  .timer-face {
    max-width: 240px;
    justify-self: center;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }

  .task-list {
    max-height: none;
  }

  .task-controls {
    grid-template-columns: repeat(3, minmax(42px, 1fr));
  }
}

@media (max-width: 430px) {
  .brand h1 {
    font-size: 26px;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .phase-row,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-actions {
    justify-content: space-between;
  }

  .task-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .task-duration {
    grid-column: 2;
    text-align: left;
  }

  .task-controls {
    grid-column: 1 / -1;
  }

  .timer-face strong {
    font-size: 36px;
  }
}
