:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Noto Sans", Arial, sans-serif;
  color: #f7f8ff;
  background: #070914;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #070914;
  --surface: #11152a;
  --surface-2: #171c35;
  --surface-3: #202744;
  --text: #f7f8ff;
  --muted: #aeb7d0;
  --line: rgba(255,255,255,.11);
  --accent: #6d5dfc;
  --accent-2: #17c6ff;
  --danger: #ff5263;
  --radius: 18px;
  --header-h: 74px;
  --nav-h: 76px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --space: clamp(12px, 1.8vw, 20px);
  --font-base: clamp(14px, 1.6vw, 16px);
  --font-title: clamp(19px, 2.6vw, 26px);
  --font-hero: clamp(28px, 4.8vw, 54px);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: radial-gradient(circle at 12% 5%, #1f2350 0, transparent 35%), radial-gradient(circle at 90% 8%, #12364e 0, transparent 28%), var(--bg); font-size: var(--font-base); }
button, input, textarea, select { font: inherit; }
button, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(23,198,255,.65); outline-offset: 2px; }
img, video { max-width: 100%; display: block; }

.app-shell { position: fixed; inset: 0; width: 100%; height: 100dvh; overflow: hidden; display: grid; grid-template-rows: calc(var(--header-h) + var(--safe-top)) 1fr calc(var(--nav-h) + var(--safe-bottom)); }
.skip-link { position: fixed; left: 12px; top: 8px; z-index: 1000; transform: translateY(-180%); background: white; color: black; padding: 8px 12px; border-radius: 10px; }
.skip-link:focus { transform: none; }

.app-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + var(--safe-top)) var(--space) 10px; border-bottom: 1px solid var(--line); background: rgba(8,10,24,.88); backdrop-filter: blur(24px); z-index: 20; }
.brand { min-width: 0; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 42px; aspect-ratio: 1; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 20px; color: white; background: linear-gradient(145deg,#815cff,#16cfff 70%,#54f6af); box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 8px 24px rgba(66,90,255,.35); transform: perspective(500px) rotateX(8deg) rotateY(-9deg); }
.brand-copy { min-width: 0; display: grid; gap: 2px; }
.brand-name { font-size: clamp(15px,2vw,18px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-tagline { color: var(--muted); font-size: clamp(10px,1.4vw,12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(48vw, 430px); }
.language-switch { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); background: rgba(255,255,255,.05); border-radius: 14px; }
.language-button { min-width: 42px; min-height: 40px; padding: 7px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 800; }
.language-button[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg,#5c4bdf,#2777d9); box-shadow: 0 6px 16px rgba(67,84,230,.28); }

.app-content { position: relative; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: var(--space); scroll-behavior: smooth; }
.app-content::-webkit-scrollbar { display: none; }
.view-stack { width: min(1180px, 100%); margin: 0 auto; display: grid; gap: var(--space); padding-bottom: 8px; }
.view-title { margin: 0; font-size: var(--font-title); letter-spacing: -.02em; }
.section-title { margin: 0; font-size: var(--font-title); }
.section-text { margin: 0; color: var(--muted); line-height: 1.65; }
.card-title { margin: 0; font-size: clamp(16px,2vw,20px); }
.eyebrow { font-size: 11px; font-weight: 900; letter-spacing: .16em; color: #88dfff; }

.hero-panel { min-height: clamp(230px, 34vh, 360px); display: grid; grid-template-columns: minmax(0,1.12fr) minmax(260px,.88fr); align-items: center; gap: clamp(18px,5vw,64px); padding: clamp(22px,5vw,56px); overflow: hidden; position: relative; border: 1px solid rgba(255,255,255,.12); border-radius: 26px; background: linear-gradient(145deg,rgba(52,46,112,.78),rgba(13,19,47,.94) 45%,rgba(10,35,52,.82)); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 28px 55px rgba(0,0,0,.32); }
.hero-panel::before { content:""; position:absolute; width:42%; aspect-ratio:1; right:-10%; top:-35%; border-radius:50%; background: radial-gradient(circle,rgba(92,227,255,.36),transparent 67%); filter: blur(4px); }
.hero-content { position: relative; z-index: 2; display: grid; gap: 12px; }
.hero-title { margin: 0; max-width: 14ch; font-size: var(--font-hero); line-height: 1.08; letter-spacing: -.04em; }
.hero-text { margin: 0; max-width: 54ch; line-height: 1.6; color: #c7cde0; }
.hero-orbit { position: relative; width: min(36vw,360px); aspect-ratio: 1; margin-inline: auto; perspective: 800px; }
.hero-orbit::before { content:""; position:absolute; inset:14%; border-radius:50%; border:1px solid rgba(118,220,255,.24); box-shadow: 0 0 40px rgba(84,99,255,.14) inset; }
.orbit-card { position: absolute; width: clamp(88px,10vw,124px); min-height: 70px; display:grid; place-items:center; gap:3px; padding: 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; background: linear-gradient(150deg,rgba(255,255,255,.18),rgba(255,255,255,.06)); backdrop-filter: blur(16px); box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 16px 34px rgba(0,0,0,.28); transform-style: preserve-3d; }
.orbit-icon { font-size: 24px; color: #fff; text-shadow: 0 0 15px currentColor; }
.orbit-label { font-size: 11px; font-weight: 800; }
.orbit-1 { top: 2%; left: 31%; transform: rotateX(6deg) rotateY(-10deg); }
.orbit-2 { top: 38%; right: -2%; transform: rotateY(-12deg); }
.orbit-3 { bottom: 2%; left: 31%; transform: rotateX(-8deg) rotateY(9deg); }
.orbit-4 { top: 38%; left: -2%; transform: rotateY(12deg); }

.category-rail { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; scrollbar-width: none; padding: 2px 1px; }
.category-rail::-webkit-scrollbar { display:none; }
.category-chip { flex: 0 0 auto; min-height: 42px; padding: 8px 13px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.055); display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: #d6dbeb; font-weight: 750; }
.category-chip[aria-pressed="true"] { background: linear-gradient(140deg,rgba(107,92,252,.36),rgba(23,198,255,.2)); border-color: rgba(128,195,255,.45); box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.category-icon { font-size: 16px; color: #fff; }

.section-header { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.count-pill { flex:0 0 auto; padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--muted); font-size: 12px; }
.memory-card-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,280px),1fr)); gap: var(--space); }
.memory-card { position: relative; min-width:0; padding: clamp(15px,2vw,20px); border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(160deg,rgba(31,38,70,.96),rgba(15,19,39,.98)); box-shadow: inset 0 1px 0 rgba(255,255,255,.08),0 18px 36px rgba(0,0,0,.23); transform: translateZ(0); }
.memory-card::after { content:""; position:absolute; inset:0; pointer-events:none; border-radius:inherit; background: linear-gradient(110deg,rgba(255,255,255,.07),transparent 28%,transparent 70%,rgba(75,209,255,.05)); }
.memory-card-top { display:flex; align-items:center; justify-content:space-between; gap:8px; position:relative; z-index:1; }
.memory-badge { display:flex; align-items:center; gap:6px; font-size:12px; font-weight:850; }
.memory-badge-icon { width:28px; height:28px; display:grid; place-items:center; border-radius:9px; background: rgba(255,255,255,.08); }
.memory-date { font-size:12px; color: var(--muted); }
.memory-title { position:relative; z-index:1; margin:12px 0 0; font-size: clamp(18px,2.2vw,22px); }
.memory-story { position:relative; z-index:1; margin:8px 0 0; color: var(--muted); line-height:1.55; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.media-grid { position:relative; z-index:1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-top:14px; }
.media-tile { min-width:0; padding:0; border:1px solid var(--line); border-radius:14px; overflow:hidden; background:#0c1023; cursor:pointer; text-align:left; }
.media-preview { aspect-ratio: 4/3; display:grid; place-items:center; overflow:hidden; background: linear-gradient(145deg,#1d2e4e,#291d57); }
.media-preview img { width:100%; height:100%; object-fit:cover; }
.auto-beauty-image { filter: brightness(1.04) contrast(1.06) saturate(1.08); }
.beauty-toggle { flex:0 0 auto; min-height:40px; display:inline-flex; align-items:center; gap:7px; padding:7px 9px; border:1px solid var(--line); border-radius:11px; background:rgba(255,255,255,.045); color:#cfd7eb; font-size:11px; font-weight:800; cursor:pointer; }
.beauty-toggle input { width:16px; height:16px; margin:0; accent-color:var(--accent); }
.media-fallback, .video-fallback { background: radial-gradient(circle at 40% 20%,#385bd1,#191c42 56%,#10162c); }
.media-fallback-icon, .video-play { font-size:26px; color:#aeeaff; text-shadow:0 0 18px rgba(62,207,255,.75); }
.media-meta { display:grid; gap:2px; padding:8px 9px; }
.media-type { font-size:10px; color:#72dbff; font-weight:850; text-transform:uppercase; }
.media-name { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:11px; color:#dce2f5; }
.memory-footer { position:relative; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:12px; }
.file-count { color: var(--muted); font-size:12px; }
.text-button { min-height:40px; padding:8px 10px; border:0; background:transparent; color:#7ddcff; font-weight:800; cursor:pointer; }

.empty-state { display:grid; justify-items:center; gap:10px; text-align:center; padding: clamp(28px,6vw,58px); border:1px dashed rgba(255,255,255,.16); border-radius: var(--radius); background: rgba(255,255,255,.03); }
.empty-icon { width:58px; aspect-ratio:1; display:grid; place-items:center; border-radius:18px; font-size:24px; background:linear-gradient(145deg,#6954f8,#19bee9); box-shadow:0 14px 30px rgba(68,99,255,.25); }

.gallery-toolbar { display:flex; align-items:center; gap:10px; }
.search-box { flex:1; min-width:0; height:46px; display:flex; align-items:center; gap:8px; padding:0 13px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.055); }
.search-box input { width:100%; min-width:0; border:0; outline:0; color:var(--text); background:transparent; }
.search-box input::placeholder { color:#7f89a4; }
.search-icon { color:#76dfff; font-size:18px; }

.timeline-list { display:grid; gap:0; }
.timeline-item { display:grid; grid-template-columns:48px minmax(0,1fr); gap:12px; position:relative; padding-bottom:18px; }
.timeline-item:not(:last-child)::after { content:""; position:absolute; left:23px; top:45px; bottom:0; width:2px; background:linear-gradient(#594fe7,rgba(255,255,255,.06)); }
.timeline-dot { width:48px; height:48px; border-radius:16px; display:grid; place-items:center; background:linear-gradient(145deg,#383f82,#1c2250); border:1px solid rgba(255,255,255,.14); box-shadow: inset 0 1px 0 rgba(255,255,255,.16); z-index:1; }
.timeline-body { padding:14px 16px; border-radius:16px; border:1px solid var(--line); background:rgba(255,255,255,.045); }
.timeline-date { color:#82deff; font-size:12px; font-weight:800; }
.timeline-title { margin:5px 0 0; font-size:18px; }
.timeline-story { margin:7px 0 0; color:var(--muted); line-height:1.55; }

.admin-stack { max-width: 900px; }
.admin-heading { display:grid; gap:6px; }
.drive-card, .memory-editor, .setup-guide, .selected-files, .existing-memories, .danger-zone { display:grid; gap:14px; padding:clamp(15px,2.5vw,22px); border:1px solid var(--line); border-radius:var(--radius); background:linear-gradient(160deg,rgba(28,35,66,.92),rgba(14,18,36,.97)); }
.drive-status { display:flex; align-items:center; gap:9px; }
.status-dot { width:10px; height:10px; border-radius:50%; background:#6f7891; box-shadow:0 0 0 4px rgba(111,120,145,.12); }
.status-dot.is-on { background:#4ee59f; box-shadow:0 0 0 4px rgba(78,229,159,.13),0 0 20px rgba(78,229,159,.28); }
.drive-actions { display:flex; flex-wrap:wrap; gap:10px; }
.primary-button, .secondary-button, .danger-button { min-height:44px; border-radius:13px; padding:10px 15px; border:1px solid transparent; cursor:pointer; font-weight:850; }
.primary-button { background:linear-gradient(135deg,#6654f6,#197fd7); color:#fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.24),0 10px 24px rgba(66,78,225,.24); }
.secondary-button { background:rgba(255,255,255,.07); border-color:var(--line); color:#eff3ff; }
.danger-button { background:rgba(255,82,99,.12); border-color:rgba(255,82,99,.25); color:#ff98a3; }
.full-button { width:100%; }
.privacy-note { margin:0; color:#9fa9c2; font-size:12px; line-height:1.55; }
.settings-panel { border-top:1px solid var(--line); padding-top:10px; }
.settings-summary { min-height:42px; display:flex; align-items:center; cursor:pointer; font-weight:800; color:#c8d0e6; }
.settings-form { display:grid; gap:12px; padding-top:10px; }
.memory-editor { grid-template-columns:repeat(2,minmax(0,1fr)); }
.memory-editor > .selected-files, .memory-editor > .full-button { grid-column:1/-1; }
.form-field { display:grid; gap:6px; min-width:0; }
.field-label { font-size:12px; color:#bcc5da; font-weight:800; }
.form-field input, .form-field textarea, .form-field select { width:100%; min-width:0; border:1px solid var(--line); background:#0d1228; color:#f7f8ff; border-radius:12px; padding:11px 12px; outline:none; }
.form-field textarea { resize:vertical; min-height:96px; max-height:180px; }
.selected-file-list, .admin-memory-list { display:grid; gap:8px; }
.selected-file, .admin-memory-row { min-width:0; display:flex; align-items:center; gap:10px; padding:10px 11px; border:1px solid var(--line); border-radius:13px; background:rgba(255,255,255,.04); }
.selected-file-icon { width:36px; height:36px; flex:0 0 auto; display:grid; place-items:center; border-radius:11px; background:linear-gradient(145deg,#5046a9,#1b769a); }
.selected-file-meta, .admin-memory-meta { min-width:0; flex:1; display:grid; gap:2px; }
.selected-file-meta strong, .admin-memory-meta strong { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.selected-file-meta span, .admin-memory-meta span { color:var(--muted); font-size:11px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.icon-button { width:44px; height:44px; padding:0; flex:0 0 auto; border-radius:13px; border:1px solid var(--line); background:rgba(255,255,255,.07); font-size:22px; cursor:pointer; }
.danger-icon-button { color:#ff8d99; }
.setup-list { margin:0; padding-left:22px; display:grid; gap:8px; color:var(--muted); line-height:1.55; }

.bottom-nav { display:grid; grid-template-columns:repeat(4,1fr); align-items:center; padding:8px max(10px,env(safe-area-inset-left)) calc(8px + var(--safe-bottom)) max(10px,env(safe-area-inset-right)); border-top:1px solid var(--line); background:rgba(8,10,24,.93); backdrop-filter:blur(24px); z-index:20; }
.nav-button { min-width:0; min-height:56px; border:0; border-radius:15px; background:transparent; color:#8e98b3; display:grid; justify-items:center; align-content:center; gap:3px; cursor:pointer; }
.nav-button[aria-pressed="true"] { color:#fff; background:linear-gradient(150deg,rgba(95,82,240,.27),rgba(24,195,239,.11)); }
.nav-icon { font-size:19px; line-height:1; }
.nav-label { font-size:10px; font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }

.viewer-overlay { position:fixed; inset:0; z-index:100; display:grid; grid-template-rows:auto minmax(0,1fr) auto; gap:12px; padding:max(12px,var(--safe-top)) max(12px,env(safe-area-inset-right)) max(12px,var(--safe-bottom)) max(12px,env(safe-area-inset-left)); background:rgba(4,5,13,.96); backdrop-filter:blur(20px); }
.viewer-toolbar, .viewer-controls { width:min(1100px,100%); margin:0 auto; display:flex; align-items:center; justify-content:space-between; gap:10px; }
.viewer-meta { min-width:0; display:grid; gap:2px; }
.viewer-meta strong { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.viewer-meta span { color:var(--muted); font-size:12px; }
.viewer-close { color:#fff; }
.viewer-stage { min-width:0; min-height:0; width:min(1100px,100%); margin:0 auto; display:grid; place-items:center; position:relative; overflow:hidden; border:1px solid var(--line); border-radius:18px; background:#080b18; }
.viewer-image { max-width:100%; max-height:100%; width:auto; height:auto; object-fit:contain; }
.viewer-video { width:100%; height:100%; border:0; object-fit:contain; background:#000; }
.viewer-fallback { position:absolute; inset:0; display:grid; place-items:center; align-content:center; gap:12px; padding:24px; text-align:center; color:var(--muted); background:radial-gradient(circle at 50% 30%,#202d65,#090c1a 60%); }
.viewer-fallback-icon { font-size:44px; color:#71dbff; }
.viewer-controls { justify-content:center; }
.viewer-controls > button { min-width:120px; }

.toast-root { position:fixed; z-index:200; left:50%; bottom:calc(var(--nav-h) + var(--safe-bottom) + 18px); transform:translateX(-50%); width:min(92vw,460px); display:grid; gap:8px; pointer-events:none; }
.toast { padding:12px 14px; border:1px solid rgba(255,255,255,.14); border-radius:13px; background:#181e38; color:#fff; box-shadow:0 14px 30px rgba(0,0,0,.35); text-align:center; }

@media (hover:hover) and (pointer:fine) {
  .memory-card { transition: transform .2s ease, border-color .2s ease; }
  .memory-card:hover { transform: perspective(900px) translateY(-3px) rotateX(1.3deg); border-color:rgba(114,214,255,.27); }
  .media-tile:hover { border-color:rgba(114,214,255,.36); }
  .primary-button:hover, .secondary-button:hover, .category-chip:hover, .nav-button:hover { filter:brightness(1.08); }
}

@media (max-width: 760px) {
  :root { --header-h: 70px; --nav-h: 72px; --space: 12px; }
  .brand-tagline { display:none; }
  .brand-mark { width:38px; border-radius:12px; }
  .hero-panel { grid-template-columns:1fr; min-height:auto; padding:22px 18px; }
  .hero-title { max-width:16ch; }
  .hero-orbit { display:none; }
  .memory-editor { grid-template-columns:1fr; }
  .memory-editor > * { grid-column:1; }
  .selected-file { flex-wrap:wrap; }
  .selected-file-meta { flex-basis:calc(100% - 90px); }
  .beauty-toggle { margin-left:46px; }
}

@media (max-width: 390px) {
  .language-button { min-width:38px; padding-inline:8px; }
  .brand-name { font-size:14px; }
  .app-header { gap:8px; }
  .memory-card-grid { grid-template-columns:1fr; }
  .nav-label { font-size:9px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  :root { --header-h: 58px; --nav-h: 62px; }
  .app-header { padding-block: calc(6px + var(--safe-top)) 6px; }
  .brand-mark { width:34px; border-radius:10px; }
  .brand-tagline { display:none; }
  .nav-button { min-height:46px; grid-template-columns:auto auto; gap:6px; }
  .hero-panel { min-height:180px; grid-template-columns:1fr 260px; padding:18px 22px; }
  .hero-orbit { width:210px; }
  .orbit-card { width:82px; min-height:58px; }
  .orbit-label { display:none; }
}

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

.policy-links { display:flex; justify-content:center; align-items:center; gap:9px; padding:14px 8px 4px; color:var(--muted); font-size:12px; }
.policy-links a { color:#a9dfff; text-decoration:none; min-height:40px; display:inline-flex; align-items:center; }
.policy-links a:hover { text-decoration:underline; }
.policy-separator { opacity:.55; }

.policy-page { min-height:100dvh; background:radial-gradient(circle at 12% 5%,#1f2350 0,transparent 35%),var(--bg); color:var(--text); padding:clamp(18px,4vw,48px); }
.policy-shell { width:min(900px,100%); margin:0 auto; display:grid; gap:18px; }
.policy-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.policy-brand { color:var(--text); text-decoration:none; font-weight:900; }
.policy-language { display:flex; flex-wrap:wrap; gap:6px; }
.policy-language a { color:#a9dfff; text-decoration:none; padding:8px 10px; border:1px solid var(--line); border-radius:10px; }
.policy-card { display:grid; gap:14px; padding:clamp(18px,3vw,30px); border:1px solid var(--line); border-radius:var(--radius); background:linear-gradient(160deg,rgba(28,35,66,.94),rgba(14,18,36,.98)); }
.policy-card h1,.policy-card h2,.policy-card p,.policy-card ul { margin:0; }
.policy-card h1 { font-size:var(--font-title); }
.policy-card h2 { font-size:clamp(16px,2vw,20px); margin-top:8px; }
.policy-card p,.policy-card li { color:#c4cbe0; line-height:1.7; }
.policy-card ul { padding-left:22px; display:grid; gap:6px; }
.policy-updated { color:var(--muted); font-size:12px; }
.policy-home { color:#a9dfff; text-decoration:none; min-height:44px; display:inline-flex; align-items:center; }
