:root{
  --bg: #0f1216;
  --card: #151a21;
  --text: #e7edf5;
  --muted: #aab4c0;
  --border: #273040;
  --link: #7ab7ff;
  --btn: #1c2430;
  --btn-hover: #243044;
  --shadow: 0 8px 30px rgba(0,0,0,.25);

  /* nav */
  --nav-bg: rgba(15,18,22,.85);
  --nav-hover: rgba(255,255,255,.06);

  color-scheme: dark;
}

:root[data-theme="light"]{
  --bg: #ffffff;
  --card: #f6f7f9;
  --text: #101318;
  --muted: #4b5563;
  --border: #d9dde3;
  --link: #0b5fff;
  --btn: #eef1f5;
  --btn-hover: #e3e8f0;
  --shadow: 0 10px 30px rgba(0,0,0,.10);

  /* nav */
  --nav-bg: rgba(246,247,249,.85);
  --nav-hover: rgba(0,0,0,.06);

  color-scheme: light;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height:1.5;
}

.container{max-width: 980px; margin: 36px auto; padding: 0 16px;}

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:14px; margin-top:14px}

a{color:var(--link); text-decoration:none}
a:hover{text-decoration:underline}

.btn{
  display:inline-flex; align-items:center; gap:8px;
  background: var(--btn);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
  user-select:none;
}
.btn:hover{background: var(--btn-hover)}
.btn:active{transform: translateY(1px)}

.hr{height:1px; background: var(--border); margin: 12px 0}
.note{color:var(--muted); font-size:14px}
code{background: rgba(127,127,127,.15); padding:2px 6px; border-radius:8px}

/* ===== TOP NAV (tweaked) ===== */

.topnav{
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topnav-inner{
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 18px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 16px;
}

.logo{
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  margin-right: 22px; /* more separation to the menu */
  line-height: 1;
}

.nav-left{
  display:flex;
  align-items:center;
  gap: 8px;
  min-width: 0;
}

.nav-link,
.nav-item > button{
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-item > button:hover,
.nav-link:hover{
  background: var(--nav-hover);
  text-decoration: none;
}

.nav-item{
  position: relative;
  padding-bottom: 0px; /* fix: kein Versatz mehr */
}

.nav-item::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:100%;
  height:12px;
}

.dropdown{
  position:absolute;
  top: calc(100% + 6px);
  left:0;
  min-width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  display:none;
  box-shadow: var(--shadow);
  z-index: 2000;
}

.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown{
  display:block;
}

.dropdown a{
  display:block;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--link);
}

.dropdown a:hover{
  background: var(--btn-hover);
  text-decoration: none;
}

.dropdown .group{
  margin-bottom: 8px;
}
.dropdown .group:last-child{margin-bottom:0}
.dropdown .group strong{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 2px 6px;
}

.nav-right{
  display:flex;
  align-items:center;
  gap: 8px;
}

/* icon-only theme toggle */
.theme-btn{
  width: 42px;
  height: 36px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background: var(--btn);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.theme-btn:hover{background: var(--btn-hover);}

#themeIcon{font-size: 18px;}

/* small screens: keep it usable */
@media (max-width: 720px){
  .topnav-inner{flex-wrap: wrap;}
  .dropdown{min-width: 240px;}
}
