:root {
  --primary: #3CA199;
  --secondary: #964890;
  --dark: #1A1A1C;
  --light: #FEFEFE;
  --gray: #626364;
  --soft-gray: #9D9D9E;
  --ok: #2da364;
  --warn: #d9a328;
  --bad: #d84a4a;

  --border: 4px;
  --shadow-x: 8px;
  --shadow-y: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--light);
  color: var(--dark);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  position: relative;
  overflow-x: hidden;
}

.display {
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1;
}

.display--bold {
  font-weight: 700;
}

.display--black {
  font-weight: 900;
}

.italic {
  font-style: italic;
}

.comic-border {
  border: var(--border) solid var(--dark);
}

.shadow-comic {
  box-shadow: var(--shadow-x) var(--shadow-y) 0 0 var(--dark);
}

.comic-panel {
  border: var(--border) solid var(--dark);
  background: var(--light);
  box-shadow: var(--shadow-x) var(--shadow-y) 0 0 var(--dark);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.comic-panel:hover {
  transform: translate(-1px, -1px) rotate(-0.4deg);
  box-shadow: 12px 12px 0 0 var(--dark);
}

.bg-halftone,
.bg-speed-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.bg-halftone {
  background-image: radial-gradient(var(--dark) 1.3px, transparent 0);
  background-size: 18px 18px;
  opacity: 0.06;
}

.bg-speed-lines {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 20px,
    rgba(26, 26, 28, 0.03) 20px,
    rgba(26, 26, 28, 0.03) 21px
  );
  z-index: -1;
}

.app-shell {
  width: min(1400px, calc(100% - 2rem));
  margin: 1rem auto 2rem;
  display: grid;
  gap: 1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.2rem;
}

.topbar h1 {
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  margin: 0.2rem 0 0;
}

.kicker {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--gray);
}

.topbar-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stat-pill {
  border: 3px solid var(--dark);
  background: #fff;
  padding: 0.4rem 0.65rem;
  font-weight: 700;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
  align-items: start;
}

.panel {
  padding: 1rem;
}

.timer-panel {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.session-panel {
  grid-column: 2;
  grid-row: 1;
}

.backlog-panel {
  grid-column: 1;
  grid-row: 3;
}

.progress-panel {
  grid-column: 2;
  grid-row: 2 / span 2;
}

.timer-type {
  margin: 0.6rem 0 0;
  font-size: 1.1rem;
  color: var(--secondary);
}

.timer-clock {
  margin: 0.4rem 0;
  font-size: clamp(3.2rem, 10vw, 7.6rem);
}

.timer-task {
  margin: 0 0 1rem;
  font-weight: 600;
}

.timer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.panel-title {
  margin: 0;
  font-size: 1.25rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  align-items: end;
}

.settings-grid h2 {
  grid-column: 1 / -1;
  margin-top: 0.2rem;
}

label,
.muted {
  font-size: 0.9rem;
  color: var(--gray);
}

input,
select {
  width: 100%;
  margin-top: 0.3rem;
  border: 3px solid var(--dark);
  background: #fff;
  border-radius: 0;
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  font-size: 0.98rem;
  font-family: Inter, system-ui, sans-serif;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.session-limit {
  margin: 0;
  font-weight: 800;
  font-family: "Space Grotesk", Inter, sans-serif;
  border: 3px solid var(--dark);
  padding: 0.3rem 0.5rem;
}

.inline-form,
.backlog-form {
  display: grid;
  gap: 0.55rem;
}

.backlog-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0.7rem;
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0.7rem 0 0;
  display: grid;
  gap: 0.55rem;
}

.task-item {
  background: #fff;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.task-item.is-done .task-text {
  text-decoration: line-through;
  color: var(--soft-gray);
}

.task-main {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  min-width: 0;
}

.task-check {
  width: 24px;
  min-height: 24px;
  margin: 0;
}

.task-text {
  font-weight: 600;
  line-height: 1.3;
}

.task-meta {
  grid-column: 1;
  font-size: 0.78rem;
  color: var(--gray);
}

.task-actions {
  display: flex;
  gap: 0.35rem;
}

.task-btn {
  border: 3px solid var(--dark);
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 1rem;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.task-btn:hover {
  background: var(--primary);
  color: #fff;
}

.task-priority {
  padding: 0.1rem 0.45rem;
  border: 2px solid var(--dark);
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
}

.priority-alta {
  background: #ffdbdb;
}

.priority-media {
  background: #fff3d6;
}

.priority-baixa {
  background: #dff6ef;
}

.session-actions {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

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

.metric-card {
  border: 3px solid var(--dark);
  background: #fff;
  padding: 0.55rem;
}

.metric-card p {
  margin: 0;
}

.metric-card strong {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: 1.4rem;
}

.progress-map {
  margin-top: 0.8rem;
  min-height: 130px;
  border: 3px dashed var(--dark);
  padding: 0.6rem;
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

.progress-block {
  border: 3px solid var(--dark);
  padding: 0.45rem 0.6rem;
  background: #fff;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.progress-block--ok {
  background: #daf4e7;
}

.progress-block--partial {
  background: #fff2cf;
}

.progress-block--bad {
  background: #ffdede;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.72rem 1rem;
  border: var(--border) solid var(--dark);
  box-shadow: var(--shadow-x) var(--shadow-y) 0 0 var(--dark);
  background: #fff;
  color: var(--dark);
  font-family: "Space Grotesk", Inter, sans-serif;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.btn:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 0 var(--dark);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--dark);
}

.btn--secondary:hover {
  background: var(--secondary);
  color: #fff;
}

.btn--tertiary {
  border-width: 0;
  box-shadow: none;
  background: transparent;
  color: var(--dark);
  border-bottom: 4px solid var(--dark);
  padding-inline: 0.2rem;
}

.btn--tertiary:active {
  transform: translate(0, 2px);
}

.session-dialog {
  width: min(560px, calc(100% - 1.5rem));
  border: var(--border) solid var(--dark);
  box-shadow: 10px 10px 0 0 var(--dark);
}

.session-dialog::backdrop {
  background: rgba(0, 0, 0, 0.48);
}

.session-dialog__body {
  padding: 1rem;
}

.session-dialog__body h2 {
  margin: 0;
}

.session-dialog__actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.drop-target {
  outline: 3px dashed var(--secondary);
  outline-offset: 2px;
}

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

  .timer-panel,
  .session-panel,
  .backlog-panel,
  .progress-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .backlog-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: calc(100% - 1rem);
    margin-top: 0.55rem;
  }

  .topbar {
    padding: 0.8rem;
    flex-direction: column;
    align-items: stretch;
  }

  .panel {
    padding: 0.8rem;
  }

  .settings-grid,
  .backlog-form,
  .progress-metrics {
    grid-template-columns: 1fr;
  }

  .timer-clock {
    font-size: clamp(2.6rem, 19vw, 4.2rem);
  }
}
