/* One Records modal (Figma 4ZjCfhiCdZHWhClsgyHylb, page 28:2): every card is 360 x 410 with 24px corners. Header: the Keymaker
   lockup centred, X top right and a "<" top left when there is a previous step. Content (Records chest, title, one input, ONE accent
   button) is centred. Footer: "Secured by" + the Keymaker mark (the footer is under 96px, so the wordmark does not go there).
   The card is painted like the toolbar (.fm-dock in filemanager.css): #1c1c1c with a #3a3a3a edge at night, #f6f6f4 with a #cfcfcb
   edge by day. The button wears the colour theme's accent, var(--sel). */
html { --rm-bg: #1c1c1c; --rm-edge: #3a3a3a; --rm-ink: #f4f4f2; --rm-muted: rgba(255, 255, 255, .58); --rm-field: rgba(127, 127, 127, .14); --rm-field-edge: rgba(255, 255, 255, .2); --rm-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
html[data-theme="light"] { --rm-bg: #f6f6f4; --rm-edge: #cfcfcb; --rm-ink: #111111; --rm-muted: rgba(0, 0, 0, .55); --rm-field: rgba(127, 127, 127, .14); --rm-field-edge: rgba(17, 17, 17, .22); --rm-shadow: 0 12px 40px rgba(0, 0, 0, .14); }
html body .rm-card {
  position: relative; box-sizing: border-box; display: flex; flex-direction: column; gap: 16px; align-items: center;
  width: 360px; max-width: calc(100vw - 30px); height: 410px; margin: 0; padding: 16px 20px 20px;
  border: 1.5px solid var(--rm-edge); border-radius: 24px; background: var(--rm-bg); color: var(--rm-ink);
  box-shadow: var(--rm-shadow); text-align: center; font-family: Inter, system-ui, sans-serif; overflow: hidden;
  transform: translateY(8px) scale(.98); transition: transform 240ms cubic-bezier(.2, .8, .2, 1);
}
html body .is-open > .rm-card, html body .rm-card.is-static { transform: none; }
html body .rm-card .rm-step { display: contents; }
html body .rm-card .rm-step[hidden] { display: none; }
html body .rm-card .rm-head { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 28px; flex: none; }
html body .rm-card .rm-ico { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; margin: 0; padding: 0; border: 0; border-radius: 14px; background: none; color: var(--rm-muted); cursor: pointer; text-decoration: none; }
html body .rm-card .rm-ico:hover { background: color-mix(in srgb, var(--rm-ink) 8%, transparent); color: var(--rm-ink); }
html body .rm-card .rm-ico svg { width: 14px; height: 14px; display: block; }
html body .rm-card .rm-ico--x { margin-left: auto; }
html body .rm-card .rm-body { flex: 1 1 0; min-height: 0; width: 100%; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; }
html body .rm-card .rm-chest { display: block; flex: none; width: 24px; height: 21px; margin: 0; }
html body .rm-card .rm-chest img { display: block; width: 100%; height: 100%; object-fit: contain; }
html body .rm-card .rm-title { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; color: var(--rm-ink); text-align: left; }
html body .rm-card .rm-head .rm-ico--back { margin-right: -4px; }
html body .rm-card .rm-opts { display: flex; flex-direction: column; gap: 10px; width: 100%; }
html body .rm-card .rm-field { box-sizing: border-box; display: flex; align-items: center; width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--rm-field-edge); border-radius: 14px; background: var(--rm-field); color: var(--rm-muted); font-size: 15px; }
html body .rm-card .rm-field:focus-within { border-color: var(--sel, #1f6fe5); }
html body .rm-card .rm-field input { flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; outline: 0; background: none; color: var(--rm-ink); font: inherit; box-shadow: none; }
html body .rm-card .rm-field input::placeholder { color: var(--rm-muted); }
html body .rm-card .rm-field--amount { height: 56px; font-size: 22px; font-weight: 500; }
html body .rm-card .rm-field--amount span { color: var(--rm-ink); margin-right: 2px; }
html body .rm-card .rm-btn { box-sizing: border-box; display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; margin: 0; padding: 0 16px; border: 0; border-radius: 14px; background: var(--sel, #1f6fe5); color: var(--sel-ink, #fff); font: 500 16px/1 Inter, system-ui, sans-serif; cursor: pointer; box-shadow: none; }
html body .rm-card .rm-btn:hover { filter: brightness(1.1); }
html body .rm-card .rm-btn:disabled { opacity: .6; cursor: default; filter: none; }
html body .rm-card .rm-link { display: flex; gap: 4px; justify-content: center; padding-top: 4px; font-size: 13px; color: var(--rm-muted); }
html body .rm-card .rm-link button, html body .rm-card .rm-link a { margin: 0; padding: 0; border: 0; background: none; color: var(--rm-ink); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
html body .rm-card .rm-error { margin: 0; font-size: 13px; color: #e5484d; }
html body .rm-card .rm-error[hidden] { display: none; }
html body .rm-card .rm-phrase { box-sizing: border-box; width: 100%; margin: 0; padding: 10px 12px; border: 1px solid var(--rm-field-edge); border-radius: 14px; background: var(--rm-field); font: 13px/1.6 ui-monospace, monospace; user-select: all; cursor: copy; }
html body .rm-card .rm-foot { display: flex; align-items: center; gap: 6px; flex: none; height: 28.5px; font-size: 12px; color: var(--rm-muted); }
/* Footer: "Secured by" + the brass Keymaker lockup (keys + wordmark), 22px tall (20–24).
   Black art on a light card, white on a dark one. prefers-color-scheme is the base; data-theme wins, because that attribute
   is what paints the card (night is the default, with no attribute). */
html body .rm-card .rm-foot .km-lockup { display: inline-flex; flex: none; height: 22px; pointer-events: none; }
html body .rm-card .rm-foot .km-lockup img { height: 22px; width: auto; }
html body .rm-card .km-mark img { width: 28px; height: 28px; }
@media (prefers-color-scheme: light) {
  html body .rm-card .km-for-light { display: block; }
  html body .rm-card .km-for-dark { display: none; }
}
@media (prefers-color-scheme: dark) {
  html body .rm-card .km-for-light { display: none; }
  html body .rm-card .km-for-dark { display: block; }
}
/* The card follows data-theme, not the OS: night (no attribute) stays white even when the OS is light. */
html:not([data-theme="light"]) body .rm-card .km-for-light { display: none; }
html:not([data-theme="light"]) body .rm-card .km-for-dark { display: block; }
html[data-theme="light"] body .rm-card .km-for-light { display: block; }
html[data-theme="light"] body .rm-card .km-for-dark { display: none; }
html body .rm-card .rm-check { display: block; width: 72px; height: 72px; margin: 4px 0; }

/* The check (reference: Figma "Checkmark animation", ~1.1s): spinner, the arc closes, the disc fills, the check draws, a small settle. */
.rm-check .t { stroke: rgba(127, 127, 127, .14); }
.rm-check .a { stroke: var(--sel, #1f6fe5); stroke-dasharray: 163.4; stroke-dashoffset: 122; transform-origin: 32px 32px; animation: rm-spin .4s linear 0s 1, rm-close .25s ease-in-out .4s 1 forwards; }
.rm-check .f { fill: var(--sel, #1f6fe5); transform-origin: 32px 32px; transform: scale(0); animation: rm-fill .25s ease-out .65s forwards; }
.rm-check .c { stroke: var(--sel-ink, #fff); stroke-dasharray: 35; stroke-dashoffset: 35; animation: rm-draw .3s ease-out .65s forwards; }
.rm-check .g { transform-origin: 32px 32px; animation: rm-settle .25s ease-in-out .95s; }
@keyframes rm-spin { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } }
@keyframes rm-close { from { transform: rotate(270deg); } to { transform: rotate(270deg); stroke-dashoffset: 0; } }
@keyframes rm-fill { to { transform: scale(1); } }
@keyframes rm-draw { to { stroke-dashoffset: 0; } }
@keyframes rm-settle { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .rm-check .a, .rm-check .f, .rm-check .c, .rm-check .g { animation: none !important; }
  .rm-check .a { stroke-dashoffset: 0; } .rm-check .f { transform: none; } .rm-check .c { stroke-dashoffset: 0; }
  html body .rm-card { transition: none; }
}

/* A card standing on its own page (recover, Keymaker callback, unlock, buy) rather than over one: centred in the page. Cards that need
   two inputs (recover) or a license choice (buy) grow past 410px instead of clipping. */
html body .rm-page { display: grid; place-items: center; min-height: min(70vh, 640px); padding: 24px 0; }
html body .rm-card.rm-card--tall { height: auto; min-height: 410px; }
html body .rm-card .rm-lic { display: flex; flex-direction: column; gap: 6px; width: 100%; margin: 0; padding: 0; border: 0; text-align: left; }
html body .rm-card .rm-lic label { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border: 1px solid var(--rm-field-edge); border-radius: 14px; background: var(--rm-field); font-size: 14px; cursor: pointer; }
html body .rm-card .rm-lic label:has(input:checked) { border-color: var(--sel, #1f6fe5); }
html body .rm-card .rm-lic input { accent-color: var(--sel, #1f6fe5); margin: 0; }
html body .rm-card .rm-note { margin: 0; font-size: 13px; color: var(--rm-muted); }
html body .rm-card .rm-view { width: 100%; }
html body .rm-card .rm-view img, html body .rm-card .rm-view video { max-width: 100%; max-height: 220px; border-radius: 12px; }
html body .rm-card.rm-card--tall .rm-body { flex: 1 0 auto; }
/* The Records chest and name sit centred in the top row; < and X are pinned to the edges so they don't push it off centre. */
html body .rm-card .rm-head { justify-content: center; }
html body .rm-card .rm-head .rm-title { flex: none; text-align: center; }
html body .rm-card .rm-head .rm-ico--back { position: absolute; left: 0; top: 50%; margin: 0; transform: translateY(-50%); }
html body .rm-card .rm-head .rm-ico--x { position: absolute; right: 0; top: 50%; margin: 0; transform: translateY(-50%); }

/* The Add a Record popup (the centred dialog, as opened from the settings page) is drawn like the toolbar's popup menus (Filter, View, Search,
   Theme: filemanager.css "Every popup menu is the Records menu"): same fill, edge, corner and shadow, same 14px rows with the same hover. */
  box-sizing: border-box; width: 300px; max-width: calc(100vw - 30px); max-height: min(560px, calc(100dvh - 40px)); padding: 8px;
  border: 1.5px solid #3a3a3a !important; border-radius: 18px; background: #1c1c1c; color: #fff; box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  font-family: inherit; text-align: left;
}
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__step { gap: 2px; }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__item { gap: 10px; padding: 8px 10px; border-radius: 10px; color: inherit; font-size: 14px; font-weight: 400; }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__item:hover, html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__item:focus-visible { background: rgba(127, 127, 127, .14); }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__item svg, html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__item .rv-kind svg { width: 20px; height: 20px; }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__label { margin: 8px 10px 2px; color: inherit; opacity: .55; font-size: 13px; }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__label:first-child { margin-top: 2px; }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__note, html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .rv-opt span { color: inherit; opacity: .55; }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__title, html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .rv-opts { color: inherit; }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .rv-opt { border-color: rgba(127, 127, 127, .3); color: inherit; }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .rv-opt:has(input:checked) { border-color: var(--pe-accent, #1f6fe5); background: rgba(127, 127, 127, .1); }

/* The sign-in and create-account modal has the same corners and shadow as the popup menus. */
html body .rm-card { border-radius: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
html[data-theme="light"] body .rm-card { box-shadow: 0 12px 40px rgba(0, 0, 0, .14); }
html body .rm-card .rm-field, html body .rm-card .rm-btn, html body .rm-card .rm-phrase { border-radius: 10px; }

html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__back, html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__title { display: none; }
html body .addm[data-step="access"] .addm__step, html body .addm[data-step="price"] .addm__step, html body .addm[data-step="file"] .addm__step { padding: 4px 6px 6px; }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .rv-opts { margin: 0; padding: 0; border: 0; min-width: 0; }

/* The Add a Record dialog wears the same card as the sign-in modals; it only grows to fit its list instead of the fixed 410px, and the back arrow is shown after the first step. */
html body .rm-card.rm-card--auto { height: auto; max-height: min(640px, calc(100dvh - 40px)); overflow-y: auto; align-items: stretch; gap: 12px; text-align: left; }
html body .addm .rm-card .rm-ico--back { display: none; }
html body .addm[data-step="access"] .rm-card .rm-ico--back, html body .addm[data-step="price"] .rm-card .rm-ico--back, html body .addm[data-step="file"] .rm-card .rm-ico--back { display: grid; }
html body .addm .rm-card .addm__step { width: 100%; }

/* Anything the Add dialog hides with the hidden attribute stays hidden: the "Or choose a folder" box (a bare file input, which looked like an empty box above the form) was showing for images because the label's display: flex outranked [hidden]. */
html body .addm [hidden] { display: none !important; }

/* License choices in the Add dialog: the license icon is the size of the record-type icons (20px) and centred on the whole option, so it sits between the name and its description line. */
html body .addm .rv-opt { align-items: center !important; }
html body .addm .rv-opt .rv-lock { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 20px; height: 20px; }
html body .addm .rv-opt .rv-lock svg { width: 20px !important; height: 20px !important; }

/* The Continue button after the license list (and the price) sits as far below as Upload does below the Name field: 6px (the field's margin) + 12px (the button's) + the 2px step gap, twice. */
html body .addm[data-step="access"] .addm__step .addm__go, html body .addm[data-step="price"] .addm__step .addm__go { margin-top: 20px; }

/* License choices: the chosen option is outlined in the theme accent and nothing more; its lock icon is the full accent colour. */
html body .addm .rv-opt input { accent-color: var(--sel, var(--pe-accent, var(--accent, #1f6fe5))); }
html body .addm .rv-opt:has(input:checked) { border-color: var(--sel, var(--pe-accent, var(--accent, #1f6fe5))) !important; background: transparent !important; }
html body .addm .rv-opt .rv-lock, html body .addm .rv-opt .rv-lock * { opacity: 1 !important; }
html body .addm .rv-opt:has(input:checked) .rv-lock { color: var(--sel, var(--pe-accent, var(--accent, #1f6fe5))) !important; }

/* Picking a record type in the Add dialog fills the row with the accent and turns its words and icon to the inverse colour, as a selected button does in the bottom toolbar. */
html body .addm .addm__item.is-on, html body .addm .addm__item:active { background: var(--sel, var(--pe-accent, var(--accent, #1f6fe5))) !important; color: var(--sel-ink, #fff) !important; }
html body .addm .addm__item.is-on svg, html body .addm .addm__item.is-on .rv-kind, html body .addm .addm__item.is-on .rv-kind svg, html body .addm .addm__item:active svg { color: var(--sel-ink, #fff) !important; stroke: currentColor; }

/* Narrow or short screens (phones, and Keymaker's popup when it opens full screen): the card fits the viewport, never overflows. */
@media (max-width: 420px), (max-height: 460px) {
  html body .rm-card { width: calc(100vw - 24px); max-width: 360px; height: auto; min-height: min(410px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 14px 16px 16px; }
  html body .rm-page { min-height: calc(100dvh - 120px); padding: 12px 0; }
  html body .rm-card .rm-field input { font-size: 16px; } /* iOS: no zoom on focus */
}


/* "Continue with [key] Keymaker" (t418u, _keymaker_logo.html continue_label): the key sits right before "Keymaker". K9 (live, t419u):
   a 28px near-white rounded square behind a 20px brass key, so it reads on every theme's accent. The others are /sketches only. */
html body .km-key { display: inline-grid; place-items: center; flex: none; box-sizing: border-box; width: 26px; height: 26px; margin: 0 6px 0 7px; vertical-align: middle; }
html body .km-key img { display: block; width: 20px; height: 20px; }
html body .km-key--k1 { border-radius: 50%; background: #fbfaf6; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55), 0 1px 4px rgba(0, 0, 0, .35); }
html body .km-key--k2 { width: 30px; height: 30px; } html body .km-key--k2 img { width: 28px; height: 28px; filter: drop-shadow(0 0 4px #ffd36b) drop-shadow(0 0 9px rgba(255, 196, 64, .8)); }
html body .km-key--k3 { border-radius: 9px; border: 2px solid #fff; background: color-mix(in srgb, var(--sel, #1f6fe5) 70%, #000); }
html body .km-key--k4 { border-radius: 50%; background: #141414; box-shadow: inset 0 0 0 1.5px #c9a24a; } html body .km-key--k4 img { filter: brightness(1.35) saturate(1.3); }
html body .km-key--k5 img { width: 24px; height: 24px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .65)) drop-shadow(0 0 1px #000); }
html body .km-key--k6 { width: 34px; height: 34px; margin: -6px 6px -6px 4px; border-radius: 50%; background: #fbfaf6; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); } html body .km-key--k6 img { width: 26px; height: 26px; }
html body .km-key--k7 img { width: 22px; height: 22px; filter: brightness(0) invert(1); }
html body .km-key--k8 { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c4, #e2b44a 55%, #9a6b12); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); } html body .km-key--k8 img { filter: brightness(.55) contrast(1.4); }
html body .km-key--k9 { width: 28px; height: 28px; border-radius: 8px; background: #fbfaf6; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
html body .km-key--k10 { border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0, 0, 0, .25); background: rgba(255, 255, 255, .12); }


/* Price step: how many credits the Arweave upload costs, and a spinner on Save while it runs.
   Specificity has to beat html body .addm:not(...) .addm__note { color: inherit; opacity: .55 }. */
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__cost { opacity: .9; font-variant-numeric: tabular-nums; }
html body .addm:not(.addm--bar):not(.addm--col):not(.addm--inline) .addm__cost.is-short { color: var(--danger, #e85d4c) !important; opacity: 1; }
html body .rm-card .rm-btn.is-uploading { gap: 10px; pointer-events: none; }
html body .rm-card .rm-btn.is-uploading::before {
  content: "";
  width: 1.05em;
  height: 1.05em;
  flex: none;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: addm-upload-spin .7s linear infinite;
}
@keyframes addm-upload-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  html body .rm-card .rm-btn.is-uploading::before {
    animation: none;
    border-right-color: currentColor;
    opacity: .55;
  }
}
