/* ==========================================================================
   Set the Mood — overlay UI styles (fresh implementation, no frameworks)
   Ground #0b0f1a · glass cards · cyan accents · Outfit + DM Mono
   ========================================================================== */

/* ── tokens ─────────────────────────────────────────────────────────────── */
:root {
  --font: Outfit, Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, Menlo, monospace;

  --bg: #0b0f1a;
  --fg: #eef2fa;
  --mute: #9ea8c2;
  --cyan: #7fe3ff;
  --amber: #ffb454;

  --glass: linear-gradient(150deg, #141a2ae8, #0d1220e3);
  --chip: #0d1220c4;
  --panel-soft: #0d1220b0;
  --panel: #0e1220c8;
  --panel-strong: #0e1220e6;
  --panel-dim: #0e1220b8;
  --tip-bg: #0b1020e8;
  --dialog-bg: #101526;

  --shadow: 0 18px 50px -20px #000b;
  --radius-card: 16px;

  --ease-pop: cubic-bezier(.2, 1.5, .3, 1);
  --ease-bar: cubic-bezier(.2, .8, .2, 1);
  --ease-slot: cubic-bezier(.2, 1.6, .3, 1);
}

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

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

:root {
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

button, a { -webkit-tap-highlight-color: transparent; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

img, svg, canvas { display: block; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── app shell ──────────────────────────────────────────────────────────── */
#app {
  position: fixed;
  inset: 0;
  isolation: isolate;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#world {
  position: absolute;
  inset: 0;
  z-index: -3;
}

#world canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: default;
}

#loading {
  position: absolute;
  top: 47%;
  width: 100%;
  text-align: center;
  color: var(--mute);
  font-size: 14px;
  pointer-events: none;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, #070a13a8, transparent 26%),
    linear-gradient(270deg, #070a1390, transparent 22%),
    radial-gradient(ellipse at 52% 48%, transparent 55%, #04060cb0 100%);
}

/* ── shared card / card header ──────────────────────────────────────────── */
.card {
  border-radius: var(--radius-card);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 0 3px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--mute);
}

.h em {
  font: 400 10px var(--mono);
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
  color: #7d87a4;
}

.clock {
  font: 500 12px var(--mono);
  color: #fff;
  letter-spacing: 0;
  text-transform: none;
}

/* ── left column ────────────────────────────────────────────────────────── */
.side {
  position: absolute;
  left: 24px;
  top: 22px;
  width: 292px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 11px;
  pointer-events: none;
}

.side > * { pointer-events: auto; }

.brand {
  pointer-events: none;
  text-shadow: 0 2px 18px #000a;
}

.brand h1 {
  margin: 0;
  font-weight: 800;
  line-height: .92;
  letter-spacing: -.5px;
  text-transform: uppercase;
}

.brand h1 span {
  display: block;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .6px;
  color: #dfe6f5;
}

.brand h1 b {
  display: block;
  font-size: 37px;
  font-weight: 800;
  color: var(--cyan);
}

.brand small {
  display: block;
  margin-top: 9px;
  max-width: 27em;
  font-size: 12.5px;
  line-height: 1.5;
  color: #c7cee0;
  font-weight: 400;
}

.moods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mood {
  padding: 7px 8px;
  border-radius: 12px;
  background: var(--chip);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  text-align: left;
  transition: background .2s, color .2s, transform .25s var(--ease-pop);
}

.mood:hover {
  background: #1a2133e6;
  transform: translateY(-1px);
}

.mood.on {
  background: #eef4ff;
  color: #101626;
}

.mood .pal {
  display: flex;
  height: 15px;
  margin-bottom: 6px;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 3px 8px -4px #0009;
}

.mood .pal i { flex: 1; }

.mood b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.1px;
}

.mood small {
  display: block;
  margin-top: 2px;
  font: 500 9.5px/1.2 var(--mono);
  color: #8d97b3;
}

.mood.on small { color: #56607a; }

.meter { display: flex; gap: 6px; }

.stat {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 9px 7px;
  border-radius: 10px;
  background: var(--chip);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.stat i {
  display: block;
  font: 500 9px/1 var(--mono);
  font-style: normal;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8d97b3;
}

.stat b {
  display: block;
  margin-top: 4px;
  font: 500 15px/1 var(--mono);
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.stat u {
  display: block;
  height: 3px;
  margin-top: 6px;
  border-radius: 2px;
  background: #ffffff14;
  overflow: hidden;
}

.stat u span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: #aeb7cc;
  transition: width .6s var(--ease-bar);
}

.stat.top b { color: var(--cyan); }
.stat.top u span { background: var(--cyan); }

.why {
  margin: 0;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--panel-soft);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 12px;
  line-height: 1.5;
  color: #c3cadc;
  min-height: 3.6em;
}

.why b { color: #fff; font-weight: 600; }
.why .c { color: var(--cyan); }
.why .a { color: var(--amber); }

/* moodboard */
.board { padding: 10px 8px 9px; }

.slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 6px;
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px 2px 4px;
  border-radius: 11px;
  text-align: center;
  transition: background .2s;
}

.slot:hover { background: #ffffff0c; }
.slot.sel { background: #ffffff1c; }
.slot.drop { background: #7fe3ff26; }

.slot canvas {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  box-shadow: 0 7px 14px -7px #000e;
  transition: transform .25s var(--ease-pop);
}

.slot:hover canvas { transform: translateY(-2px); }
.slot.pop canvas { animation: slot-pop .5s var(--ease-slot); }

@keyframes slot-pop {
  0% { transform: scale(.7) rotate(-6deg); }
  to { transform: none; }
}

.slot i {
  font: 500 8.5px/1 var(--mono);
  font-style: normal;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #8891ab;
  white-space: nowrap;
}

.slot span {
  display: block;
  max-width: 66px;
  min-height: 2.3em;
  font-size: 10.5px;
  line-height: 1.15;
  color: #e3e8f4;
}

/* ── toolbar ────────────────────────────────────────────────────────────── */
.tools {
  position: absolute;
  right: 24px;
  top: 22px;
  z-index: 5;
  display: flex;
  gap: 6px;
}

.tools button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #dfe4f3;
  box-shadow: 0 8px 20px -10px #000b;
  transition: background .15s, opacity .2s;
}

.tools button:hover:not(:disabled) { background: #1c2336f0; }
.tools button.on { background: #eef4ff; color: #141a2c; }
.tools button:disabled { opacity: .35; cursor: default; }

.tools button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#notes .off,
#notes[aria-pressed="false"] .on { display: none; }

#notes[aria-pressed="false"] .off { display: inline; }

.tools .sep { width: 4px; }

/* ── daylight card ──────────────────────────────────────────────────────── */
.light {
  position: absolute;
  right: 24px;
  top: 70px;
  width: 232px;
  padding: 10px 10px 11px;
  z-index: 4;
}

.times {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.time {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px;
  border-radius: 12px;
  text-align: left;
  transition: background .2s;
}

.time:hover { background: #ffffff0e; }
.time.on { background: #ffffff1f; }

.time svg {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0 2px 0 4px;
  fill: none;
  stroke: #e8edf8;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.time .th {
  position: relative;
  flex: none;
  width: 118px;
  height: 66px;
  border-radius: 9px;
  overflow: hidden;
  background: #141a28;
  box-shadow: 0 6px 14px -8px #000d;
}

.time .th canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
}

.time > div:last-child { min-width: 0; }

.time b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}

.time small {
  display: block;
  margin-top: 2px;
  font: 500 10px var(--mono);
  color: #8d97b3;
}

/* time slider */
.tslide {
  position: relative;
  height: 30px;
  margin: 10px 5px 0;
  cursor: pointer;
  touch-action: none;
}

.tslide .tr {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 6px;
  border-radius: 4px;
  box-shadow: inset 0 1px 2px #0006;
  background: linear-gradient(90deg,
    #27407e 0%, #e98c6a 5%, #ffd7a4 13.9%, #fff4e2 40.6%, #ffe0b0 61.1%,
    #ffab5e 72.2%, #c7657a 78.3%, #3e5aa8 86.1%, #1c2a58 100%);
}

.tslide .kn {
  position: absolute;
  top: 7px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fdfdff, #c3cadb);
  box-shadow: 0 3px 8px #0009;
}

.tslide .tk {
  position: absolute;
  top: 22px;
  width: 1px;
  height: 5px;
  background: #ffffff40;
}

/* ── tray ───────────────────────────────────────────────────────────────── */
.tray {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 4;
  min-width: 420px;
  max-width: calc(100vw - 520px);
  padding: 8px 10px 9px;
}

.tmini { display: none; }

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 7px;
  flex-wrap: nowrap;
}

.tabs button {
  height: 26px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  color: #b3bbcf;
  white-space: nowrap;
  transition: background .15s, color .15s, opacity .2s;
}

.tabs button:hover { background: #ffffff10; color: #fff; }
.tabs button.on { background: #eef4ff; color: #101626; }

.tabs button.off {
  opacity: .3;
  pointer-events: none;
}

.tabs .div {
  width: 1px;
  height: 16px;
  margin: 0 6px;
  background: #ffffff1c;
}

.tabs .for {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding-left: 12px;
  font: 500 10.5px var(--mono);
  color: var(--cyan);
  white-space: nowrap;
}

.tabs .for.on { display: flex; }

.tabs .for button {
  width: 20px;
  height: 20px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #7fe3ff22;
  color: var(--cyan);
  font-size: 13px;
  line-height: 1;
}

.items {
  display: flex;
  gap: 6px;
  padding: 4px 2px 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.items::-webkit-scrollbar { display: none; }

.it {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 70px;
  padding: 3px 0 4px;
  border-radius: 12px;
  cursor: grab;
  touch-action: pan-x;
  transition: background .2s;
}

.it:hover { background: #ffffff0a; }
.it:active { cursor: grabbing; }

.it canvas {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  box-shadow: 0 8px 16px -8px #000e;
  transition: transform .3s var(--ease-pop);
}

.it:hover canvas { transform: translateY(-4px) rotate(-2.5deg); }

.it.fur { width: 84px; }

.it.fur canvas {
  width: 80px;
  height: 60px;
  border-radius: 14px;
  box-shadow: none;
  background: radial-gradient(ellipse at 50% 62%, #ffffff1f, #ffffff08 55%, transparent 75%);
}

.it span {
  max-width: 84px;
  font-size: 10.5px;
  color: #c9d0e2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.it.cur span { color: var(--cyan); }

.it.cur span::before {
  content: "\25cf  ";
  font-size: 8px;
  vertical-align: 1px;
}

.it.lift canvas { opacity: .25; }

/* ── drag ghost ─────────────────────────────────────────────────────────── */
#ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  pointer-events: none;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 12px;
  box-shadow: 0 18px 30px -10px #000d;
  transform: rotate(-6deg) scale(1.08);
  opacity: 0;
  transition: opacity .12s;
}

#ghost.on { opacity: 1; }

#ghost.fur {
  width: 88px;
  height: 66px;
  margin: -33px 0 0 -44px;
  border-radius: 0;
  box-shadow: none;
}

/* ── selection pill ─────────────────────────────────────────────────────── */
#sel {
  position: absolute;
  z-index: 6;
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: 12px;
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px -12px #000d;
  transform: translate(-50%, -100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}

#sel.on {
  opacity: 1;
  pointer-events: auto;
}

#sel b {
  display: flex;
  align-items: center;
  padding: 0 6px 0 7px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

#sel button {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border-radius: 9px;
  font-size: 12px;
  color: #e3e8f4;
}

#sel button:hover { background: #ffffff18; }

#sel svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── bottom-right cluster ───────────────────────────────────────────────── */
.br {
  position: absolute;
  right: 24px;
  bottom: 22px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.brb {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.views {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--panel-dim);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 600;
  color: #dfe4f3;
  font-variant-numeric: tabular-nums;
}

.views svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icb {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--panel-dim);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #dfe4f3;
}

.icb:hover { background: #1a2033f0; }

.icb svg {
  width: 14px;
  height: 14px;
  fill: #dfe4f3;
}

#mail svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.follow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--panel-dim);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 500;
  color: #c9cfe2;
  text-decoration: none;
}

.follow:hover { color: #fff; }

.follow svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

/* ── tooltip ────────────────────────────────────────────────────────────── */
#tip {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  max-width: 260px;
  padding: 5px 9px;
  border-radius: 9px;
  background: var(--tip-bg);
  box-shadow: 0 8px 20px -10px #000c;
  font: 500 11px/1.45 var(--mono);
  color: #e9f7ff;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 16px));
  transition: opacity .15s;
}

#tip b {
  display: block;
  font: 600 12px var(--font);
  color: #fff;
}

#tip.on { opacity: 1; }

/* ── toast / status pill ────────────────────────────────────────────────── */
#ui-hint {
  position: absolute;
  left: 50%;
  top: 22px;
  z-index: 6;
  transform: translateX(-50%);
  padding: 6px 13px;
  border-radius: 14px;
  background: #0e1220dd;
  box-shadow: 0 10px 24px -12px #000c;
  font-size: 11.5px;
  color: #dfe5ee;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s;
}

#ui-hint.on { opacity: 1; }

/* ── hidden-UI mode ─────────────────────────────────────────────────────── */
#app.ui-off > :not(#world):not(.vignette):not(#ui-hint) {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s, visibility 0s .25s;
}

/* ── help dialog ────────────────────────────────────────────────────────── */
dialog#info {
  max-width: 600px;
  max-height: 84vh;
  padding: 28px;
  border: 0;
  border-radius: 20px;
  background: var(--dialog-bg);
  color: #eef1fa;
  overflow-y: auto;
  box-shadow: 0 30px 80px #000a;
}

dialog#info::backdrop {
  background: #05070fa8;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

dialog#info h2 {
  margin: 0 0 8px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.4px;
}

dialog#info h3 {
  margin: 20px 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #8f98b3;
}

dialog#info p {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.65;
  color: #c0c7dc;
}

dialog#info b { color: #fff; font-weight: 600; }

dialog#info code {
  padding: 1px 5px;
  border-radius: 5px;
  background: #ffffff12;
  font-family: var(--mono);
  font-size: 12px;
}

#close {
  float: right;
  margin: -8px -8px 0 0;
  font-size: 24px;
  line-height: 1;
  color: #8f98b3;
}

#close:hover { color: #fff; }

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .side { width: 262px; }
  .light { width: 206px; }
  .time .th { width: 98px; height: 56px; }
  .tray { max-width: calc(100vw - 470px); }
}

@media (max-height: 820px) and (min-width: 901px) {
  .brand small { display: none; }
  .time .th { width: 92px; height: 52px; }
  .why { min-height: 0; }
}

@media (max-height: 700px) and (min-width: 901px) {
  .board { display: none; }
}

@media (max-width: 900px) {
  .side {
    left: 12px;
    top: 12px;
    right: 12px;
    width: auto;
    gap: 8px;
  }

  .brand h1 span { display: inline; font-size: 12px; }
  .brand h1 b { display: inline; font-size: 23px; }
  .brand small { display: none; }

  .moods { margin-right: 88px; }
  .mood { padding: 6px 7px; }
  .mood .pal { height: 10px; margin-bottom: 4px; }
  .mood b { font-size: 12.5px; }
  .mood small,
  .meter,
  .why,
  .board,
  .light,
  .br { display: none; }

  .tools { top: 12px; right: 12px; }
  .tools .dsk { display: none; }

  .tray {
    left: 8px;
    right: 8px;
    bottom: 8px;
    transform: none;
    min-width: 0;
    max-width: none;
    padding: 8px;
  }

  .tmini {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 2px 6px;
  }

  .tmini .clock { flex: none; width: 44px; }
  .tmini .tslide { flex: 1; margin: 0; }

  .tabs button { padding: 0 8px; font-size: 12px; }
  .tabs .div { margin: 0 3px; }
  /* keep the "for the …" pill inside the bottom sheet when a surface is picked */
  .tabs.has-for { flex-wrap: wrap; row-gap: 4px; }
  .tabs.has-for .for { padding-left: 0; }

  .it { width: 62px; }
  .it canvas { width: 54px; height: 54px; }
  .it.fur { width: 76px; }
  .it.fur canvas { width: 72px; height: 54px; }

  .vignette {
    background: radial-gradient(ellipse at 50% 46%, transparent 52%, #05060c9c 100%);
  }
}

/* ── reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
