/* ============================================================================
   Degold Media — AI Avatar Generator
   Deep near-black · warm amber accent · Bricolage Grotesque / DM Sans / JetBrains Mono
   (Visual identity copied from the Degold Media AI Studio image tool so the two
    tools feel like one product.)
   ========================================================================== */

:root {
  --bg:        #0a0a0c;
  --bg-2:      #111118;
  --bg-3:      #181820;
  --raised:    #1f1f29;
  --ink:       #f4f1ea;
  --ink-dim:   #a6a29a;
  --ink-faint: #6c6860;
  --line:      #262630;
  --line-soft: #1d1d26;
  --accent:    #ff8a3d;
  --accent-hi: #ffb27a;
  --accent-dim:#7a4a26;
  --good:      #58d29a;
  --bad:       #ff6b6b;
  --info:      #6ca8ff;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 18px 50px -18px rgba(0,0,0,.7);
  --ring:      0 0 0 3px rgba(255,138,61,.25);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* atmospheric amber glow at the top */
body::before {
  content: "";
  position: fixed;
  inset: -20% 0 auto 0;
  height: 60vh;
  background:
    radial-gradient(60% 60% at 75% 0%, rgba(255,138,61,.14), transparent 70%),
    radial-gradient(50% 50% at 15% 5%, rgba(108,168,255,.06), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
/* fine film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap { position: relative; z-index: 1; max-width: 1000px; margin: 0 auto; padding: 22px 22px 100px; }

/* ---- topbar ------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; margin-bottom: 26px;
  background: linear-gradient(180deg, rgba(31,31,41,.5), rgba(17,17,24,.4));
  border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 11px; font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 1.02rem; letter-spacing: -.01em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), #d75f1e);
  box-shadow: 0 4px 14px -3px rgba(255,138,61,.6), inset 0 1px 0 rgba(255,255,255,.3);
}
.brand-mark::after { content: ""; width: 0; height: 0; margin-left: 2px;
  border-left: 8px solid #1a0e06; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: .86rem; }
.topbar-right a { color: var(--ink-dim); text-decoration: none; transition: color .15s; }
.topbar-right a:hover { color: var(--accent); }
#whoami { color: var(--ink-dim); }
#whoami b, .user-chip { color: var(--ink); }

/* ---- header ------------------------------------------------------------- */
header { margin-bottom: 22px; animation: rise .6s both; }
header h1 {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 800;
  font-size: clamp(1.9rem, 4vw, 2.7rem); line-height: 1.02;
  letter-spacing: -.025em; margin: 0 0 8px;
}
header h1 .accent { color: var(--accent); }
.sub { color: var(--ink-dim); margin: 0; max-width: 60ch; font-size: .98rem; }
.sub a { color: var(--accent); text-decoration: none; }
.sub a:hover { text-decoration: underline; }

/* ---- panels ------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--bg-2), #0e0e14);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  animation: rise .6s both;
}
.card h2 {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 700;
  font-size: 1.15rem; letter-spacing: -.01em; margin: 0 0 16px;
  display: flex; align-items: center; gap: 9px;
}
.card h3 { font-family: "Bricolage Grotesque", sans-serif; font-weight: 600; font-size: 1rem; margin: 0 0 10px; }

/* ---- forms -------------------------------------------------------------- */
label { display: block; font-size: .8rem; font-weight: 500; color: var(--ink-dim);
  margin-bottom: 16px; letter-spacing: .02em; }
label.grow { flex: 1; }

input, select, textarea {
  width: 100%; margin-top: 7px;
  background: var(--bg-3); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; font: inherit; font-size: .92rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring); background: #14141b;
}
select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23a6a29a' stroke-width='1.6'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
textarea { resize: vertical; line-height: 1.5; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 190px; margin-bottom: 16px; }

/* range slider */
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent;
  padding: 0; margin-top: 12px; height: 22px; cursor: pointer; box-shadow: none; }
input[type=range]:focus { box-shadow: none; }
input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dim) 60%, var(--line)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 17px; height: 17px;
  margin-top: -6px; border-radius: 50%; background: var(--accent);
  border: 3px solid #14141b; box-shadow: 0 2px 8px rgba(255,138,61,.5); }

/* checkbox / radio rows */
label.check { display: flex; align-items: center; gap: 11px; color: var(--ink);
  font-size: .9rem; font-weight: 500; padding: 12px 14px; margin-bottom: 12px;
  background: var(--bg-3); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
label.check:hover { border-color: var(--line); }
label.check input { width: auto; margin: 0; accent-color: var(--accent); width: 17px; height: 17px; }
label.check.sel { border-color: var(--accent); box-shadow: var(--ring); }

/* ---- buttons ------------------------------------------------------------ */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: #1c0f05; border: none; border-radius: var(--radius-sm);
  padding: 12px 22px; font: inherit; font-weight: 700; font-size: .95rem;
  letter-spacing: .01em; cursor: pointer; text-decoration: none;
  box-shadow: 0 6px 18px -6px rgba(255,138,61,.55), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .12s, box-shadow .15s, filter .15s;
}
button:hover:not(:disabled), .btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.3); }
#go { width: 100%; margin-top: 6px; padding: 14px; font-size: 1rem; }

.btn.small { padding: 8px 14px; font-size: .82rem; }
/* outline / ghost variants */
.btn-ghost, .regen {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  box-shadow: none; font-weight: 600;
}
.btn-ghost:hover, .regen:hover:not(:disabled) {
  background: var(--bg-3); border-color: var(--accent); color: var(--accent); filter: none; transform: none;
}

/* ---- status banner ------------------------------------------------------ */
.banner {
  display: flex; gap: 8px; align-items: flex-start;
  border-radius: var(--radius-sm); padding: 11px 15px; margin-bottom: 20px;
  font-size: .86rem; line-height: 1.5;
  background: rgba(255,107,107,.08); border: 1px solid rgba(255,107,107,.35); color: #ffc9c9;
}
.banner.ok { background: rgba(88,210,154,.08); border-color: rgba(88,210,154,.35); color: #b7f0d6; }

.hint { color: var(--ink-dim); font-size: .84rem; margin-top: 8px; }
.muted { color: var(--ink-faint); font-weight: 400; font-size: .85em; }
.hidden { display: none !important; }
code { font-family: "JetBrains Mono", monospace; background: var(--bg-3);
  padding: 2px 6px; border-radius: 5px; font-size: .85em; color: var(--accent-hi);
  border: 1px solid var(--line-soft); }
a { color: var(--accent); }

details.adv { margin-bottom: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 4px 14px; background: var(--bg-3); }
details.adv summary { cursor: pointer; font-size: .85rem; color: var(--ink-dim); padding: 8px 0; font-weight: 600; letter-spacing: .02em; }
details.adv[open] summary { color: var(--accent); }

/* ---- progress stepper --------------------------------------------------- */
.stages { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.stage {
  font-size: .74rem; font-weight: 600; letter-spacing: .03em;
  padding: 6px 13px; border-radius: 20px;
  background: var(--bg-3); color: var(--ink-faint); border: 1px solid var(--line-soft);
  transition: all .25s;
}
.stage.done { color: var(--good); border-color: rgba(88,210,154,.4); background: rgba(88,210,154,.07); }
.stage.active {
  color: #1c0f05; background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border-color: transparent; box-shadow: 0 4px 14px -4px rgba(255,138,61,.6);
}
#statusMsg { color: var(--ink-dim); font-size: .9rem; min-height: 1.2em; }

/* ---- segment grid (avatar clips) --------------------------------------- */
.storyboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 18px; }
.beat {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color .2s, transform .2s;
}
.beat:hover { border-color: #34343f; transform: translateY(-2px); }
.beat .thumb {
  aspect-ratio: 16/9; background: #08080b; display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font-size: .78rem; font-family: "JetBrains Mono", monospace;
}
.beat .thumb img, .beat .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.beat .meta { padding: 11px 12px 12px; }
.beat .tc { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 8px; }
.tcrange { font-family: "JetBrains Mono", monospace; font-size: .74rem; color: var(--accent); font-weight: 500;
  background: rgba(255,138,61,.1); padding: 2px 7px; border-radius: 5px; }
.badge { display: inline-block; font-size: .66rem; font-weight: 600; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 20px; color: var(--info);
  background: rgba(108,168,255,.12); border: 1px solid rgba(108,168,255,.3); }
.badge.warn { color: var(--accent-hi); background: rgba(255,138,61,.12); border-color: rgba(255,138,61,.35); }
.badge.ok { color: var(--good); background: rgba(88,210,154,.12); border-color: rgba(88,210,154,.3); }
.badge.err { color: var(--bad); background: rgba(255,107,107,.12); border-color: rgba(255,107,107,.35); }
.beat .err { color: var(--bad); font-size: .76rem; margin-top: 7px; line-height: 1.4; }

.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- result ------------------------------------------------------------- */
#downloadBlock { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---- history ------------------------------------------------------------ */
.history { display: flex; flex-direction: column; gap: 10px; }
.hist-item { display: flex; align-items: center; gap: 14px;
  background: var(--bg-3); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 9px 12px; transition: border-color .2s; }
.hist-item:hover { border-color: var(--line); }
.hist-meta { flex: 1; min-width: 0; }
.hist-title { font-weight: 600; font-size: .92rem; }
.hist-title b { color: var(--accent); }

/* ---- login -------------------------------------------------------------- */
.login-wrap { position: relative; z-index: 1; max-width: 400px; margin: 12vh auto; padding: 0 22px; text-align: center; }
.login-wrap h1 { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800;
  font-size: 2rem; letter-spacing: -.02em; margin: 0; }
.login-wrap .sub { margin: 8px auto 0; }
.login-wrap form { text-align: left; margin-top: 22px; }
.login-wrap button { width: 100%; margin-top: 10px; padding: 13px; }
.login-mark { width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), #d75f1e);
  box-shadow: 0 10px 30px -8px rgba(255,138,61,.6), inset 0 1px 0 rgba(255,255,255,.3); }
.login-mark::after { content: ""; border-left: 16px solid #1a0e06; border-top: 10px solid transparent;
  border-bottom: 10px solid transparent; margin-left: 4px; }

/* ---- entrance animation ------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card:nth-of-type(1) { animation-delay: .05s; }
.card:nth-of-type(2) { animation-delay: .12s; }
.card:nth-of-type(3) { animation-delay: .19s; }

@media (max-width: 560px) {
  .wrap { padding: 16px 14px 80px; }
  .topbar { flex-direction: column; gap: 10px; align-items: flex-start; }
}
