:root {
  --fg: #fff;
  --amber: #ffb000;
  color-scheme: dark;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: #000;
  color: var(--fg);
  font: 12px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: .04em;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-transform: lowercase;
}
#c { position: fixed; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }

.dim  { color: rgba(255,255,255,.45); }
.tiny { font-size: 10px; line-height: 1.7; }
.err  { color: var(--amber); min-height: 1em; font-size: 11px; }

#hud {
  position: fixed; top: 0; left: 0; right: 0;
  padding: calc(16px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) 0 calc(20px + env(safe-area-inset-left));
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 2px 16px;
  pointer-events: none;
  user-select: none;
}
#chainNo { font-size: 13px; }

#note {
  position: fixed;
  left: calc(20px + env(safe-area-inset-left));
  bottom: calc(22px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 170px);
  color: rgba(255,255,255,.65);
  transition: opacity 1.5s;
  pointer-events: none;
}
#note.ring { color: var(--amber); }

#hover {
  position: fixed;
  left: calc(20px + env(safe-area-inset-left));
  bottom: calc(48px + env(safe-area-inset-bottom));
  pointer-events: none;
}

button {
  font: inherit; letter-spacing: inherit; text-transform: inherit;
  background: none; color: var(--fg);
  border: 1px solid rgba(255,255,255,.25);
  padding: 9px 16px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
button:hover { background: var(--fg); color: #000; }
button.ghost { border-color: transparent; color: rgba(255,255,255,.45); }
button.ghost:hover { background: none; color: var(--fg); }

#actions {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex; gap: 8px;
}
#drawer {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(76px + env(safe-area-inset-bottom));
  width: min(300px, calc(100vw - 40px));
  background: #000;
  border: 1px solid rgba(255,255,255,.18);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
button.mark { border-color: rgba(255,176,0,.4); color: var(--amber); }
button.mark:hover { background: var(--amber); color: #000; }
.keyRow .code .tag { color: var(--amber); }
.keyRow {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding-bottom: 8px;
}
.keyRow .code { color: rgba(255,255,255,.85); }
.keyRow .ttl  { color: var(--amber); font-size: 10px; }
.keyRow button { padding: 4px 10px; font-size: 11px; }
.keyRow .btns { display: flex; gap: 6px; }

#gate, #redeem {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #000;
}
#redeem { background: rgba(0,0,0,.85); }
.card {
  width: min(320px, calc(100vw - 48px));
  display: flex; flex-direction: column; gap: 14px;
  text-align: left;
}
#gateTitle, #redeemTitle { font-size: 15px; }
input {
  font: inherit; letter-spacing: inherit; text-transform: none;
  background: none; color: var(--fg);
  border: 0; border-bottom: 1px solid rgba(255,255,255,.35);
  padding: 8px 0;
  outline: none;
}
input::placeholder { color: rgba(255,255,255,.3); }
input:focus { border-color: var(--fg); }
.row { display: flex; gap: 10px; }
#anchorRow { display: flex; gap: 10px; }
#anchorRow input { flex: 1; min-width: 0; }
.nameHint { font-size: 9px; letter-spacing: 0; }

[hidden] { display: none !important; }

/* while capturing a clip, the interface steps back */
body.capturing .ui {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity .35s;
}

button.linkish {
  border: none;
  padding: 0 1px;
  font-size: inherit;
  color: rgba(255,255,255,.85);
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.linkish:hover { background: none; color: #fff; }
button.linkish:disabled { text-decoration: none; color: inherit; cursor: default; }

.shareIcon { display: inline-block; }
.shareIcon svg { vertical-align: -2px; color: rgba(255,255,255,.85); }

#nudge {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(76px + env(safe-area-inset-bottom));
  max-width: min(340px, calc(100vw - 40px));
  display: flex; align-items: center; gap: 4px;
  background: #000;
  border: 1px solid rgba(255,255,255,.18);
  padding: 5px 5px 5px 12px;
  font-size: 11px;
  color: rgba(255,255,255,.55);
}
#nudge button { border: none; padding: 6px 10px; }
#nudge #nudgeGo { border: 1px solid rgba(255,255,255,.25); }

/* touch devices: no ios zoom-on-focus, bigger targets */
@media (pointer: coarse) {
  input { font-size: 16px; }
  button { padding: 12px 18px; }
  .keyRow button { padding: 8px 12px; font-size: 12px; }
  button:hover { background: none; color: var(--fg); }
  button.mark:hover { background: none; color: var(--amber); }
  button:active { background: var(--fg); color: #000; }
}
