/* Shared chrome: fixed toolbar + ad slots (all pages) */
:root {
  --kd-brand: #80ff80;
  --kd-accent: #0f7a32;
  --kd-accent-deep: #0a5c25;
  --kd-ink: #0a2e14;
  --kd-muted: #1f5a32;
  --kd-bar-h: 56px;
  --kd-ad-h: 90px;
}

body.kd-chrome-ready {
  margin: 0 !important;
  padding-top: calc(var(--kd-bar-h) + var(--kd-ad-top-h, 0px)) !important;
  padding-bottom: calc(var(--kd-ad-h) + 8px) !important;
  box-sizing: border-box;
}

body.kd-chrome-ready.kd-no-ads {
  padding-bottom: 8px !important;
}

body.kd-chrome-ready.kd-no-ads #kd-ad-top,
body.kd-chrome-ready.kd-no-ads #kd-ad-bottom {
  display: none !important;
  min-height: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  padding: 0 !important;
}

#kd-lesson-badge {
  position: relative;
  z-index: 10;
  margin: 0;
  padding: 0.55rem 0.85rem;
  background: #0f7a32;
  color: #fff;
  font: 600 0.85rem/1.4 "Segoe UI", "Trebuchet MS", sans-serif;
  text-align: center;
}

#kd-lesson-badge a {
  color: #b8ffb8;
  font-weight: 700;
}

body.kd-chrome-ready.kd-no-top-ad {
  padding-top: var(--kd-bar-h) !important;
}

body.kd-no-top-ad #kd-ad-top {
  display: none !important;
}

#kd-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99990;
  height: var(--kd-bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.85rem;
  background: linear-gradient(135deg, #0f7a32 0%, #1faa45 55%, #3dcc5a 100%);
  color: #fff;
  box-shadow: 0 4px 18px rgba(10, 46, 20, 0.28);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

#kd-toolbar .kd-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  line-height: 1.15;
  text-decoration: none;
  color: #fff;
  min-width: 0;
}

#kd-toolbar .kd-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

#kd-toolbar .kd-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#kd-toolbar .kd-brand strong {
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#kd-toolbar .kd-brand span {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
  font-weight: 600;
}

#kd-toolbar .kd-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

#kd-toolbar .kd-nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  white-space: nowrap;
}

#kd-toolbar .kd-nav a:hover,
#kd-toolbar .kd-nav a.is-active {
  background: #fff;
  color: var(--kd-accent-deep);
}

#kd-ad-top,
#kd-ad-bottom {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 99980;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3fff3;
  border-color: rgba(15, 122, 50, 0.15);
}

#kd-ad-top {
  top: var(--kd-bar-h);
  min-height: 70px;
  border-bottom: 1px solid rgba(15, 122, 50, 0.15);
}

#kd-ad-bottom {
  bottom: 0;
  min-height: var(--kd-ad-h);
  border-top: 1px solid rgba(15, 122, 50, 0.15);
  box-shadow: 0 -4px 16px rgba(10, 46, 20, 0.1);
}

.kd-ad-slot {
  width: min(100%, 728px);
  min-height: 90px;
  margin: 6px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background:
    repeating-linear-gradient(
      -45deg,
      #e8ffe8,
      #e8ffe8 8px,
      #f6fff6 8px,
      #f6fff6 16px
    );
  border: 1px dashed rgba(15, 122, 50, 0.35);
}

.kd-ad-slot.kd-ad-demo {
  border-style: solid;
  border-color: rgba(15, 122, 50, 0.35);
  background: linear-gradient(135deg, #0f7a32 0%, #1faa45 45%, #3dcc5a 100%);
  color: #fff;
  min-height: 100px;
}

.kd-demo-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  text-align: center;
}

.kd-demo-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font: 700 10px/1.2 "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kd-demo-inner strong {
  font-size: 1.05rem;
  font-weight: 800;
}

.kd-demo-inner small {
  max-width: 34rem;
  font-size: 0.75rem;
  line-height: 1.35;
  opacity: 0.9;
}

.kd-ad-slot::before {
  content: none;
}

.kd-ad-slot:not(.kd-ad-demo)::before {
  content: "AdSense";
  position: absolute;
  top: 4px;
  left: 8px;
  z-index: 1;
  font: 600 10px/1 "Segoe UI", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(15, 122, 50, 0.55);
  pointer-events: none;
}

.kd-ad-slot ins.adsbygoogle {
  display: block;
  width: 100%;
  min-height: 60px;
}

/* Modern hub pages (tutorial indexes) */
.kd-hub {
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--kd-ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #ffffffaa, transparent 50%),
    linear-gradient(165deg, #80ff80 0%, #b8ffb8 45%, #e6ffe6 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.kd-hub-shell {
  width: min(100% - 2rem, 980px);
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
}

.kd-hub h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
}

.kd-hub .kd-lead {
  color: var(--kd-muted);
  line-height: 1.55;
  max-width: 42rem;
  margin: 0 0 1rem;
}

.kd-hub .kd-warn {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(198, 40, 40, 0.25);
  color: #b71c1c;
  font-weight: 700;
  line-height: 1.45;
}

.kd-exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.55rem;
}

.kd-exercise-grid a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: #0f7a32;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 650;
  font-size: 0.9rem;
  box-shadow: 0 3px 0 #0a5c25;
  transition: transform 0.12s ease, background 0.12s ease;
}

.kd-exercise-grid a:hover {
  background: #0a5c25;
  transform: translateY(-1px);
}

.kd-exercise-grid a .n {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.kd-section-title {
  margin: 1.4rem 0 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--kd-muted);
}

body.kd-chrome-ready .topbar,
body.kd-chrome-ready .are-topnav {
  display: none !important;
}

body.kd-chrome-ready .shell {
  padding-top: 0.5rem;
}

/* Editor + chrome */
body.kd-chrome-ready.are-page {
  min-height: 100vh;
}

body.kd-chrome-ready .are-wrap {
  min-height: calc(100vh - var(--kd-bar-h, 56px) - var(--kd-ad-top-h, 70px) - var(--kd-ad-h, 90px) - 8px);
}
