:root {
  --accent: #517BFE;
  --bg: #ffffff;
  --text-primary: #0b0b0b;
  --text-secondary: #5b7083;
  --info: #1976d2;
  --login-bg: #f5f7fb;
  --input-bg: #ffffff;
  --input-stroke: #d9dee5;
  --btn-primary-bg: var(--accent);
  --btn-primary-text: #ffffff;
  --btn-secondary-border: var(--accent);
  --btn-secondary-text: var(--accent);
  /* Branding screen offsets (easy to tweak) */
  --branding-icon-left: 32px;
  --branding-icon-bottom: 266px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.4 -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif; color: var(--text-primary); background: var(--bg); }

.topbar, .bottombar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid #e5e8ef; background: var(--bg); position: sticky; top: 0; z-index: 10; }
.bottombar { border-top: 1px solid #e5e8ef; border-bottom: none; bottom: 0; top: auto; position: fixed; width: 100%; }
.brand { font-weight: 600; }
.toggles { display: flex; gap: 12px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
select { padding: 6px 8px; border-radius: 6px; border: 1px solid #d9dee5; background: #fff; }

.layout { display: grid; grid-template-columns: 360px 1fr; gap: 0; height: calc(100vh - 100px); padding-bottom: 0px; }
.sidebar { border-right: 1px solid #e5e8ef; padding: 16px; overflow: auto; }
.preview { display: flex; flex-direction: column; overflow: auto; }

.screens-grid { display: grid; grid-template-columns: repeat(3, minmax(420px, 1fr)); gap: 16px; padding: 16px; align-content: start; }
.device-block { display: flex; flex-direction: column; gap: 8px; }
.device-title { font-weight: 600; padding: 0 8px; color: var(--text-primary); }
.device-frame { display: flex; justify-content: center; align-items: center; padding: 16px; height: 100%; }

.tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid #e5e8ef; }
.tab { border: none; background: transparent; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.tab.active { background: #f2f4f8; }

.device-frame { display: flex; justify-content: center; align-items: center; padding: 16px; height: 100%; }
.screen { width: 390px; height: 780px; border: 12px solid #0f0f0f; border-radius: 40px; background: var(--bg); color: var(--text-primary); box-shadow: 0 20px 60px rgba(0,0,0,0.2); position: relative; overflow: hidden; }
.screen::before { /* iOS Dynamic Island */
  content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 126px; height: 36px; background: #000; border-radius: 18px; opacity: 0.9; z-index: 20;
}
.screen.android { border-radius: 28px; border-color: #222; }
.screen.android::before { content: none; }

/* UI elements used across screens */
.header-image { width: 100%; height: 200px; object-fit: cover; display: block; }
.logo { max-width: 189px; max-height: 89px; }
.container { padding: 0 24px; }
.title-display { font-size: 32px; font-weight: 700; margin: 0; color: var(--text-primary); }
.title-small { font-size: 14px; color: var(--text-primary); margin: 4px 0 20px 0; }
.label { font-size: 12px; color: var(--text-primary); margin: 18px 0 6px; }
.input { width: 100%; padding: 14px; border-radius: 8px; border: 1px solid var(--input-stroke); background: var(--input-bg); font-size: 16px; color: var(--text-primary); }
.row { display: flex; align-items: center; gap: 8px; }
.space { height: 16px; }
.btn { display: inline-block; border-radius: 8px; padding: 12px 14px; border: 1px solid transparent; cursor: pointer; font-weight: 600; }
.btn.small { padding: 6px 8px; font-size: 12px; }
.btn.primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); border-color: var(--btn-primary-bg); }
.btn.secondary { background: transparent; color: var(--btn-secondary-text); border-color: var(--btn-secondary-border); }
.link { color: var(--info); cursor: pointer; }

.card { background: #fff; border: 1px solid #eceff4; border-radius: 12px; padding: 16px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.card.darkish { background: #141821; border-color: #1c2331; }
.hstack { display: flex; gap: 12px; align-items: center; }
.vstack { display: flex; gap: 12px; flex-direction: column; }
.spacer { flex: 1; }
.divider { height: 1px; background: rgba(0,0,0,0.08); margin: 12px 0; }
.org-label { font-size: 12px; color: var(--text-secondary); letter-spacing: 0.2px; }
.meta { font-size: 12px; color: var(--text-secondary); }
.link-row { display: flex; align-items: center; gap: 6px; color: var(--text-primary); font-weight: 600; cursor: default; }

/* Sidebar */
.section { margin-bottom: 16px; }
.section h3 { margin: 0 0 8px 0; font-size: 14px; }
.upload-list { display: flex; flex-direction: column; gap: 8px; }
.thumb-preview { width: 40px; height: 40px; border: 1px solid #e6eaf0; border-radius: 6px; background: #f5f7fb; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input[type="color"] { height: 36px; width: 100%; border: 1px solid #ccd3db; border-radius: 6px; padding: 0; }
.field input[type="file"] { font-size: 12px; }
.field .note { font-size: 12px; color: #6b7686; line-height: 1.4; }
.badge { display: inline-block; padding: 2px 6px; border-radius: 4px; background: #eef2ff; color: #334; font-size: 11px; }
.todo { font-size: 12px; color: #7a869a; }
.todo.missing { color: #d32f2f; font-weight: 600; }

/* Splash */
.splash { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
.splash .splash-logo { width: 121px; height: 121px; object-fit: contain; border-radius: 32px; }
.splash .android-circle { width: 136px; height: 136px; border-radius: 80px; background: #ffffff; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,0.25); }
.splash .android-circle .splash-logo { width: 112px; height: 112px; border-radius: 80px; transition: transform 0.15s ease; }
.splash .android-icon-wrap { width: 136px; height: 136px; display: flex; align-items: center; justify-content: center; }
.splash .android-icon-wrap .splash-logo { width: 112px; height: 112px; border-radius: 0; transition: transform 0.15s ease; box-shadow: none; }
/* Optional splash pad */
.splash .splash-pad { width: 128px; height: 128px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 32px; }
.screen.android .splash .splash-pad { border-radius: 64px; }

/* Login */
.login { position: absolute; inset: 0; overflow-y: auto; }
.login .bg { width: 100%; height: 200px; object-fit: cover; display: block; }
.login .login-header { position: relative; height: 200px; overflow: hidden; }
.login .header-gradient { width: 100%; height: 200px; }
.login .header-tint { position: absolute; inset: 0; mix-blend-mode: multiply; pointer-events: none; }
.login .logo-on-header { position: absolute; top: 0; left: 0; right: 0; height: 210px; display: flex; align-items: center; justify-content: center; z-index: 2; }
.login .logo-on-header .logo { max-width: 189px; max-height: 89px; filter: drop-shadow(0 1px 0 rgba(0,0,0,0.05)); }
.login .logo-wrap { display: flex; justify-content: center; align-items: center; }
.login .content { background: var(--login-bg); border-top-left-radius: 24px; border-top-right-radius: 24px; margin-top: -16px; padding-top: 40px; min-height: calc(100% - 200px); position: relative; overflow: hidden; }

/* Learn (PrimaryCourseDashboard) */
.learn { padding: 8px 0; }
.learn { padding-bottom: 88px; }
.learn .learn-top { padding: 8px 20px; position: relative; margin-top: 44px; text-align: left; }
.learn h1 { margin: 0; font-size: 32px; font-weight: 700; color: var(--text-primary); text-align: left; }
.learn .settings { color: var(--accent); position: absolute; top: 8px; right: 20px; }
.learn .primary-card { margin: 16px 20px; border-radius: 8px; overflow: hidden; border: 1px solid #e6eaf0; box-shadow: 0 3px 4px rgba(0,0,0,0.1); }
.learn .hscroll { overflow-x: auto; white-space: nowrap; padding: 8px 20px; }
.learn .course-chips { display: inline-flex; gap: 12px; }
.chip { width: 120px; display: inline-flex; flex-direction: column; gap: 6px; }
.chip .thumb { width: 100%; height: 100px; background: #dfe6f3; border-radius: 8px 8px 0px 0px; }
.chip.card { border-radius: 8px; box-shadow: 2px 2px 6px rgba(0,0,0,0.12); padding: 0; }
.chip-title { padding: 10px 12px 16px; font-size: 12px; font-weight: 600; color: var(--text-primary); }

/* Primary card internals */
.primary-card .hero { position: relative; height: 140px; background: #dfe6f3 center/cover no-repeat; }
.primary-card .progress-line { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); width: 40%; }
.primary-card .course-title { padding: 10px 12px 16px; }
.primary-card .course-buttons .course-button { position: relative; display: flex; align-items: center; color: var(--text-primary); padding-top: 8px; padding-bottom: 8px; }
.primary-card .course-buttons .course-button:not(.selected)::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--card-stroke); }
.primary-card .course-buttons .course-button .iconwrap { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; padding: 12px; color: var(--text-primary); }
.primary-card .course-buttons .course-button .texts { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.primary-card .course-buttons .course-button .desc { font-size: 10px; color: currentColor; opacity: 0.9; }
.primary-card .course-buttons .course-button .title { font-size: 14px; font-weight: 600; color: currentColor; }
.primary-card .course-buttons .course-button .chev { margin-left: auto; opacity: 0.6; padding: 8px; color: currentColor; }
.primary-card .course-buttons .course-button.selected { background: var(--btn-primary-bg); color: var(--btn-primary-text); }
.primary-card .course-buttons .course-button .iconwrap svg, .primary-card .course-buttons .course-button .chev svg { display: block; }

/* Discovery */
.discovery .search { margin: 12px 24px 20px; }
.discovery { padding-bottom: 88px; }

/* Generic page header (title + settings icon) */
.page-top { padding: 8px 20px; position: relative; margin-top: 52px; text-align: center; }
.page-top h1 { margin: 0; font-size: 18px; font-weight: 600; color: var(--text-primary); }
.settings-icon { color: var(--accent); position: absolute; top: 8px; right: 20px; display: inline-flex; width: 24px; height: 24px; }
.settings-icon svg { width: 24px; height: 24px; display: block; }
.discovery .search .input { background: #f5f7fb; border-color: #d9dee5; }

/* Profile */
.avatar { width: 80px; height: 80px; border-radius: 40px; object-fit: cover; border: 1px solid #dfe3ea; }
.profile { padding-bottom: 88px; }

/* Footer buttons spacing fix */
main.layout { padding-bottom: 0px; }
.bottombar .left, .bottombar .right { display: flex; gap: 8px; }

/* Dark theme helpers scoped to device frame */
.screen.dark .card { background: #12161f; border-color: #1d2432; color: #e6e9ef; }
.screen.dark .tab.active { background: #1b2230; }

/* In-device iOS/Android tab bar */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; height: 64px; background: var(--tabbar-bg); border-top: 1px solid rgba(0,0,0,0.06); display: flex; align-items: center; justify-content: space-around; padding-bottom: 8px; }
.tabbar.android { height: 64px; }
.tabbar-item { background: transparent; border: none; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--tabbar-inactive); cursor: pointer; font-size: 11px; }
.tabbar-item svg { display: block; }
.tabbar-item.active { color: var(--tabbar-active); }
.tabbar-item span { font-size: 12px; }

/* iOS home indicator mimic */
.screen::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: 6px; width: 120px; height: 4px; background: #000; border-radius: 2px; opacity: 0.15; }

/* Branding screen */
.branding { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.branding .mock { position: absolute; inset: 0; background: url('assets/iphone.png') center/cover no-repeat; opacity: 1; }
.branding .branding-overlay { position: absolute; left: var(--branding-icon-left); bottom: var(--branding-icon-bottom); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.branding .branding-icon { width: 54px; height: 54px; border-radius: 12px; box-shadow: 0 8px 12px rgba(0,0,0,0.05); object-fit: cover; background: #ffffff; }
.branding .branding-icon.no-bg { border-radius: 0; box-shadow: none; background: transparent; }
.branding .branding-name { font-size: 11px; font-weight: 300; color: var(--text-primary); line-height: 1; color: #ffffff; }
