:root {
  color-scheme: dark;
  --ink: #f7f4f2;
  --muted: #aaa5a5;
  --surface: rgba(19, 19, 22, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --accent: #ff4f87;
  --accent-2: #ffcfbc;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: #101014; }
body { overflow: hidden; color: var(--ink); }
button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }

.app-shell { position: relative; width: 100%; height: 100dvh; min-height: 560px; overflow: hidden; background: #101014; }
.camera-stage { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(circle at 50% 42%, #303036 0, #17171b 42%, #0c0c0f 100%); }
#camera, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#camera { opacity: 0; transition: opacity .35s ease; }
#camera.active { opacity: 1; }
#camera.mirrored { transform: scaleX(-1); }
#overlay { z-index: 2; pointer-events: none; }
.ambient-grid { position: absolute; inset: 0; opacity: .14; background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to bottom, transparent, #000 30%, transparent 82%); }

.topbar { position: absolute; z-index: 6; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: max(18px, env(safe-area-inset-top)) 20px 12px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 18px/1 Georgia, serif; letter-spacing: 0; text-shadow: 0 1px 12px rgba(0,0,0,.45); }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; color: #191218; background: var(--accent-2); border-radius: 50% 50% 45% 45%; font: italic 700 19px Georgia, serif; box-shadow: inset 0 -4px 8px rgba(174,78,103,.2); }
.top-actions { display: flex; gap: 8px; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; color: #fff; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; background: rgba(17,17,19,.56); backdrop-filter: blur(12px); }
.icon-button svg, .primary-button svg, .replace-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.welcome { position: absolute; z-index: 4; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 90px 28px 42px; text-align: center; }
.welcome-visual { position: relative; width: 196px; height: 154px; margin-bottom: 20px; }
.welcome-visual::after { content: ""; position: absolute; inset: 25px 20px 0; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 60px rgba(255,79,135,.11); }
.nail-demo { position: absolute; z-index: 1; width: 34px; height: 72px; border-radius: 48% 48% 42% 42%; transform-origin: 50% 100%; box-shadow: inset 4px 4px 7px rgba(255,255,255,.34), inset -4px -7px 9px rgba(74,5,37,.32), 0 12px 24px rgba(0,0,0,.28); }
.nail-demo::after { content: ""; position: absolute; top: 8px; left: 7px; width: 7px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.45); filter: blur(1px); }
.nail-demo-1 { left: 18px; bottom: 22px; transform: rotate(-24deg); background: linear-gradient(#ffc4d6, #d52967); }
.nail-demo-2 { left: 56px; bottom: 48px; transform: rotate(-8deg); background: linear-gradient(150deg, #451026, #fc5c96 54%, #ffd6c8); }
.nail-demo-3 { right: 56px; bottom: 48px; transform: rotate(8deg); background: radial-gradient(circle at 60% 25%, #fff8 0 3px, transparent 4px), linear-gradient(#ffb9cf, #ac174d); }
.nail-demo-4 { right: 18px; bottom: 22px; transform: rotate(24deg); background: linear-gradient(#f7e0db, #fd6a9d); }
.eyebrow { margin: 0 0 12px; color: #f5a8bf; font-size: 11px; font-weight: 800; letter-spacing: 2.5px; }
h1 { margin: 0; font: 600 clamp(34px, 8vw, 50px)/1.16 Georgia, "Songti SC", serif; letter-spacing: 0; }
.welcome-copy { max-width: 320px; margin: 16px 0 24px; color: #bbb5b7; font-size: 14px; line-height: 1.7; }
.welcome-actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: min(100%, 318px); }
.primary-button, .secondary-button { display: flex; align-items: center; justify-content: center; gap: 9px; height: 52px; border-radius: 8px; cursor: pointer; }
.primary-button { color: #24131b; background: linear-gradient(110deg, #ffc8d9, #ff7ca7); font-weight: 800; box-shadow: 0 14px 36px rgba(255,79,135,.22); }
.secondary-button { color: #ddd7d8; border: 1px solid var(--line); background: rgba(255,255,255,.04); }

.tracking-status { position: absolute; z-index: 5; top: max(78px, calc(env(safe-area-inset-top) + 60px)); left: 50%; display: flex; align-items: center; gap: 8px; padding: 8px 13px; transform: translateX(-50%); white-space: nowrap; color: #f5f1f2; background: rgba(9,9,11,.58); border: 1px solid rgba(255,255,255,.1); border-radius: 999px; backdrop-filter: blur(10px); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #ffc052; box-shadow: 0 0 10px currentColor; }
.tracking-status.found .status-dot { background: #74e3a2; }
.hand-guide { position: absolute; z-index: 3; left: 50%; top: 44%; width: 154px; height: 210px; transform: translate(-50%, -50%); opacity: .56; transition: opacity .2s; }
.guide-palm { position: absolute; left: 33px; bottom: 4px; width: 91px; height: 112px; border: 1px dashed rgba(255,255,255,.66); border-radius: 44% 44% 48% 48%; }
.guide-finger { position: absolute; width: 24px; border: 1px dashed rgba(255,255,255,.66); border-radius: 20px; }
.f1 { left: 5px; top: 85px; height: 70px; transform: rotate(-42deg); }.f2 { left: 35px; top: 32px; height: 92px; transform: rotate(-8deg); }.f3 { left: 66px; top: 5px; height: 112px; }.f4 { left: 97px; top: 23px; height: 97px; transform: rotate(7deg); }.f5 { left: 124px; top: 60px; height: 72px; transform: rotate(16deg); }

.control-sheet { position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; padding: 8px 18px max(14px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid rgba(255,255,255,.12); border-radius: 8px 8px 0 0; backdrop-filter: blur(20px); box-shadow: 0 -18px 60px rgba(0,0,0,.28); }
.sheet-handle { width: 34px; height: 4px; margin: 0 auto 12px; border-radius: 4px; background: #555158; }
.style-summary { display: grid; grid-template-columns: 48px minmax(0,1fr) 40px; align-items: center; gap: 12px; }
.style-thumb { width: 48px; height: 58px; border-radius: 8px; background-position: center; background-size: cover; border: 1px solid rgba(255,255,255,.13); }
.style-info { min-width: 0; }
.style-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.style-title-row h2 { overflow: hidden; margin: 0; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.live-badge { flex: none; padding: 3px 6px; color: #ffb4ca; background: rgba(255,79,135,.13); border-radius: 4px; font-size: 9px; font-weight: 700; }
.style-info p { overflow: hidden; margin: 5px 0 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.replace-button { display: grid; place-items: center; width: 40px; height: 40px; color: #e8e3e4; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.preset-scroller { display: flex; gap: 10px; margin: 14px -18px 0; padding: 0 18px 2px; overflow-x: auto; scrollbar-width: none; }
.preset-scroller::-webkit-scrollbar { display: none; }
.preset { position: relative; flex: 0 0 46px; width: 46px; height: 56px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 8px; background: #29272b; cursor: pointer; }
.preset.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.preset img { width: 100%; height: 100%; object-fit: cover; }
.adjustments { display: grid; grid-template-columns: auto 1fr 38px; align-items: center; gap: 10px; margin-top: 13px; color: #c9c4c5; font-size: 11px; }
.adjustments input { width: 100%; accent-color: var(--accent); }
.adjustments span { text-align: right; color: #fff; font-variant-numeric: tabular-nums; }
.privacy-note { margin: 10px 0 0; color: #777278; text-align: center; font-size: 10px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 32px; max-width: calc(100% - 40px); padding: 10px 16px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; color: #fff; background: rgba(12,12,14,.9); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.hidden { display: none !important; }

@media (min-width: 740px) {
  .app-shell { width: min(100%, 520px); margin: 0 auto; box-shadow: 0 0 80px rgba(0,0,0,.5); }
  body { background: #08080a; }
}
@media (max-height: 680px) {
  .welcome-visual { width: 155px; height: 112px; margin-bottom: 12px; transform: scale(.82); }
  .welcome { padding-top: 70px; }
  h1 { font-size: 31px; }
  .welcome-copy { margin: 10px 0 16px; }
  .control-sheet { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .preset-scroller { margin-top: 9px; }
  .privacy-note { display: none; }
}
