/* Unseal uses the Filgs Labs palette (design/direction.md in FilgsLabsClient).
   System fonts only: the strict CSP loads nothing from other hosts. */
:root {
  --night: #0e0d12;
  --bench: #17161c;
  --edge: #2a2833;
  --porcelain: #f4f2f7;
  --graphite: #a8a3b3;
  --ember: #fbbf24;
  --ink: #1a1206;
  --molten: #f97316;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--night);
  color: var(--porcelain);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--porcelain);
  font-weight: 700;
  font-size: 20px;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.logo { display: block; }

/* Language switch: both options stay visible; the active one is filled. */
.langs {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--bench);
  border: 1px solid var(--edge);
  border-radius: 10px;
}

.langs button {
  min-height: 34px;
  min-width: 44px;
  padding: 4px 10px;
  font-size: 14px;
  background: transparent;
  color: var(--graphite);
  border-radius: 7px;
}

.langs button.active { background: var(--ember); color: var(--ink); }
.langs button:not(.active):hover { color: var(--porcelain); }

main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 24px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.card {
  background: var(--bench);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 20px;
}

h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 0 0 6px; }
p { margin: 0 0 12px; }

.muted { color: var(--graphite); }
.small { font-size: 14px; }

.label {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
}

.label.inline { display: inline; margin: 0; }

textarea, input, select {
  width: 100%;
  font: inherit;
  color: var(--porcelain);
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 12px;
}

textarea { resize: vertical; min-height: 120px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; }

input[type="file"] { padding: 10px; }

textarea:focus, input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
}

.row select { width: auto; flex: 1; max-width: 200px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-weight: 600;
  min-height: 44px;
}

.check input { width: 20px; height: 20px; accent-color: var(--ember); }

button {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  min-height: 44px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid transparent;
}

button:disabled { opacity: 0.6; cursor: progress; }

.primary {
  background: var(--ember);
  color: var(--ink);
  width: 100%;
  margin-top: 8px;
}

.primary:hover:not(:disabled) { background: #fcd34d; }

.ghost {
  background: transparent;
  color: var(--porcelain);
  border-color: var(--edge);
}

.ghost:hover { border-color: var(--graphite); }

.ghost.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--night);
  padding: 4px;
  border-radius: 12px;
  margin: 16px 0 4px;
}

.tab {
  flex: 1;
  background: transparent;
  color: var(--graphite);
  min-height: 40px;
}

.tab.active { background: var(--bench); color: var(--porcelain); }

.error { color: var(--danger); font-weight: 600; margin-top: 12px; }

.warn {
  color: var(--ember);
  font-weight: 600;
}

.linkbox input {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px;
}

.actions { display: flex; gap: 8px; }
.actions .primary, .actions .ghost { flex: 1; margin-top: 12px; }

.pin {
  margin-top: 16px;
  font-size: 18px;
}

.pin strong {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 24px;
  letter-spacing: 0.2em;
  color: var(--ember);
}

.qrbox { display: flex; justify-content: center; margin: 16px 0; }

.qr {
  width: min(260px, 100%);
  height: auto;
  image-rendering: pixelated;
  background: #fff;
  border-radius: 10px;
  padding: 8px;
}

.links { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }

.links li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px;
  border: 1px solid var(--edge);
  border-radius: 10px;
}

.label-cell { font-weight: 600; overflow-wrap: anywhere; }
.state { font-weight: 600; text-align: right; }
.state[data-status="waiting"] { color: var(--ember); }
.state[data-status="opened"] { color: var(--ok); }
.state[data-status="locked"], .state[data-status="unknown"] { color: var(--danger); }
.state[data-status="expired"], .state[data-status="cancelled"] { color: var(--graphite); }
.row-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }

.secret {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 14px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 15px;
  margin: 0 0 8px;
}

.filename { font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }

.steps { padding-left: 22px; margin: 8px 0 0; display: grid; gap: 16px; }
.steps li { padding-left: 4px; }
.steps li::marker { color: var(--ember); font-weight: 700; }

.stores { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }

.store {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  color: var(--porcelain);
  text-decoration: none;
  font-weight: 600;
}

.store:hover { border-color: var(--ember); }

a { color: var(--ember); }

footer {
  text-align: center;
  padding: 24px 16px;
}

/* The seal on the open page. When the secret opens, it cracks and forge light shows through. */
.seal-box { display: flex; justify-content: center; margin: 4px 0 12px; min-height: 120px; }
.seal-box svg { width: 120px; height: 120px; }
.split-seal * { transform-box: view-box; }
.split-seal .half { transition: transform .6s cubic-bezier(.3,.7,.2,1) .1s; }
.split-seal .half.l { transform-origin: 29px 60px; }
.split-seal .half.r { transform-origin: 35px 60px; }
.split-seal .glow, .split-seal .crumbs { opacity: 0; transition: opacity .35s ease .25s, transform .45s ease .35s; }
.split-seal .crumbs { transform: translateY(-3px); }
.is-open .split-seal .half.l { transform: translate(-2.6px, .8px) rotate(-5deg); }
.is-open .split-seal .half.r { transform: translate(2.6px, .8px) rotate(4.5deg); }
.is-open .split-seal .glow, .is-open .split-seal .crumbs { opacity: 1; }
.is-open .split-seal .crumbs { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .split-seal .half, .split-seal .glow, .split-seal .crumbs { transition: none; }
}

[hidden] { display: none !important; }
