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

body {
  font-family: 'Source Sans Pro', Verdana, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #000;
  background: #fff;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: Consolas, "Courier New", monospace;
  color: crimson;
  background: #f1f1f1;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 105%;
}

/* ===== TOP NAVIGATION ===== */
.topnav {
  background-color: #282A35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topnav-left a {
  color: #ddd;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 25px;
  transition: background 0.2s;
}

.topnav-left a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.logo {
  font-size: 20px !important;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff !important;
}

.logo-green {
  color: #04AA6D;
}

.logo-suffix {
  font-weight: 400;
  opacity: 0.7;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input {
  background: #3B3D4A;
  border: none;
  color: #ddd;
  padding: 8px 14px;
  border-radius: 25px;
  font-size: 14px;
  width: 220px;
  outline: none;
  transition: background 0.2s;
}

.search-input::placeholder {
  color: #888;
}

.search-input:focus {
  background: #4a4c5a;
}

.btn-dark {
  background: none;
  border: 1px solid #555;
  color: #ddd;
  padding: 6px 14px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.btn-dark:hover {
  background: rgba(255,255,255,0.08);
}

.btn-signup {
  background: #04AA6D;
  color: #fff !important;
  padding: 8px 18px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-signup:hover {
  background: #059862;
}

/* ===== MAIN LAYOUT ===== */
.main-wrapper {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: #E7E9EB;
  padding: 20px 0;
  overflow-y: auto;
  height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
}

.sidebar h2 {
  font-size: 15px;
  font-weight: 700;
  color: #000;
  padding: 12px 24px 4px;
  margin-top: 4px;
  text-transform: none;
}

.sidebar a {
  display: block;
  padding: 6px 24px;
  font-size: 14px;
  color: #000;
  transition: background 0.15s, border-left 0.15s;
  border-left: 4px solid transparent;
}

.sidebar a:hover {
  background: #D5D8DC;
}

.sidebar a.active {
  background: #04AA6D;
  color: #fff;
  border-left: 4px solid #04AA6D;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  max-width: 960px;
  padding: 32px 48px 60px;
}

.main-content h1 {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #000;
}

.main-content h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 24px 0 12px;
  color: #000;
}

.main-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 16px 0 8px;
}

.main-content p {
  margin-bottom: 12px;
  line-height: 1.7;
}

.section-divider {
  border: none;
  border-top: 1px solid #ddd;
  margin: 24px 0;
}

/* ===== NAVIGATION BUTTONS ===== */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.bottom-nav-buttons {
  margin-top: 24px;
  margin-bottom: 0;
}

.btn-nav {
  display: inline-block;
  padding: 10px 20px;
  font-size: 15px;
  border-radius: 5px;
  transition: background 0.2s;
  color: #fff !important;
}

.btn-prev {
  background: #282A35;
}

.btn-prev:hover {
  background: #3b3d4a;
}

.btn-next {
  background: #04AA6D;
}

.btn-next:hover {
  background: #059862;
}

/* ===== EXAMPLE BOX ===== */
.example-box {
  background: #E7E9EB;
  border-left: 4px solid #04AA6D;
  border-radius: 5px;
  padding: 20px 24px;
  margin: 16px 0 24px;
}

.example-box h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #000;
}

.example-box p {
  margin-bottom: 12px;
}

/* ===== CODE BOX ===== */
.code-box {
  background: #fff;
  border-left: 3px solid #04AA6D;
  border-radius: 4px;
  padding: 16px 20px;
  margin: 8px 0 12px;
  overflow-x: auto;
}

.code-box pre {
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre;
  color: #333;
}

.code-box code {
  background: none;
  color: #333;
  padding: 0;
  font-size: 14px;
}

.keyword { color: #0000ff; }
.classname { color: #d4372c; }
.method { color: #000; }
.number { color: #d4372c; }
.string { color: #d4372c; }
.comment { color: #008000; }

/* ===== TRY IT BUTTON ===== */
.btn-tryit {
  background: #04AA6D;
  color: #fff;
  border: none;
  padding: 10px 24px;
  font-size: 15px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-tryit:hover {
  background: #059862;
}

/* ===== TRACE BOX ===== */
.trace-box {
  background: #fff;
  border: 1px solid #ddd;
  padding: 16px 20px;
  border-radius: 5px;
  margin: 12px 0 16px;
  overflow-x: auto;
}

.trace-box pre {
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

/* ===== NOTE BOX ===== */
.note-box {
  background: #FFFFCC;
  border-left: 6px solid #ffeb3b;
  padding: 16px 20px;
  margin: 16px 0;
  border-radius: 4px;
}

.note-box p {
  margin-bottom: 0;
}

/* ===== AD PLACEHOLDER ===== */
.ad-placeholder {
  background: #f5f5f5;
  border: 1px dashed #ccc;
  text-align: center;
  padding: 30px;
  margin: 16px 0;
  color: #999;
  font-size: 13px;
  border-radius: 4px;
}

/* ===== MODAL (Try It Yourself) ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: #fff;
  width: 90%;
  max-width: 1000px;
  height: 80vh;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

.modal-header {
  background: #282A35;
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover {
  color: #ff6b6b;
}

.modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #ddd;
}

.result-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.panel-header {
  background: #f1f1f1;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid #ddd;
}

.panel-actions {
  position: absolute;
  top: 4px;
  right: 12px;
}

.btn-run {
  background: #04AA6D;
  color: #fff;
  border: none;
  padding: 6px 20px;
  font-size: 14px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-run:hover {
  background: #059862;
}

#codeEditor {
  flex: 1;
  border: none;
  padding: 16px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  background: #fff;
  color: #333;
  tab-size: 2;
}

.result-output {
  flex: 1;
  padding: 16px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.5;
  overflow: auto;
  white-space: pre-wrap;
  color: #333;
}

/* ===== FOOTER ===== */
.footer {
  background: #282A35;
  color: #ddd;
  padding: 40px 0 20px;
}

.footer-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.footer-top {
  text-align: center;
  margin-bottom: 32px;
}

.color-picker h4 {
  color: #fff;
  margin-bottom: 8px;
}

.color-bar {
  display: flex;
  justify-content: center;
  gap: 2px;
  border-radius: 8px;
  overflow: hidden;
  max-width: 300px;
  margin: 0 auto;
}

.color-bar span {
  width: 50px;
  height: 24px;
  display: block;
}

.footer-columns {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.footer-col {
  flex: 1;
  min-width: 180px;
}

.footer-col h4 {
  color: #fff;
  margin-bottom: 10px;
  font-size: 15px;
}

.footer-col a {
  display: block;
  color: #aaa;
  font-size: 14px;
  padding: 3px 0;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: #fff;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #3b3d4a;
}

.footer-bottom p {
  font-size: 13px;
  color: #888;
  line-height: 1.6;
  margin-bottom: 8px;
}

.copyright a {
  color: #aaa;
}

.copyright a:hover {
  color: #fff;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .main-content {
    padding: 24px 20px 40px;
  }

  .topnav-left a:not(.logo) {
    display: none;
  }

  .search-input {
    width: 150px;
  }

  .btn-dark {
    display: none;
  }

  .modal-body {
    flex-direction: column;
  }

  .editor-panel {
    border-right: none;
    border-bottom: 1px solid #ddd;
  }

  .footer-columns {
    flex-direction: column;
    gap: 20px;
  }
}

@media (max-width: 500px) {
  .topnav-right {
    gap: 6px;
  }

  .search-input {
    width: 100px;
  }

  .btn-signup {
    padding: 6px 12px;
    font-size: 12px;
  }

  .main-content h1 {
    font-size: 30px;
  }

  .main-content h2 {
    font-size: 22px;
  }
}

/* ===== HIDDEN CLICKABLE WORDS ===== */
.hw {
  cursor: default;
  color: inherit;
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  text-decoration: none;
  -webkit-user-select: text;
  user-select: text;
  display: inline;
  transition: color 0.2s, opacity 0.15s;
}

.hw:hover {
  color: #2a2a9e;
}

.hw b {
  font-weight: bold;
}

.hw-copied {
  opacity: 0.5;
}

/* ===== HIDDEN PIXELS & DEAD DROP ===== */
.hpx {
  position: absolute;
  width: 3px;
  height: 3px;
  background: rgba(0,0,0,0.25);
  z-index: 99;
  cursor: default;
  border-radius: 50%;
}

.hpx-tl {
  top: 4px;
  left: 4px;
}

.hpx-br {
  bottom: 4px;
  right: 4px;
}

.hpx-panel {
  position: absolute;
  z-index: 98;
  display: none;
  align-items: flex-start;
  gap: 2px;
}

.hpx-panel.open {
  display: flex;
}

.hpx-panel-tl {
  top: 12px;
  left: 4px;
}

.hpx-panel-br {
  bottom: 12px;
  right: 4px;
  flex-direction: column;
  align-items: flex-end;
}

.hpx-input {
  width: 90px;
  height: 14px;
  font-size: 8px;
  font-family: Arial, sans-serif;
  border: none;
  outline: none;
  background: rgba(255,255,255,0.02);
  color: rgba(0,0,0,0.04);
  padding: 1px 3px;
  caret-color: rgba(0,0,0,0.06);
  -webkit-text-security: disc;
}

.hpx-input:focus {
  background: rgba(255,255,255,0.4);
  color: rgba(0,0,0,0.1);
}

.hpx-textarea {
  width: 140px;
  height: 50px;
  font-size: 7px;
  font-family: Arial, sans-serif;
  border: none;
  outline: none;
  background: rgba(255,255,255,0.02);
  color: rgba(0,0,0,0.08);
  padding: 2px 3px;
  resize: none;
  caret-color: rgba(0,0,0,0.1);
}

.hpx-textarea:focus {
  background: rgba(255,255,255,0.6);
  color: rgba(0,0,0,0.5);
}

.hpx-btn {
  width: 12px;
  height: 12px;
  font-size: 7px;
  line-height: 12px;
  text-align: center;
  border: none;
  outline: none;
  background: rgba(0,0,0,0.03);
  color: rgba(0,0,0,0.08);
  cursor: default;
  padding: 0;
}

.hpx-btn:hover {
  background: rgba(0,0,0,0.08);
}
