*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root{
  --bg:    #0e2321;
  --bg2:   #111e1d;
  --bg3:   #0b1918;
  --card:  #131f1e;
  --line:  rgba(255,255,255,0.06);
  --green: #3fa67e;
  --accent:#4ade9e;
  --text:  #dde8e5;
  --dim:   #4a6b63;
  --nav-h: 58px;
}

html,body{height:100%}
html{
  background-color:var(--bg);
}
html::before{
  content:'';
  position:fixed;
  inset:0;
  background-image:radial-gradient(circle, rgba(74,222,158,0.1) 5px, transparent 3px);
  background-size:50px 50px;
  pointer-events:none;
  z-index:0;
}
body{
  background:transparent;
  color:var(--text);
  font-family:'Quicksand',sans-serif;
  font-weight:700;
  position:relative;
  z-index:1;
}

.top-nav{
  position:fixed;
  top:0;left:0;right:0;
  height:var(--nav-h);
  z-index:200;
  display:flex;align-items:center;
  gap:0;
  background:rgba(11,25,24,0.85);
  backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);
  border-bottom:1px solid rgba(74,222,158,0.08);
  padding:0 1.2rem 0 1.4rem;
  box-shadow:0 4px 30px rgba(0,0,0,0.4);
}

.nav-logo{
  display:flex;align-items:center;
  text-decoration:none;flex-shrink:0;
  padding-right:1.1rem;
  border-right:1px solid rgba(255,255,255,0.06);
  margin-right:1.1rem;
  transition:opacity 0.2s;
}
.nav-logo:hover{opacity:0.8}
.nav-logo img{height:32px;width:auto;display:block;filter:drop-shadow(0 0 8px rgba(74,222,158,0.15))}

.nav-search-form{
  flex:1;
  min-width:0;
}
.nav-search-row{
  display:flex;align-items:center;
  background:rgba(255,255,255,0.035);
  border:1px solid rgba(255,255,255,0.06);
  border-radius:12px;
  height:40px;
  overflow:hidden;
  transition:border-color 0.3s,background 0.3s,box-shadow 0.3s;
}
.nav-search-row:focus-within{
  border-color:rgba(63,166,126,0.5);
  background:rgba(255,255,255,0.06);
  box-shadow:0 0 0 2px rgba(63,166,126,0.06);
}
.nav-search-icon{
  flex-shrink:0;padding:0 0.55rem 0 0.95rem;
  color:var(--dim);display:flex;align-items:center;
  transition:color 0.25s,transform 0.25s;
}
.nav-search-row:focus-within .nav-search-icon{
  color:var(--accent);
  transform:scale(1.1);
}
.nav-search-icon svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2.2;stroke-linecap:round}
.nav-search-input{
  flex:1;background:transparent;border:none;outline:none;
  color:var(--text);font-family:'Quicksand',sans-serif;
  font-size:0.88rem;font-weight:300;
  padding:0 0.8rem 0 0;
  caret-color:var(--accent);
  min-width:0;
  letter-spacing:0.01em;
}
.nav-search-input::placeholder{color:var(--dim);transition:color 0.2s}
.nav-search-row:focus-within .nav-search-input::placeholder{color:rgba(74,222,158,0.35)}

.nav-icons{
  display:flex;align-items:center;
  gap:0.25rem;
  flex-shrink:0;
  padding-left:1.1rem;
  border-left:1px solid rgba(255,255,255,0.06);
  margin-left:1.1rem;
}
.nav-icon{
  display:flex;align-items:center;justify-content:center;
  width:38px;height:38px;
  border-radius:10px;
  color:rgba(255,255,255,0.4);
  text-decoration:none;
  background:transparent;border:none;cursor:pointer;
  transition:color 0.2s,background 0.2s,transform 0.2s;
}
.nav-icon:hover{
  color:var(--accent);
  background:rgba(74,222,158,0.08);
  transform:translateY(-1px);
}
.nav-icon svg{
  width:19px;height:19px;
  stroke:currentColor;fill:none;
  stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;
}

#nav-tooltip{
  position:fixed;
  pointer-events:none;
  z-index:9999;
  background:#0c2420;
  border:1px solid rgba(74,222,158,0.28);
  color:var(--accent);
  font-family:'Quicksand',sans-serif;
  font-size:0.64rem;
  letter-spacing:0.08em;
  padding:0.28rem 0.65rem;
  border-radius:5px;
  white-space:nowrap;
  opacity:0;
  transition:opacity 0.15s ease;
  box-shadow:0 4px 18px rgba(0,0,0,0.45);
  transform:translate(14px,-50%);
  top:0;left:0;
}

.home-wrap{
  display:flex;flex-direction:column;
  align-items:center;justify-content:center;
  min-height:100vh;
  gap:2.2rem;
  padding:2rem;
  background:transparent;
}
.home-logo{
  height:140px;width:auto;
  opacity:0.95;
  filter:drop-shadow(0 0 40px rgba(74,222,158,0.15));
  transition:filter 0.4s,transform 0.4s;
}
.home-logo:hover{
  filter:drop-shadow(0 0 55px rgba(74,222,158,0.25));
  transform:scale(1.04);
}

.home-search-form{width:min(540px,92vw)}
.home-search-row{
  display:flex;align-items:center;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
  transition:border-color 0.25s,box-shadow 0.25s;
  box-shadow:0 4px 24px rgba(0,0,0,0.3);
}
.home-search-row:focus-within{
  border-color:rgba(63,166,126,0.5);
  box-shadow:0 4px 24px rgba(0,0,0,0.3),0 0 0 3px rgba(63,166,126,0.1);
}
.home-search-icon{
  flex-shrink:0;padding:0 0.8rem 0 1.1rem;
  color:var(--dim);display:flex;align-items:center;
  transition:color 0.2s;
}
.home-search-row:focus-within .home-search-icon{color:var(--accent)}
.home-search-icon svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round}
.home-search-input{
  flex:1;background:transparent;border:none;outline:none;
  color:var(--text);font-family:'Quicksand',sans-serif;
  font-size:0.95rem;font-weight:300;
  padding:1rem 1.1rem 1rem 0;
  caret-color:var(--accent);
}
.home-search-input::placeholder{color:var(--dim)}

.quickapps{
  width:min(540px,92vw);
  display:flex;flex-direction:column;gap:0.75rem;
}
.quickapps-label{
  font-family:'Quicksand',sans-serif;font-size:0.62rem;
  letter-spacing:0.1em;color:var(--dim);text-transform:uppercase;
}
.quickapps-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:0.65rem;
}
.qa-item{
  position:relative;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:0.55rem;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:12px;
  padding:1.1rem 0.5rem 0.9rem;
  text-decoration:none;
  color:var(--dim);
  font-family:'Quicksand',sans-serif;font-size:0.62rem;letter-spacing:0.05em;
  transition:color 0.22s,border-color 0.22s,background 0.22s,transform 0.22s,box-shadow 0.22s;
  cursor:pointer;
  overflow:hidden;
}
.qa-item::before{
  content:'';
  position:absolute;
  inset:0;
  border-radius:12px;
  opacity:0;
  background:radial-gradient(circle at 50% 30%,rgba(74,222,158,0.08),transparent 70%);
  transition:opacity 0.22s;
  pointer-events:none;
}
.qa-item:hover{
  color:var(--text);
  border-color:rgba(63,166,126,0.4);
  background:rgba(255,255,255,0.03);
  transform:translateY(-3px);
  box-shadow:0 6px 20px rgba(0,0,0,0.35);
}
.qa-item:hover::before{opacity:1}
.qa-icon{
  width:36px;height:36px;
  display:flex;align-items:center;justify-content:center;
  border-radius:10px;
  background:rgba(255,255,255,0.05);
  font-size:1.1rem;
  transition:transform 0.22s,background 0.22s;
}
.qa-item:hover .qa-icon{
  transform:scale(1.1);
  background:rgba(255,255,255,0.08);
}
.qa-icon img{width:100%;height:100%;object-fit:contain;border-radius:6px}

.shell-body{
  display:flex;flex-direction:column;
  height:100vh;overflow:hidden;
}
.content-frame{
  flex:1;
  border:none;
  margin-top:var(--nav-h);
  width:100%;height:calc(100vh - var(--nav-h));
  background:var(--bg);
}

.page-body{display:flex;flex-direction:column;height:100vh;overflow:hidden}
.frame-area{
  flex:1;position:relative;
  background:#fff;overflow:hidden;
  margin-top:var(--nav-h);
}
#sj-frame{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;border:none!important}

.loading{
  position:absolute;inset:0;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.9rem;
  background:var(--bg);z-index:10;transition:opacity 0.3s;
}
.loading.hidden{opacity:0;pointer-events:none}
.spinner{width:28px;height:28px;border:2px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:spin 0.7s linear infinite}
.loading p{font-family:'Quicksand',sans-serif;font-size:0.68rem;color:var(--dim);letter-spacing:0.06em}

#err-bar{
  display:none;position:fixed;bottom:1rem;left:50%;transform:translateX(-50%);
  background:#130a0a;border:1px solid #4a1515;border-radius:5px;
  padding:0.5rem 1rem;font-family:'Quicksand',sans-serif;font-size:0.68rem;color:#f87171;
  z-index:200;white-space:nowrap;
}

.embed-nav-trigger{position:fixed;top:0;left:0;right:0;height:4px;z-index:200;cursor:pointer}
.embed-nav-trigger:hover .embed-navbar,
.embed-navbar:hover{transform:translateY(0);opacity:1;pointer-events:all}
.embed-navbar{
  position:fixed;top:0;left:0;right:0;height:52px;
  background:rgba(11,25,24,0.97);backdrop-filter:blur(16px);
  border-bottom:1px solid var(--line);
  display:flex;align-items:center;padding:0 1.2rem;gap:1rem;
  transform:translateY(-100%);opacity:0;pointer-events:none;
  transition:transform 0.22s ease,opacity 0.22s ease;z-index:201;
}
.embed-navbar-logo{display:flex;align-items:center;text-decoration:none;flex-shrink:0}
.embed-navbar-logo img{height:22px;width:auto}
.embed-nav-div{width:1px;height:18px;background:var(--line);flex-shrink:0}
.embed-url-display{flex:1;font-family:'Quicksand',sans-serif;font-size:0.65rem;color:var(--dim);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;letter-spacing:0.02em}
.embed-nav-actions{display:flex;gap:0.3rem;flex-shrink:0}
.embed-nav-btn{
  font-family:'Quicksand',sans-serif;font-size:0.62rem;letter-spacing:0.05em;
  color:var(--dim);background:transparent;border:1px solid var(--line);
  border-radius:4px;padding:0.28rem 0.7rem;cursor:pointer;text-decoration:none;
  display:flex;align-items:center;gap:0.35rem;transition:color 0.2s,border-color 0.2s;
}
.embed-nav-btn:hover{color:var(--accent);border-color:rgba(63,166,126,0.4)}
.embed-nav-btn svg{width:11px;height:11px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round}

#embed-loading{
  position:fixed;inset:0;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:1.2rem;
  background:var(--bg);z-index:50;transition:opacity 0.4s ease;
}
#embed-loading.hidden{opacity:0;pointer-events:none}
.embed-spinner-wrap{position:relative;width:52px;height:52px;display:flex;align-items:center;justify-content:center}
.spinner-ring{position:absolute;width:44px;height:44px;border:2px solid rgba(255,255,255,0.05);border-top-color:var(--accent);border-radius:50%;animation:spin 0.8s linear infinite}
.embed-load-icon{width:32px;height:32px;border:1px solid rgba(63,166,126,0.4);border-radius:50%;display:flex;align-items:center;justify-content:center}
.embed-load-icon svg{width:14px;height:14px;stroke:var(--accent);fill:none;stroke-width:2;stroke-linecap:round}
.embed-load-logo{height:28px;width:auto}
.embed-load-msg{font-family:'Quicksand',sans-serif;font-size:0.68rem;color:var(--dim);letter-spacing:0.06em}

#embed-error{
  position:fixed;inset:0;display:none;flex-direction:column;
  align-items:center;justify-content:center;gap:0.9rem;
  background:var(--bg);z-index:60;font-family:'Quicksand',sans-serif;
  color:var(--dim);text-align:center;padding:2rem;
}
#embed-error.visible{display:flex}
.embed-err-code{font-size:0.65rem;color:#f87171;margin-top:0.2rem}
.embed-retry-btn{
  margin-top:0.4rem;padding:0.45rem 1.2rem;background:var(--green);color:#fff;
  border:none;border-radius:5px;font-family:'Quicksand',sans-serif;font-size:0.68rem;
  cursor:pointer;transition:background 0.2s;
}
.embed-retry-btn:hover{background:var(--accent);color:#0e2321}
#embed-error a{color:var(--accent);text-decoration:none;font-size:0.68rem}

@keyframes spin{to{transform:rotate(360deg)}}
@keyframes fadeUp{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}
.anim-1{animation:fadeUp 0.45s ease both}
.anim-2{animation:fadeUp 0.45s 0.07s ease both}
.anim-3{animation:fadeUp 0.45s 0.14s ease both}

.search-bar{
  flex-shrink:0;
  padding:1.2rem 2rem;
  background:var(--bg);
  border-bottom:1px solid var(--line);
  display:flex;justify-content:center;
}
.search-inner{
  display:flex;align-items:center;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:10px;
  height:46px;
  width:min(560px,100%);
  overflow:hidden;
  transition:border-color 0.2s,box-shadow 0.2s;
}
.search-inner:focus-within{
  border-color:rgba(63,166,126,0.45);
  box-shadow:0 0 0 3px rgba(63,166,126,0.09);
}
.search-inner svg{
  flex-shrink:0;
  width:16px;height:16px;
  stroke:var(--dim);fill:none;stroke-width:2;stroke-linecap:round;
  margin:0 0.7rem 0 1.1rem;
}
#game-search{
  flex:1;background:transparent;border:none;outline:none;
  color:var(--text);font-family:'Quicksand',sans-serif;
  font-size:0.95rem;font-weight:700;
  caret-color:var(--accent);
  padding-right:1rem;
}
#game-search::placeholder{color:var(--dim)}

.games-scroll{
  flex:1;
  overflow-y:auto;
  padding:1.5rem 2rem 3rem;
}

.games-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(170px,1fr));
  gap:1rem;
}

.game-card{
  position:relative;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
  text-decoration:none;
  display:flex;flex-direction:column;
  transition:border-color 0.22s,transform 0.22s,box-shadow 0.22s;
}
.game-card:hover{
  border-color:rgba(63,166,126,0.4);
  transform:translateY(-5px) scale(1.02);
  box-shadow:0 12px 36px rgba(0,0,0,0.5),0 0 20px rgba(74,222,158,0.08);
}
.game-card::after{
  content:'';
  position:absolute;
  inset:0;
  border-radius:14px;
  opacity:0;
  background:linear-gradient(135deg,rgba(74,222,158,0.06),transparent 60%);
  transition:opacity 0.22s;
  pointer-events:none;
}
.game-card:hover::after{opacity:1}

.game-cover{
  width:100%;
  aspect-ratio:1/1;
  object-fit:contain;
  background:var(--bg2);
  display:block;
  transition:filter 0.22s;
}
.game-card:hover .game-cover{filter:brightness(1.08)}

.game-cover-placeholder{
  width:100%;
  aspect-ratio:1/1;
  background:linear-gradient(145deg,var(--bg2),var(--bg3));
  display:flex;align-items:center;justify-content:center;
}
.game-cover-placeholder svg{
  width:36px;height:36px;
  stroke:var(--dim);fill:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;
  opacity:0.4;
}

.game-info{
  padding:0.75rem 0.85rem 0.85rem;
  display:flex;flex-direction:column;gap:0.25rem;
  background:linear-gradient(180deg,var(--card),rgba(11,25,24,0.6));
}
.game-name{
  font-size:0.82rem;
  font-weight:700;
  color:var(--text);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  transition:color 0.2s;
}
.game-card:hover .game-name{color:var(--accent)}
.game-author{
  font-size:0.62rem;
  color:var(--dim);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  letter-spacing:0.03em;
}

.state-msg{
  display:flex;flex-direction:column;align-items:center;
  padding:5rem 2rem;gap:1rem;color:var(--dim);font-size:0.72rem;
}
.state-msg.err{color:#f87171}
.state-msg button{
  padding:0.4rem 1.2rem;background:var(--green);color:#fff;
  border:none;border-radius:5px;font-family:'Quicksand',sans-serif;
  font-size:0.7rem;font-weight:700;cursor:pointer;
  transition:background 0.2s;
}
.state-msg button:hover{background:var(--accent);color:#0e2321}
.hidden{display:none!important}