:root{
  --bg-overlay: rgba(8, 24, 52, 0.58);
  --card: rgba(255,255,255,0.10);
  --card-2: rgba(255,255,255,0.14);
  --stroke: rgba(255,255,255,0.16);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.72);
  --shadow: 0 14px 40px rgba(0,0,0,0.32);
  --radius: 22px;
}

*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  background: #081834;
  overflow-x: hidden;
  position: relative;
}

/*
  Safe-area bars (iOS notch / home indicator)
  In standalone/PWA mode, the bottom safe-area can appear as a solid bar.
  We mirror the same bar on top (behind the notch/status area) to keep the UI uniform.
*/
body::before,
body::after{
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  background: #081834;
  pointer-events: none;
  z-index: 1;
}
body::before{ top: 0; height: env(safe-area-inset-top); }
body::after{ bottom: 0; height: env(safe-area-inset-bottom); }

.bg{
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

/*
  Background in a 16:9 "frame" (centered) with a subtle blurred fill behind it.
  This keeps the background consistent also in standalone/PWA mode across devices.
*/
.bg-fill{
  position: absolute;
  inset: -12%;
  background-image:
    linear-gradient(180deg, rgba(8,24,52,0.72), rgba(8,24,52,0.48)),
    url("../img/background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.08);
  filter: blur(18px) saturate(1.08) contrast(1.03);
  opacity: 0.92;
}

.bg-16x9{
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100vw, calc(100vh * (16 / 9)));
  height: min(100vh, calc(100vw * (9 / 16)));
  transform: translate(-50%, -50%) scale(1.03);
  background-image:
    linear-gradient(180deg, rgba(8,24,52,0.55), rgba(8,24,52,0.35)),
    url("../img/background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(1.06) contrast(1.02);
}

.shell{
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(22px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
           max(22px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  position: relative;
  z-index: 2;
}

.card{
  width: min(720px, 100%);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), rgba(255,255,255,0.06));
  box-shadow: var(--shadow);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}

.header{
  padding: 28px 26px 18px;
  display: grid;
  gap: 10px;
}

.brand{
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark{
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.10));
  border: 1px solid rgba(255,255,255,0.22);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.28);
}

.brand-mark img{
  max-width: 30px;
  max-height: 30px;
  width: auto;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
}

.brand-mark svg{ opacity: 0.95; }

h1{
  margin: 0;
  font-size: clamp(20px, 3.6vw, 26px);
  letter-spacing: 0.2px;
}

.subtitle{
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.45;
}

.divider{
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.20), transparent);
}

.grid{
  padding: 18px 18px 24px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 520px){
  .grid{ grid-template-columns: 1fr; }
}


.tile{
  position: relative;
  display: grid;
  gap: 8px;
  padding: 18px 18px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--text);
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 10px 28px rgba(0,0,0,0.22);
  transition:
    transform 180ms cubic-bezier(.2,.8,.2,1),
    box-shadow 180ms cubic-bezier(.2,.8,.2,1),
    border-color 180ms ease,
    background 180ms ease,
    filter 180ms ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: hidden;
  isolation: isolate;
}

.tile::before{
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(520px circle at var(--px, 50%) var(--py, 50%),
    rgba(255,255,255,0.18) 0%,
    rgba(255,255,255,0.10) 20%,
    transparent 52%);
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
  z-index: 0;
}

.tile::after{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    transparent 0%,
    rgba(255,255,255,0.10) 22%,
    rgba(255,255,255,0.18) 34%,
    rgba(255,255,255,0.10) 46%,
    transparent 70%);
  transform: translateX(-120%) skewX(-14deg);
  opacity: 0;
  transition: transform 700ms cubic-bezier(.2,.8,.2,1), opacity 200ms ease;
  pointer-events: none;
  z-index: 0;
}

.tile:focus{ outline: none; }
.tile:focus-visible{
  outline: 2px solid rgba(255,255,255,0.50);
  outline-offset: 3px;
}

.tile:hover{
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.30);
  background: rgba(255,255,255,0.115);
  box-shadow: 0 16px 46px rgba(0,0,0,0.30);
}
.tile:hover::before{ opacity: 1; }
.tile:hover::after{ opacity: 1; transform: translateX(120%) skewX(-14deg); }

.tile:active{
  transform: translateY(-1px) scale(0.985);
  box-shadow: 0 12px 34px rgba(0,0,0,0.26);
}
.tile:active::before{ opacity: 0.75; }
.tile:active::after{ opacity: 0; }

.tile-top{
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), background 180ms ease, border-color 180ms ease;
}


.tile:hover .icon{
  transform: translateY(-1px) scale(1.02);
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.24);
}
.tile:active .icon{ transform: translateY(0) scale(0.99); }


.tile-title{
  font-weight: 650;
  letter-spacing: 0.2px;
}

.tile-desc{
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.35;
  margin-top: -2px;
}

.badge{
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(8,24,52,0.35);
  color: rgba(255,255,255,0.78);
}

.footer{
  padding: 14px 18px 18px;
  color: rgba(255,255,255,0.58);
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.smalllink{
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255,255,255,0.25);
}
.smalllink:hover{ border-bottom-color: rgba(255,255,255,0.55); }


/* Install area */
.install{padding: 0 18px 18px;}
.install-box{border: 1px solid rgba(255,255,255,0.18); border-radius: 16px; background: rgba(255,255,255,0.08); padding: 12px 14px; display:flex; align-items:center; justify-content:space-between; gap: 10px;}
.install-text{color: rgba(255,255,255,0.82); font-size: 13.5px; line-height: 1.35;}
.install-muted{color: rgba(255,255,255,0.70); font-size: 12.5px; margin-top: 2px;}
.btn{
  appearance:none;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.26);
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.92);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 13px;
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 170ms cubic-bezier(.2,.8,.2,1),
    background 170ms ease,
    border-color 170ms ease,
    box-shadow 170ms ease;
}
.btn > span{ position: relative; z-index: 1; }
.btn-ico{
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}
.btn-ico svg{ display:block; }

.btn-ghost{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.22);
}
.btn::before{
  content:"";
  position:absolute;
  inset:0;
  background: radial-gradient(420px circle at var(--px, 50%) var(--py, 50%),
    rgba(255,255,255,0.18) 0%,
    rgba(255,255,255,0.10) 22%,
    transparent 60%);
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events:none;
  z-index:0;
}
.btn::after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(120deg,
    transparent 0%,
    rgba(255,255,255,0.10) 22%,
    rgba(255,255,255,0.18) 34%,
    rgba(255,255,255,0.10) 46%,
    transparent 70%);
  transform: translateX(-120%) skewX(-14deg);
  opacity: 0;
  transition: transform 700ms cubic-bezier(.2,.8,.2,1), opacity 200ms ease;
  pointer-events:none;
  z-index:0;
}
.btn:focus{ outline:none; }
.btn:focus-visible{
  outline: 2px solid rgba(255,255,255,0.50);
  outline-offset: 3px;
}
.btn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.32);
  box-shadow: 0 10px 22px rgba(0,0,0,0.20);
}
.btn:hover::before{ opacity: 1; }
.btn:hover::after{ opacity: 1; transform: translateX(120%) skewX(-14deg); }
.btn:active{transform: translateY(0) scale(0.985);} 

.btn:active::before{ opacity: 0.7; }
.btn[disabled]{opacity:0.55; cursor:not-allowed; box-shadow:none;}

.ios-guide{margin-top: 6px; color: rgba(255,255,255,0.76); font-size: 12.5px;}
.ios-guide strong{color: rgba(255,255,255,0.92);} 
.hidden{display:none !important;}


/* Viewer page (optional) */
.shell-viewer{ align-items: stretch; }
.viewer-card{
  width: min(1060px, 100%);
  height: min(760px, calc(100vh - 44px));
  display: flex;
  flex-direction: column;
}

.viewer-header{
  padding: 14px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.viewer-title{
  font-weight: 650;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.86);
  text-align: center;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-body{
  position: relative;
  flex: 1;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.viewer-frame{
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(0,0,0,0.12);
}

.viewer-loading{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8,24,52,0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.spinner{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.18);
  border-top-color: rgba(255,255,255,0.78);
  animation: spin 1s linear infinite;
}

@keyframes spin{
  to{ transform: rotate(360deg); }
}

.viewer-note{
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(8,24,52,0.50);
  color: rgba(255,255,255,0.86);
  font-size: 12.5px;
  line-height: 1.35;
}

.viewer-note a{
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255,255,255,0.32);
}
.viewer-note a:hover{ border-bottom-color: rgba(255,255,255,0.60); }

@media (max-width: 520px){
  .viewer-title{ font-size: 12.5px; }
  .viewer-card{ height: calc(100vh - 44px); }
}


/* Ripple effect (subtle) */
.ripple{
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255,255,255,0.22);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: screen;
  animation: ripple 650ms ease-out forwards;
}

@keyframes ripple{
  0%{ transform: translate(-50%, -50%) scale(0); opacity: 0.25; }
  100%{ transform: translate(-50%, -50%) scale(18); opacity: 0; }
}

/* Entrance animations */
@keyframes cardIn{
  from{ opacity: 0; transform: translateY(10px); }
  to{ opacity: 1; transform: translateY(0); }
}
@keyframes tileIn{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: translateY(0); }
}

html.loaded .card{ animation: cardIn 520ms cubic-bezier(.2,.8,.2,1) both; }
html.loaded .tile{ animation: tileIn 520ms cubic-bezier(.2,.8,.2,1) both; }
html.loaded .grid .tile:nth-child(1){ animation-delay: 90ms; }
html.loaded .grid .tile:nth-child(2){ animation-delay: 160ms; }
html.loaded .grid .tile:nth-child(3){ animation-delay: 230ms; }
html.loaded .grid .tile:nth-child(4){ animation-delay: 300ms; }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce){
  .tile, .btn{ transition: none !important; }
  .tile::after, .btn::after{ transition: none !important; }
  .ripple{ animation: none !important; display: none !important; }
  html.loaded .card, html.loaded .tile{ animation: none !important; }
}



