:root {
  color-scheme: dark;
  --bg: #080808;
  --panel: #151513;
  --panel-2: #1c1b18;
  --line: #3b3832;
  --line-soft: #292722;
  --text: #f1ecdf;
  --muted: #9e9688;
  --accent: #d5bd94;
  --accent-dark: #9a8769;
  --blue: #1689ff;
  --green: #8bd977;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% 5%, rgba(212,188,148,.1), transparent 35%),
    #070707;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { visibility: hidden !important; pointer-events: none !important; }

.app-shell {
  position: relative;
  width: min(100%, 500px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(175,151,112,.08), transparent 36%),
    linear-gradient(180deg, #11110f 0%, #080808 70%);
  box-shadow: 0 25px 80px rgba(0,0,0,.55);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 64px;
  padding: max(8px, env(safe-area-inset-top)) 18px 8px;
  display: grid;
  grid-template-columns: 86px 1fr 86px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: rgba(24,24,24,.92);
  backdrop-filter: blur(22px);
}
.telegram-hosted .topbar { display: none; }
.topbar-dot {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #3a91ff;
  background: #191919;
}
.topbar-action {
  width: auto;
  height: 36px;
  padding: 0;
  border: 0;
  justify-self: start;
  color: #3a91ff;
  background: transparent;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.topbar-dot { justify-self: end; font-size: 13px; letter-spacing: 1px; }
.topbar-title { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.topbar-title strong { font-size: 16px; }
.topbar-title span { margin-top: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .55px; }

.screen {
  position: relative;
  z-index: 2;
  display: none;
  min-height: calc(100dvh - 64px);
  padding: 38px 24px max(30px, env(safe-area-inset-bottom));
  animation: screen-in .25s ease both;
}
.telegram-hosted .screen { min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }
@keyframes screen-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

h1, h2 { margin: 0; color: var(--text); line-height: 1.08; letter-spacing: -.7px; }
h1 { font-size: clamp(34px, 9vw, 45px); }
h2 { font-size: clamp(29px, 7.8vw, 36px); }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: 2px; }

/* Welcome */
.screen-welcome { justify-content: flex-start; padding-top: 22px; }
.hero-brand {
  position: relative;
  width: calc(100% + 28px);
  height: clamp(320px, 48dvh, 390px);
  margin: -10px -14px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.hero-brand::after {
  content: "";
  position: absolute;
  inset: 12% 5% 1%;
  z-index: -1;
  background: radial-gradient(circle, rgba(213,188,146,.1), transparent 66%);
  filter: blur(16px);
}
.hero-mountain {
  position: absolute;
  top: 0;
  left: 50%;
  width: 116%;
  height: 82%;
  transform: translateX(-50%);
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 20px 28px rgba(0,0,0,.48));
}
.hero-wordmark {
  position: relative;
  z-index: 2;
  margin-bottom: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-shadow: 0 3px 12px #000;
}
.hero-wordmark strong {
  font-family: "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  font-size: clamp(43px, 12vw, 64px);
  font-stretch: condensed;
  font-weight: 900;
  line-height: .82;
  letter-spacing: -3px;
  text-transform: lowercase;
  color: #dfd4bf;
}
.hero-wordmark span {
  margin-top: 11px;
  color: #c7ad80;
  font-size: 25px;
  font-weight: 480;
  letter-spacing: 12px;
  text-transform: lowercase;
  transform: translateX(6px);
}
.welcome-copy { margin: 18px 0 24px; text-align: center; }
.action-stack { display: grid; gap: 14px; }

.button {
  width: 100%;
  min-height: 62px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--text);
  background: linear-gradient(180deg, #20201e, #141412);
  font-weight: 680;
  cursor: pointer;
  transition: transform .13s ease, filter .13s ease, border-color .13s ease;
}
.button:active { transform: scale(.985); }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button-primary { box-shadow: inset 0 1px rgba(255,255,255,.035); }
.button-accent {
  border-color: #a89679;
  background: linear-gradient(180deg, #555046, #332f28);
  box-shadow: inset 0 1px rgba(255,255,255,.13);
}
.button-icon { margin-right: 8px; color: #e2cda7; font-size: 22px; vertical-align: -2px; }
.private-note { margin: 27px auto 0; color: #777167; font-size: 13px; }
.lock-icon {
  position: relative;
  display: inline-block;
  width: 11px;
  height: 9px;
  margin-right: 8px;
  border-radius: 2px;
  background: currentColor;
  vertical-align: -1px;
}
.lock-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -7px;
  width: 7px;
  height: 8px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

/* Source and configuration */
.section-heading { margin: 28px 0 34px; text-align: center; }
.section-heading p { margin: 12px auto 0; max-width: 310px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.youtube-brand {
  margin: 54px auto 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  color: #eee7dc;
  font-size: 21px;
  letter-spacing: -.4px;
}
.youtube-mark {
  position: relative;
  width: 98px;
  height: 68px;
  border: 1px solid rgba(255,121,105,.58);
  border-radius: 23px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ef4b3d, #a71916);
  box-shadow: 0 14px 40px rgba(207,35,28,.23), inset 0 1px rgba(255,255,255,.28);
}
.youtube-mark::after {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: -1;
  border-radius: 36px;
  background: radial-gradient(circle, rgba(222,66,51,.18), transparent 68%);
}
.youtube-mark span {
  width: 0;
  height: 0;
  margin-left: 6px;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-left: 21px solid #fff8ed;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.25));
}
.youtube-input-icon { color: #df4a3f !important; font-size: 15px !important; }
.drop-card {
  min-height: 245px;
  border: 1px solid var(--line);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text);
  background: linear-gradient(145deg, rgba(30,29,26,.82), rgba(13,13,12,.94));
  cursor: pointer;
}
.drop-card strong { font-size: 22px; }
.drop-card small { color: #ab9e89; font-size: 11px; letter-spacing: .25px; }
.folder-icon {
  position: relative;
  width: 77px;
  height: 77px;
  margin-bottom: 4px;
  border: 1px solid #4d4941;
  border-radius: 22px;
  display: block;
  overflow: hidden;
  color: transparent;
  background: #25231f;
}
.folder-icon::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 27px;
  width: 43px;
  height: 30px;
  border-radius: 5px;
  background: linear-gradient(180deg, #dac9a9, #9e8c70);
  box-shadow: inset 0 1px rgba(255,255,255,.3);
}
.folder-icon::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 22px;
  width: 19px;
  height: 10px;
  border-radius: 4px 4px 0 0;
  background: #cbb996;
}
.divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: #716b61; font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.input-box {
  min-height: 62px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(21,21,19,.86);
}
.input-box:focus-within { border-color: #827761; box-shadow: 0 0 0 3px rgba(190,169,132,.08); }
.input-box > span { color: var(--accent); font-size: 19px; }
.input-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 16px; }
.input-box input::placeholder { color: #716c63; }
.youtube-input + .button { margin-top: 34px; }

.track-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(145deg, #1c1b19, #10100f);
}
.track-icon {
  flex: 0 0 61px;
  height: 61px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #211c14;
  background: linear-gradient(145deg, #e0cda9, #9a8668);
  font-size: 29px;
}
.track-info { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.track-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.track-info span { color: var(--muted); font-size: 12px; }
.field-label { display: block; margin: 21px 3px 9px; color: var(--muted); font-size: 12px; }
.title-input > span { font-size: 16px; }
.title-helper {
  margin: 10px 4px 0;
  padding: 11px 13px;
  border-left: 2px solid var(--accent);
  border-radius: 0 10px 10px 0;
  color: #c6bcae;
  background: rgba(213,189,148,.07);
  font-size: 12px;
  line-height: 1.45;
}
.mode-fieldset { margin: 21px 0 0; padding: 0; border: 0; }
.mode-fieldset legend { margin: 0 3px 10px; color: var(--muted); font-size: 12px; }
.mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.mode-switch button {
  min-height: 57px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--text);
  background: #151513;
  cursor: pointer;
}
.mode-switch button.selected {
  color: #19150f;
  border-color: #d1bea0;
  background: linear-gradient(180deg, #d5c5a9, #9c8c73);
  box-shadow: inset 0 1px rgba(255,255,255,.35);
}
.preview-block .field-label { margin-top: 22px; }
.mini-player {
  min-height: 64px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  grid-template-columns: 37px 1fr auto;
  align-items: center;
  background: #121210;
}
.mini-player .wave {
  width: 28px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.mini-player .wave i {
  width: 2px;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 4px rgba(213,189,148,.28);
}
.mini-player .wave i:nth-child(1) { height: 10px; }
.mini-player .wave i:nth-child(2) { height: 20px; }
.mini-player .wave i:nth-child(3) { height: 28px; }
.mini-player .wave i:nth-child(4) { height: 18px; }
.mini-player .wave i:nth-child(5) { height: 12px; }
.mini-player strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mini-player small { color: var(--muted); font-size: 10px; }
.config-spacer { flex: 1; min-height: 28px; }

/* Processing */
.processing-screen { align-items: center; text-align: center; padding-top: 39px; }
.processing-heading { align-self: center; width: 100%; margin-left: 0; text-align: center; font-size: 32px; }
.vinyl-stage { position: relative; width: 284px; height: 284px; margin: 25px auto 20px; }
.vinyl-stage::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -12px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,.75);
  filter: blur(13px);
}
.vinyl-record {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, transparent 0 14%, rgba(255,255,255,.08) 14.3% 14.7%, transparent 15% 24%, rgba(255,255,255,.055) 24.3% 24.7%, transparent 25% 34%, rgba(255,255,255,.04) 34.3% 34.7%, transparent 35% 46%, rgba(255,255,255,.04) 46.3% 46.7%, transparent 47%),
    repeating-radial-gradient(circle, #171717 0 2px, #090909 3px 5px),
    conic-gradient(from 25deg, #080808, #2d2b29 7%, #090909 15%, #393532 23%, #080808 33%, #272522 42%, #080808 52%, #35322f 61%, #080808 72%, #2c2927 82%, #080808 100%);
  box-shadow: inset 0 0 0 2px #050505, inset 0 0 30px #000, 0 20px 35px rgba(0,0,0,.5);
  animation: vinyl-spin 10s linear infinite;
}
@keyframes vinyl-spin { to { transform: rotate(360deg); } }
.vinyl-label {
  width: 96px;
  height: 96px;
  padding: 7px;
  overflow: hidden;
  border: 1px solid #f1d8ab;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e7cfaa;
  box-shadow: 0 0 0 3px #111, inset 0 0 13px rgba(80,52,17,.23);
}
.vinyl-label img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.processing-screen > p#processingStatus { margin: 0 0 14px; color: #d9c39d; font-size: 15px; }
.progress-row { width: 100%; display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 10px; }
.progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: #302d28; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #e2c194, #f4d9ad); transition: width .35s ease; }
.progress-row > span { color: #e2cda7; font-size: 16px; text-align: right; }
.processing-job-card {
  width: 100%;
  margin-top: 22px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 23px;
  display: flex;
  align-items: center;
  gap: 15px;
  background: linear-gradient(135deg, rgba(40,39,35,.88), rgba(18,18,16,.96));
  text-align: left;
}
.processing-job-card img { width: 83px; height: 83px; object-fit: cover; border-radius: 15px; }
.processing-job-card > div { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.processing-job-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 19px; }
.processing-job-card span { color: #c9c0b3; font-size: 14px; }
.processing-job-card span i { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent); }
.processing-job-card small { color: var(--muted); font-size: 13px; }
.processing-note { margin: auto auto 0 !important; padding-top: 30px; max-width: 350px; color: #a59c8e !important; font-size: 13px !important; line-height: 1.5; text-align: center; }
.processing-note strong { display: block; margin-bottom: 3px; color: #e0cba7; font-size: 14px; }

/* Result */
.result-screen, .error-screen { align-items: center; text-align: center; padding-top: 48px; }
.success-mark, .error-mark {
  width: 112px;
  height: 112px;
  margin: 4px auto 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 51px;
}
.success-mark { border: 3px solid var(--green); color: var(--green); background: rgba(94,180,79,.08); box-shadow: 0 0 32px rgba(114,218,91,.23), inset 0 0 25px rgba(114,218,91,.08); }
.error-mark { color: #2a1210; background: #d98d83; }
.download-list { width: 100%; display: grid; gap: 12px; margin-top: 36px; }
.download-link {
  min-height: 86px;
  padding: 12px 16px;
  border: 1px solid #47433d;
  border-radius: 22px;
  display: grid;
  grid-template-columns: 55px 1fr 48px;
  align-items: center;
  gap: 13px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(51,49,44,.95), rgba(29,29,27,.98));
  text-align: left;
  text-decoration: none;
}
.download-file-icon {
  width: 55px;
  height: 55px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #1d1811;
  background: linear-gradient(145deg, #f1d7ac, #c3a475);
  font-size: 27px;
}
.download-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.download-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.download-copy small { color: #aaa194; font-size: 12px; }
.download-action {
  width: 46px;
  height: 46px;
  border: 1px solid #55aaff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(180deg, #42a8ff, #0875dc);
  box-shadow: inset 0 1px rgba(255,255,255,.35);
  font-size: 24px;
}
.telegram-reminder { margin: 29px 9px 25px; color: #b5ada2; font-size: 13px; line-height: 1.5; }
.telegram-share {
  min-height: 66px;
  border-color: #efd3a8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #075fc3;
  background: linear-gradient(180deg, #f0d5ac, #d8b98e);
  font-size: 16px;
}
.telegram-button-icon { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; margin: 0; color: #0878da; font-size: 24px; line-height: 1; }
.telegram-button-label { margin: 0; color: inherit; font-size: inherit; line-height: 1.2; }
.telegram-share .telegram-logo { display: block; width: 27px; height: 27px; margin: 0; object-fit: contain; }
.publish-status { min-height: 19px; margin: 9px 8px 0; color: #aaa194; font-size: 12px; line-height: 1.4; }
.publish-status:empty { display: none; }
.button-quiet { margin-top: 11px; color: var(--muted); background: #121210; }
.error-screen > p { margin: 13px auto 28px; max-width: 340px; color: var(--muted); line-height: 1.45; }

/* Closed access */
.access-screen { align-items: center; justify-content: center; text-align: center; }
.access-lock {
  position: relative;
  width: 104px;
  height: 89px;
  margin-bottom: 30px;
  border: 1px solid #7c6c53;
  border-radius: 27px;
  display: grid;
  place-items: center;
  color: #231d14;
  background: linear-gradient(145deg, #e5cda4, #9e8560);
  box-shadow: 0 15px 50px rgba(194,158,104,.16), inset 0 1px rgba(255,255,255,.3);
}
.access-lock::before {
  content: "";
  position: absolute;
  left: 27px;
  top: -32px;
  width: 48px;
  height: 48px;
  border: 9px solid #c2a77d;
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
}
.access-lock span { width: 11px; height: 22px; border-radius: 7px; background: #292117; }
.access-screen > h2 { max-width: 350px; }
.access-screen > p { margin: 14px 0 29px; color: var(--muted); font-size: 15px; }
.telegram-id-card {
  width: 100%;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: linear-gradient(145deg, #1c1b19, #10100f);
  text-align: left;
}
.telegram-id-card span { color: var(--muted); font-size: 12px; }
.telegram-id-card strong { overflow: hidden; text-overflow: ellipsis; font-size: 17px; }
.copy-id-button { margin-top: 14px; }
.copy-status { min-height: 20px; margin: 11px 0 0 !important; color: #bda982 !important; font-size: 12px !important; }

/* New-track confirmation */
.confirm-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity .18s ease;
}
.confirm-overlay.visible { opacity: 1; }
.confirm-card {
  width: min(100%, 410px);
  padding: 28px 22px 21px;
  border: 1px solid #4a453d;
  border-radius: 28px;
  background: linear-gradient(155deg, #24221e, #11110f 72%);
  box-shadow: 0 26px 80px rgba(0,0,0,.7), inset 0 1px rgba(255,255,255,.05);
  text-align: center;
  transform: translateY(12px) scale(.98);
  transition: transform .18s ease;
}
.confirm-overlay.visible .confirm-card { transform: none; }
.confirm-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  color: #211b13;
  background: linear-gradient(145deg, #efd5aa, #aa8f68);
  font-size: 28px;
}
.confirm-card h2 { font-size: 27px; }
.confirm-card p { margin: 14px auto 24px; color: #b2aa9e; font-size: 14px; line-height: 1.5; }
.confirm-card .button { min-height: 58px; }

@media (min-width: 650px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100dvh - 48px); border: 1px solid #2a2824; border-radius: 34px; }
  .screen { min-height: calc(100dvh - 112px); }
  .topbar { border-radius: 34px 34px 0 0; }
}

@media (max-height: 760px) {
  .screen { padding-top: 22px; }
  .screen-welcome { padding-top: 10px; }
  .hero-brand { height: 315px; }
  .welcome-copy { margin: 8px 0 17px; }
  .private-note { margin-top: 17px; }
  .vinyl-stage { width: 225px; height: 225px; margin: 17px auto 13px; }
  .vinyl-label { width: 78px; height: 78px; }
  .processing-job-card { margin-top: 16px; }
  .processing-job-card img { width: 67px; height: 67px; }
  .processing-note { padding-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
