:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --surface-soft: #f7f7f7;
  --text: #111111;
  --muted: #737373;
  --subtle: #a0a0a0;
  --line: #e5e5e5;
  --line-strong: #d2d2d2;
  --pressed: #ededed;
  --danger: #ba1a1a;
  --radius: 16px;
  --content-width: 390px;
  --device-height: 844px;
  --header-height: 56px;
  --bottom-nav-height: 68px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input, textarea { font: inherit; }

button {
  color: inherit;
  border: 0;
  cursor: pointer;
}

a { color: inherit; text-decoration: none; }

svg { display: block; }

.device-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.device-frame {
  position: relative;
  width: var(--content-width);
  height: min(var(--device-height), calc(100vh - 56px));
  overflow: hidden;
  background: var(--surface);
  border: 10px solid #151515;
  border-radius: 48px;
  box-shadow: 0 24px 70px rgba(0,0,0,.24), 0 0 0 1px #4b4b4b;
  transform: translateZ(0);
}

.device-status {
  position: absolute;
  z-index: 80;
  inset: 0 0 auto;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
}

.device-island {
  width: 88px;
  height: 23px;
  background: #111;
  border-radius: 999px;
}

.device-home {
  position: absolute;
  z-index: 82;
  left: 50%;
  bottom: 6px;
  width: 116px;
  height: 4px;
  background: #111;
  border-radius: 999px;
  transform: translateX(-50%);
}

.app-shell {
  position: absolute;
  inset: 32px 0 0;
  width: 100%;
  height: calc(100% - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
  scrollbar-width: none;
}

.app-shell::-webkit-scrollbar { display: none; }

.page {
  min-height: calc(var(--device-height) - 32px);
  padding-bottom: calc(var(--bottom-nav-height) + 24px + env(safe-area-inset-bottom));
}

.page--no-nav { padding-bottom: 32px; }

.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.hidden { display: none !important; }

.icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--small { width: 18px; height: 18px; }

.toast {
  position: absolute;
  z-index: 140;
  left: 50%;
  top: 50%;
  width: max-content;
  max-width: calc(100% - 56px);
  padding: 11px 16px;
  color: #fff;
  background: rgba(17,17,17,.9);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 10px));
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, -50%); }

@media (max-width: 460px) {
  .device-stage { padding: 0; display: block; }
  .device-frame { width: 100vw; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .device-status,
  .device-home { display: none; }
  .app-shell { inset: 0; height: 100%; }
  .gallery-overlay { border-radius: 0; }
  .page { min-height: 100dvh; }
}

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