:root{
  --bg0: #07080b;
  --bg1: #0b0c10;
  --bg2: #10121a;

  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.60);
  --muted2: rgba(255,255,255,0.42);

  --hairline: rgba(255,255,255,0.10);
  --hairline2: rgba(255,255,255,0.14);

  --glass: rgba(16,18,26,0.72);
  --glass2: rgba(16,18,26,0.86);

  --shadow: 0 20px 50px rgba(0,0,0,0.55);
  --shadow-soft: 0 12px 34px rgba(0,0,0,0.45);
  --shadow-tiny: 0 4px 14px rgba(0,0,0,0.45);

  --radius: 14px;
  --radius-lg: 18px;

  --grid: rgba(255,255,255,0.05);
  --grid-strong: rgba(255,255,255,0.07);

  --accent: #0a84ff;
  --accent-weak: rgba(10,132,255,0.18);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1200px 650px at 18% -10%, rgba(10,132,255,0.18), transparent 55%),
    radial-gradient(900px 600px at 85% 0%, rgba(191,90,242,0.16), transparent 55%),
    radial-gradient(1100px 700px at 70% 115%, rgba(52,199,89,0.10), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 35%, var(--bg2));
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Segoe UI, Roboto, Arial;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection{ background: rgba(10,132,255,0.25); }

.topbar{
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--glass);
  border-bottom: 1px solid var(--hairline);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 10px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.brand__dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(10,132,255,0.10), 0 10px 30px rgba(10,132,255,0.18);
}

.brand__text{
  font-weight: 700;
  letter-spacing: -0.2px;
  color: rgba(255,255,255,0.92);
}

.actions{
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn{
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  color: rgba(255,255,255,0.90);
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, var(--shadow-tiny);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover{
  border-color: rgba(255,255,255,0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.05));
}

.btn:active{ transform: translateY(1px); }

.btn:focus-visible{
  outline: none;
  border-color: rgba(10,132,255,0.55);
  box-shadow:
    0 0 0 4px var(--accent-weak),
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 14px 34px rgba(0,0,0,0.55);
}

.btn-ghost{
  background: rgba(255,255,255,0.03);
}

.btn__icon{
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
}

.btn__label{
  font-size: 13px;
  font-weight: 600;
}

.stage{
  height: calc(100% - 60px);
}

.canvas{
  position: relative;
  width: 100%;
  height: 100%;
  user-select: none;

  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 80px 80px;
  background-position: 0px 0px;
}

.canvas::before{
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 50% 5%, rgba(255,255,255,0.05), transparent 62%),
    radial-gradient(1400px 900px at 50% 112%, rgba(0,0,0,0.55), transparent 55%);
  opacity: 0.75;
}

.world{
  position: absolute;
  left: 0; top: 0;
  width: 8000px;
  height: 5000px;
  transform-origin: 0 0;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.45) inset;
}

/* Task card */
.task{
  position: absolute;
  width: 300px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(17,19,28,0.70);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
  --task-accent: var(--accent);
}

.task:hover{
  box-shadow: var(--shadow);
  border-color: rgba(255,255,255,0.14);
}

.task.selected{
  border-color: color-mix(in srgb, var(--task-accent) 55%, rgba(255,255,255,0.18));
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--task-accent) 18%, transparent),
    var(--shadow);
}

.task__bar{
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 12px;
  cursor: grab;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.task__bar:active{ cursor: grabbing; }

.task__color{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: var(--task-accent);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.25);
  cursor: pointer;
}

.task__titleInput{
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: rgba(255,255,255,0.92);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.1px;
  padding: 6px 8px;
  border-radius: 10px;
}

.task__titleInput:focus{
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--task-accent) 25%, transparent);
  background: rgba(0,0,0,0.10);
}

.task__x{
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  color: rgba(255,255,255,0.70);
  font-size: 18px;
  line-height: 1;
  transition: background .12s ease, transform .12s ease, color .12s ease;
}

.task__x:hover{
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.88);
}
.task__x:active{ transform: scale(0.96); }

.task__text{
  width: 100%;
  height: 170px;
  border: none;
  outline: none;
  resize: none;

  padding: 12px 12px 14px;
  font-size: 14px;
  line-height: 1.35;
  color: rgba(255,255,255,0.90);
  background: transparent;

  overflow: auto;
  user-select: text;

  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge legacy */
}
.task__text::-webkit-scrollbar{ width: 0; height: 0; } /* WebKit */

.task__text::placeholder{ color: rgba(255,255,255,0.40); }

/* Color palette popover */
.palette{
  position: absolute;
  left: 10px;
  top: 46px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(12,14,20,0.92);
  box-shadow: 0 18px 45px rgba(0,0,0,0.60);
  display: grid;
  grid-template-columns: repeat(6, 18px);
  gap: 10px;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.palette[hidden]{ display: none; }

.swatch{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: var(--swatch);
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(0,0,0,0.28);
  transition: transform .12s ease, border-color .12s ease;
}

.swatch:hover{
  transform: scale(1.06);
  border-color: rgba(255,255,255,0.26);
}

.swatch:active{ transform: scale(0.98); }