/* Next Block — calm operator focus UI */
:root {
  --ink: #121416;
  --ink-soft: #2a2e33;
  --paper: #f3efe6;
  --paper-2: #e8e2d4;
  --mist: #c9c2b2;
  --line: rgba(18, 20, 22, 0.1);
  --copper: #c46b3a;
  --copper-deep: #9a4f28;
  --sage: #4f6b5a;
  --sage-soft: #d6e4db;
  --danger: #a33b3b;
  --shadow: 0 18px 50px rgba(18, 20, 22, 0.12);
  --radius: 18px;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-ui: "Outfit", system-ui, sans-serif;
  --ring-size: min(280px, 72vw);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(196, 107, 58, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(79, 107, 90, 0.1), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body {
  padding: 20px 16px 40px;
}

#app {
  max-width: 1100px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    conic-gradient(from 210deg, var(--copper), var(--sage), var(--paper-2), var(--copper));
  box-shadow: inset 0 0 0 6px var(--paper), var(--shadow);
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0.72;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab.is-active {
  background: var(--ink);
  color: var(--paper);
}

.tab:focus-visible,
.btn:focus-visible,
.chip:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

.view[hidden] {
  display: none !important;
}

.focus-layout {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 22px;
}

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

.timer-panel,
.plan-panel,
.card {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.custom-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: -4px 0 16px;
}

.custom-row.is-hidden {
  display: none;
}

.custom-row label {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.custom-row input {
  width: 72px;
}

.ring-wrap {
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
  margin: 8px auto 20px;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track,
.ring-progress {
  fill: none;
  stroke-width: 5.5;
}

.ring-track {
  stroke: rgba(18, 20, 22, 0.08);
}

.ring-progress {
  stroke: var(--copper);
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.35s linear, stroke 0.2s ease;
}

.ring-wrap.is-break .ring-progress {
  stroke: var(--sage);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.phase-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--copper-deep);
}

.ring-wrap.is-break .phase-label {
  color: var(--sage);
}

.clock {
  margin: 6px 0 4px;
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.clock-sub {
  margin: 0;
  max-width: 16ch;
  font-size: 0.9rem;
  color: var(--ink-soft);
  opacity: 0.85;
}

.timer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 550;
  font-size: 0.92rem;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover:not(:disabled) {
  background: var(--ink-soft);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.55);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.84rem;
}

.btn-danger {
  color: var(--danger);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2,
.card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.goal-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.block-plan {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
}

.plan-item.is-current {
  border-color: rgba(196, 107, 58, 0.45);
  box-shadow: inset 0 0 0 1px rgba(196, 107, 58, 0.2);
  background: rgba(255, 248, 240, 0.85);
}

.plan-item.is-done {
  opacity: 0.55;
}

.plan-item.is-done .plan-title {
  text-decoration: line-through;
}

.plan-index {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--paper-2);
  color: var(--ink-soft);
}

.plan-item.is-current .plan-index {
  background: var(--copper);
  color: white;
}

.plan-title {
  margin: 0;
  font-weight: 550;
}

.plan-meta {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  opacity: 0.85;
}

.plan-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-actions button {
  border: 0;
  background: transparent;
  color: var(--copper-deep);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  text-align: right;
}

.empty-plan {
  padding: 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px dashed var(--mist);
}

.empty-plan.is-hidden {
  display: none;
}

.empty-plan p {
  margin: 0 0 6px;
}

.up-next {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.up-next-text {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.hint,
.muted {
  color: var(--ink-soft);
  opacity: 0.8;
}

.hint {
  margin: 16px 0 0;
  font-size: 0.86rem;
}

.library-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 22px;
}

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

.entity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entity-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.entity-item h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 550;
}

.entity-item p {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.entity-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.entity-actions button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

.entity-actions .del {
  color: var(--danger);
}

.inline-form,
.stack-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inline-form.is-hidden,
.stack-form.is-hidden {
  display: none;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
}

input[type="text"],
input[type="number"],
select {
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.check-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
}

.form-actions {
  display: flex;
  gap: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  text-align: center;
}

.stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
}

.stat span {
  font-size: 0.78rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.footer {
  margin-top: 28px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-soft);
  opacity: 0.65;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 40;
  max-width: min(90vw, 420px);
  text-align: center;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
