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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #fdfbfb 0%, #ebedee 100%);
  color: #222;
}

.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  border-bottom: 1px solid #e0e0e0;
  backdrop-filter: blur(10px);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  gap: 0.5rem;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #800020;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.logo-text { font-weight: 600; }

.main-nav { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.main-nav a {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  text-decoration: none;
  color: #800020;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.main-nav a:hover { background: #800020; color: #fff; border-color: #800020; }

.site-main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 1rem auto 2rem;
  padding: 0 1rem;
}

.site-footer {
  border-top: 1px solid #e0e0e0;
  background: #fafafa;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #777;
}

.card {
  background: rgba(255,255,255,0.98);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.08);
  padding: 1.25rem;
}

.form label { display: block; margin-bottom: 0.75rem; font-size: 0.9rem; }
.form input, .form select, .form textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.btn {
  border-radius: 999px;
  border: none;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.btn.primary { background: #800020; color: #fff; }
.btn.secondary { background: #fff; color: #800020; border: 1px solid #800020; }

.alert { padding: 0.5rem 0.75rem; border-radius: 8px; font-size: 0.85rem; margin: 0.75rem 0; background: #f2f2f2; }
.alert-error { background: #ffe0e0; color: #800020; }

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

.course-card {
  background: rgba(255,255,255,0.98);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.course-card img { width: 100%; height: 140px; object-fit: cover; }
.course-card-body { padding: 0.75rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.course-card-title { font-weight: 600; }
.course-card-desc { font-size: 0.9rem; color: #555; flex: 1; }

.progress-bar { background: #eee; border-radius: 999px; overflow: hidden; height: 8px; }
.progress-bar-inner { height: 100%; background: #800020; width: 0; }
.progress-text { font-size: 0.8rem; color: #555; }

.screen-preview {
  border-radius: 12px;
  border: 1px dashed #ccc;
  padding: 0.75rem;
  background: #fafafa;
}
.screen-preview video, .screen-preview img { max-width: 100%; border-radius: 8px; border: 1px solid #ddd; }

.table { width:100%; border-collapse: collapse; font-size:0.9rem; }
.table th, .table td { border-bottom:1px solid #eee; padding:0.35rem; text-align:left; }

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .card { padding: 1rem; }
}


/* --- IDE-like JS editor --- */
.ide-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #1f1f1f;
  background: #0f0f13;
  color: #eaeaea;
}
.ide-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #12121a;
  border-bottom: 1px solid #1f1f1f;
}
.ide-title { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.ide-stage { font-size: 0.85rem; color: #bbb; flex: 1; }
.ide-editor { height: 360px; min-height: 260px; }
.ide-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid #1f1f1f;
}
.ide-panel {
  padding: 0.5rem 0.75rem;
  border-right: 1px solid #1f1f1f;
}
.ide-panel:last-child { border-right: none; }
.ide-panel-title {
  font-size: 0.8rem;
  color: #bbb;
  margin-bottom: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.ide-output {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  color: #eaeaea;
  min-height: 78px;
}
@media (max-width: 900px) {
  .ide-bottom { grid-template-columns: 1fr; }
  .ide-panel { border-right: none; border-top: 1px solid #1f1f1f; }
  .ide-panel:first-child { border-top: none; }
}
