/* Look and feel follows the MasterClass design guide in the Websites knowledge base:
   black stage, white grotesk type, condensed poster headline, small raspberry actions, flat charcoal panels. */
:root {
  --canvas: #000000;
  --utility: #0d0d0e;
  --input: #191c21;
  --panel: #222326;
  --slate: #272c33;
  --rule: #303136;
  --edge: #43454c;
  --muted: #9ea0a9;
  --support: #d4d5d9;
  --text: #ffffff;
  --action: #e32652;
  --action-hover: #d61a46;
  --action-active: #c71a42;
  --sans: "Inter", Helvetica, Arial, sans-serif;
  --poster: "Sofia Sans Extra Condensed", "Barlow Condensed", Impact, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas); color: var(--text);
  font: 400 16px/1.5 var(--sans); letter-spacing: .02em;
  -webkit-font-smoothing: antialiased; }
.wrap { max-width: 640px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 20px calc(96px + env(safe-area-inset-bottom)); }

header { margin: 0; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; margin-top: 8px; }
.logo { display: block; width: 64px; height: 64px; }
h1 { font-family: var(--poster); font-weight: 800; font-size: clamp(60px, 19.5vw, 96px); line-height: .85; letter-spacing: 0; word-spacing: -.04em; text-transform: uppercase; margin: 32px 0 0; }
.sub { color: var(--support); font-weight: 600; margin: 8px 0 0; text-wrap: balance; }
.mark { display: block; width: 32px; height: 2px; background: var(--action); margin: 24px 0 0; }
.balance { flex: none; margin: 0; padding: 10px 18px; border-radius: 24px; background: var(--utility); box-shadow: inset 0 0 0 1px var(--rule); font-size: 15px; line-height: 1.45; font-weight: 600; color: var(--muted); }
.balance b { color: var(--text); font-weight: 600; }
.balance.low b { color: var(--action); }

.step { margin-top: 48px; }
.shead { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.shead .num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--action); color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 0; display: inline-flex; align-items: center; justify-content: center; }
.shead .stitle { flex: 1; min-width: 0; font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: .03em; }
.shead .snote { flex: none; color: var(--muted); font-size: 14px; }

button { appearance: none; border: 0; background: transparent; color: var(--text);
  font: 600 16px/1.25 var(--sans); letter-spacing: .01em; padding: 12px 24px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  box-shadow: inset 0 0 0 2px var(--edge); transition: background-color .25s, box-shadow .25s; }
button:hover:not(:disabled) { background: var(--rule); }
button.primary { background: var(--action); box-shadow: none; }
button.primary:hover:not(:disabled) { background: var(--action-hover); }
button.primary:active:not(:disabled) { background: var(--action-active); }
button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
button:disabled { opacity: .3; cursor: default; }

.styles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.scard { min-height: 0; padding: 8px 8px 12px; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; text-align: left; border-radius: 12px; background: var(--panel); box-shadow: none; font-weight: 400; }
.scard:hover:not(:disabled) { background: var(--rule); }
.scard.sel, .scard.sel:hover { background: var(--panel); box-shadow: inset 0 0 0 2px #fff; }
.scard .cover { display: block; aspect-ratio: 3 / 2; border-radius: 6px; overflow: hidden; background: #fff; }
.scard .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scard .cover.empty { display: flex; align-items: center; justify-content: center; background: var(--utility); color: var(--muted); font-size: 12px; }
.scard .sname { display: block; margin-top: 10px; padding: 0 4px; font-size: 16px; line-height: 1.5; font-weight: 600; letter-spacing: .02em; color: var(--text); }
.scard .stech { display: block; padding: 0 4px; font-size: 12px; line-height: 1.45; letter-spacing: .02em; color: var(--muted); text-wrap: balance; }

.stage { background: var(--panel); border-radius: 12px; padding: 16px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 260px; background: var(--input); border: 1.5px dashed var(--edge); border-radius: 8px; cursor: pointer; text-align: center; padding: 24px; color: var(--muted); font-size: 14px; }
.drop svg { width: 40px; height: 40px; stroke: var(--text); margin-bottom: 4px; }
.drop strong { color: var(--text); font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: .03em; }
.frame { position: relative; display: flex; align-items: center; justify-content: center; background: var(--utility); border-radius: 8px; overflow: hidden; }
.frame img { display: block; max-width: 100%; max-height: 62vh; }
.tag { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; line-height: 1.45; font-weight: 600; padding: 4px 12px; border-radius: 20px; }
.loading { position: absolute; inset: 0; display: none; flex-direction: column; gap: 12px; align-items: center; justify-content: center; background: rgba(0,0,0,.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); color: var(--text); font-weight: 600; text-align: center; padding: 24px; }
.loading.on { display: flex; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--edge); border-top-color: #fff; border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading small { color: var(--support); font-size: 14px; font-weight: 400; }

.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin: 12px 2px 0; }

.actions { display: grid; gap: 8px; margin-top: 16px; }
.actions:not(:has(> :not(.hidden))) { margin-top: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.error { display: none; margin-top: 16px; padding: 12px 16px; border-radius: 4px; background: var(--input); box-shadow: inset 3px 0 0 var(--action); color: var(--text); font-size: 14px; }
.error.on { display: block; }
.toggle { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.toggle button { min-height: 36px; padding: 6px 16px; font-size: 14px; background: var(--utility); color: var(--muted); box-shadow: none; transition: background-color .2s, color .2s; }
.toggle button:hover:not(:disabled) { background: var(--rule); color: var(--text); }
.toggle button.sel { background: var(--text); color: #000; }

.hgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hcard { position: relative; background: var(--panel); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.hcard .hdel { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 50%; background: rgba(0,0,0,.72); box-shadow: inset 0 0 0 2px var(--edge); color: #fff; font-size: 14px; line-height: 1; }
.hcard .hdel:hover:not(:disabled) { background: var(--rule); }
.hcard a { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; background: var(--utility); border-radius: 6px; overflow: hidden; }
.hcard img { max-width: 100%; max-height: 100%; display: block; }
.hcard .when { font-size: 12px; line-height: 1.45; color: var(--muted); padding: 0 4px; }
.hcard .when b { display: block; color: var(--text); font-weight: 600; font-size: 14px; line-height: 1.5; }
.hcard button { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.hidden { display: none !important; }
