/* ── Shared components ─────────────────────────────────── */

/* ── buttons ── */

button.ghost, button.primary {
  border-radius: 999px; text-transform: uppercase;
  letter-spacing: .08em; font-size: 11px;
  transition: all .13s ease;

  &::before, &::after { content: none; }
}

button.primary {
  background: var(--acc); color: var(--acc-ink); font-weight: 600;
  padding: 9px 20px;

  &:hover:not(:disabled) {
    filter: brightness(1.08); transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(70, 211, 146, .25);
  }
  &:disabled { background: var(--dis); color: var(--dim); cursor: not-allowed; }
  &.block { display: block; width: 100%; text-align: left; margin-top: 4px; }
}

button.ghost {
  background: var(--panel); color: var(--muted); padding: 8px 16px;
  box-shadow: inset 0 0 0 1px var(--line);

  &:hover { background: var(--panel2); color: var(--text); }
  &:disabled { background: transparent; color: var(--dis); cursor: not-allowed; }
  &.small { padding: 5px 12px; font-size: 10px; }
}

button.link {
  color: var(--text); text-decoration: underline; text-underline-offset: 2px;
  text-transform: none; letter-spacing: 0; font-size: inherit;
  background: none; box-shadow: none; padding: 0; border-radius: 0;
}

/* ── inputs ── */

input:not([type]), input[type=text], input[type=password],
input[type=email], input[type=number], #prompt {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-ctl); padding: 9px 12px;
  color: var(--text); font-family: var(--font); font-size: 13px;

  &::placeholder { color: var(--dim); }

  &:focus {
    outline: none; border-color: rgba(70, 211, 146, .5);
    box-shadow: 0 0 0 3px var(--acc-soft);
  }
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--panel) inset;
  caret-color: var(--text);
  transition: background-color 999999s;
}

input[type=checkbox], input[type=radio] { accent-color: var(--acc); }
input[type=range] { width: 100%; accent-color: var(--acc); height: 2px; margin: 8px 0 0; }

select.pick {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-ctl); padding: 8px 12px;
  color: var(--text); font-family: var(--font); cursor: pointer;

  &:focus { outline: none; border-color: rgba(70, 211, 146, .5); }
  & option { background: var(--panel); color: var(--text); }
}

label {
  font-size: 10.5px; color: var(--faint); display: flex; flex-direction: column;
  gap: 3px; text-transform: uppercase; letter-spacing: .14em;
}

/* ── checkerboard ── */

.mark, .checker, .gallery .cell, .stage {
  background-image:
    linear-gradient(45deg, var(--chk-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--chk-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--chk-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--chk-b) 75%);
  background-color: var(--chk-a);
}

.mark {
  width: 11px; height: 11px; flex: none; display: inline-block;
  background-size: 6px 6px; background-position: 0 0, 0 3px, 3px -3px, -3px 0;

  &.big {
    width: 34px; height: 34px; background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  }
}

/* ── status pills ── */

.pill {
  border-radius: 999px; padding: 3px 10px; background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 10px; letter-spacing: .13em; text-transform: uppercase;
  white-space: nowrap; color: var(--faint);

  &.running {
    background: var(--acc-soft); color: var(--acc);
    box-shadow: inset 0 0 0 1px rgba(70, 211, 146, .35);
    animation: glowpulse 2.2s ease-in-out infinite;
    &::before { content: "● "; }
  }
  &.done { color: var(--muted); }
  &.error {
    background: rgba(255, 122, 110, .1); color: #ff7a6e;
    box-shadow: inset 0 0 0 1px rgba(255, 122, 110, .3);
    &::before { content: "! "; }
  }
  &.queued, &.uploading, &.paused { color: var(--muted); }
  &.queued::before { content: "· "; }
  &.uploading::before { content: "↑ "; }
  &.paused::before { content: "❚❚ "; }
  &.cancelled { color: var(--dim); &::before { content: "× "; } }
}

/* ── progress blocks ── */

.blocks {
  letter-spacing: -.5px; color: var(--acc); font-size: 12px;
  & .off { color: var(--dim); }
}
tr.done .blocks, .job.done .blocks { color: var(--faint); }
.pct { color: var(--faint); font-size: 11px; margin-left: 8px; }

/* ── text helpers ── */

.mono { font-family: var(--mono); }
.err { color: var(--text); font-size: 11.5px; margin: 0; &::before { content: "! "; } }
.hint { font-size: 10.5px; color: var(--dim); margin: 3px 0 0; }
.hint.free { color: var(--muted); margin-top: 8px; &::before { content: "· "; } }
.empty { color: var(--dim); font-size: 11.5px; padding: 16px 0; margin: 0; }

.frameno {
  font-size: 11px; color: var(--faint); white-space: nowrap; flex: none;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}

kbd { font: inherit; border: 1px solid var(--line); padding: 0 4px; color: var(--dim); }

/* ── download link ── */

.dl {
  margin-left: auto; font-size: 10.5px; text-decoration: none;
  color: var(--faint); text-transform: uppercase; letter-spacing: .12em;

  &::before { content: "↓ "; }
  &:hover { color: var(--text); }
}

/* ── snackbar ── */

#snacks {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 10000; display: flex; flex-direction: column; gap: 8px;
  width: min(440px, calc(100vw - 32px)); pointer-events: none;
}

.snack {
  display: flex; align-items: center; gap: 12px; pointer-events: auto;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: var(--r-ctl); padding: 11px 12px 11px 16px;
  box-shadow: var(--shadow); font-size: 12.5px; color: var(--text);
  animation: snackin .18s ease;

  &.out {
    opacity: 0; transform: translateY(6px);
    transition: opacity .22s ease, transform .22s ease;
  }
  &.error {
    border-color: rgba(255, 122, 110, .35);
    &::before {
      content: ""; width: 3px; align-self: stretch; flex: none;
      border-radius: 99px; background: #ff7a6e; margin-left: -6px;
    }
  }
  &.ok::before {
    content: ""; width: 3px; align-self: stretch; flex: none;
    border-radius: 99px; background: var(--acc); margin-left: -6px;
  }
}

.snack-msg { flex: 1; line-height: 1.5; }
.snack-act {
  background: none; border: 0; color: var(--acc); font: inherit;
  font-weight: 600; letter-spacing: .04em; cursor: pointer;
  padding: 4px 6px; border-radius: 6px; flex: none;
  &:hover { background: var(--acc-soft); }
}
.snack-x {
  background: none; border: 0; color: var(--faint); font-size: 15px;
  cursor: pointer; padding: 2px 6px; flex: none; line-height: 1;
  &:hover { color: var(--text); }
}

/* ── stale deploy bar ── */

#staleBar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 9999; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 10px 14px; font-size: 12px; letter-spacing: .02em;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .5);

  & button {
    background: none; border: 1px solid currentColor; color: inherit;
    border-radius: 3px; padding: 2px 8px; margin: 0 2px; cursor: pointer; font: inherit;
    &:hover { background: rgba(255, 255, 255, .08); }
  }
}

/* ── clear confirmation modal ── */

.clear-confirm {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, .5); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;

  &.open { display: flex; }
}

.clear-confirm-inner {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 20px 24px; box-shadow: var(--shadow);
  max-width: 320px; width: 90%;

  & p { margin: 0 0 14px; font-size: 13px; color: var(--muted); line-height: 1.5; }
  & .cc-btns { display: flex; gap: 8px; }
  & .cc-btns button { flex: 1; }
}

/* ── animations ── */

@keyframes snackin { from { opacity: 0; transform: translateY(8px); } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .15; } }
@keyframes glowpulse {
  0%, 100% { opacity: .55; text-shadow: none; }
  50% { opacity: 1; text-shadow: 0 0 12px rgba(255, 255, 255, .35); }
}
@keyframes textglow {
  0%, 100% { color: #a7aeaa; text-shadow: none; }
  50% { color: #eef3f0; text-shadow: 0 0 16px rgba(238, 243, 240, .4); }
}
