:root {
  --bg: #111;
  --text: white;
  --primary: #3498db;
  --page-out: white;
}

/* Dark Theme OK*/
.dark-theme {
  --bg: black;
  --text: #e5e7eb;
  --primary: #60a5fa;
  --accent: #5212a5;
  --card: rgba(255, 255, 255, 0.05); /* editor and preview bg*/
  --border: #374151;
  --grid-lines: rgba(202, 202, 202, 0.114);
}

/* Light Theme OK*/
.light-theme {
  --bg: white;
  --text: black;
  --primary: black;
  --accent: #9a9a9a;
  --card: rgba(255, 255, 255, 0.7);
  --border: #020202;
  --grid-lines: rgba(0, 0, 0, 0.114);
}

/* Halloween Theme OK*/
.halloween-theme {
  --bg: linear-gradient(135deg, #0b0b0f, #1a0f1a, #2b0a2b);
  --text: #ffe9c7be;
  --primary: #ff6a00bd;
  --accent: #ff9d00b4;
  --card: rgba(0, 0, 0, 0.6);
  --border: #ff6a00b7;
  --grid-lines: rgba(255, 0, 0, 0.114);
}

/* winter Theme OK*/
.winter-theme {
  --bg: #dcf763;
  --text: black;
  --primary: #848c8e;
  --accent:   #bfb7b6;
  --card: #f1f2ee;
  --border: #bbdbd1;
  --grid-lines: rgba(187, 219, 209, 0.114);
}


body {
  margin: 0px;
  font-family: 'Courier New', Courier, monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

a {
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
}

.toolbar {
  margin-left: 10px;
  padding: 8px 12px;
  border: none;
  cursor: pointer;
  background: none;
  color: var(--text);
}
button{
  color: var(--text);
  font-size: 19px;
  background:none;
  border: none;
  padding: 5px;
}
button:hover {
  background: var(--accent);
  transform: scale(1.05);
}

main {
  display: flex;
  height: calc(100vh - 70px);
}

.editor-panel{
  width: 50%;
  padding: 16px;
  box-sizing: border-box;
  overflow: none;
}
.preview-panel {
  background: var(--card);
  width: 50%;
  padding: 16px;
  box-sizing: border-box;
  overflow: auto;
}

.editor-panel {
  border-right: 1px solid var(--accent);
}

textarea {
  width: 100%;
  height: 100%;
  background: var(--card);
  color: var(--text);
  border: 0.6px solid black;
  resize: none;
  font-family: monospace;
  font-size: 15px;
  line-height: 1.5;
  outline: none;
  tab-size: 4;
  /* indentation guides */
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(4ch - 1px),
    var(--grid-lines) calc(4ch - 1px),
    var(--grid-lines) 4ch
  );

  background-attachment: local;
}

#preview {
  background: var(--card);
  white-space: pre-wrap;
  font-family: monospace;
  line-height: 1.6;
}

.goal { color: #7cc7ff; }
.logic { color: #ffcc66; font-weight: bold; }
.special { color: #ff8888; }
.completed{color:green;}
.blocked{font-weight: bold; color: var(--text);}

.underheader {
  border-bottom: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.key-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  font-size: 15px;
  width: 50%;
  box-sizing: border-box;
  gap: 10px;
}

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

/* PHONE MODE */
@media (max-width: 768px) {

  .underheader {
    flex-direction: column;
    align-items: stretch;
    border-bottom: none;
  }

  .key-info {
    width: 100%;
    border-right: none !important;
    border-bottom: 1px solid var(--accent);
    flex-direction: column;
    align-items: flex-start;
  }

  .right {
    width: 100%;
    margin-top: 6px;
  }

  .right button {
    flex: 1;
    min-width: 44px;
  }
}

.highlight {
  display: inline-flex;
  align-items: center;
  background-color: var(--card);
  border: 1px solid var(--accent);
  border-radius: 20px;
  color: var(--text);
  padding: 5px;
}

#suggestions {
      border: 1px solid #ccc;
      border-radius: 5px;
      max-width: 200px;
      display: none;
      position: absolute;
      background: rgb(43, 42, 42);
      font-family: monospace;
      font-size: 15px;
      color:white;
    }

    .item {
      padding: 5px;
      cursor: pointer;
    }

    .item.active {
      background: #8f9092;
      color: white;
    }


@page {
  size: A4;
  margin: 20mm;
}
@media print {
  /* hide everything */
  body * {
    visibility: hidden;
  }

  /* show only preview section */
  .preview-panel,
  .preview-panel * {
    visibility: visible;
  }

  /* position it at top-left for clean PDF */
  .preview-panel {
    position: absolute;
    font-size: var(--print-font-size, 9pt);
    left: 0;
    top: 0;
    width: 100%;
  }
}


.footer {
  background: var(--bg);
  border-top: 1px solid var(--accent);
  color: var(--text);
  padding: 15px;
  text-align: center;
}

.icons a {
  color: var(--text);
  font-size: 20px;
  text-decoration: none;
}

.right-column {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* align to right */
  margin-left: 20px;   /* space from right edge */
  gap: 10px;            /* spacing between items */
}

/* ======= Tooltips ======== */

.tooltip-btn {
  position: relative;
}

.tooltip {
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);

  background: #222;
  color: white;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;

  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  white-space: nowrap;
}

.tooltip-btn:hover .tooltip {
  opacity: 1;
}

/* ======= Guide ========= */

code, pre {
      background: var(--bg);
      color: var(--text);
      padding: 4px 6px;
      border-radius: 6px;
      font-family: monospace;
    }

    pre {
      padding: 18px;
      overflow-x: auto;
      border: 1px solid var(--border);
    }

    .tag {
      color: #ffcc66;
      font-weight: bold;
    }

    .note {
      background: var(--bg);
      padding: 14px;
      border-left: 4px solid var(--accent);
      margin: 20px 0;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      margin: 20px 0;
    }

    th, td {
      border: 1px solid var(--border);
      padding: 12px;
      text-align: left;
    }

    th {
      background: var(--bg);
      color: var(--text);
    }

    ul li {
      margin-bottom: 10px;
    }

     h1, h2, h3 {
      color: var(--text);
    }

/*====== intent guides ======*/

.editor-wrapper {
  position: relative;
  height: 100%;
}

.indent-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;

  /* 4-character tab width */
  background-image:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(4ch - 1px),
      rgba(255,255,255,0.08) calc(4ch - 1px),
      rgba(255,255,255,0.08) 4ch
    );
}

/*============= Graph ============*/
#graph {
      background: var(--bg);
      padding: 20px;
      border-radius: 8px;
      overflow: auto;
      width: 100%;
      height: 100%;
    }


/* ========== toggle button =========*/

.switch {
      position: relative;
      display: inline-block;
      width: 80px;
      height: 36px;
    }

    .switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    .slider {
      position: absolute;
      inset: 0;
      cursor: pointer;
      background-color: var(--bg);
      border: 1px solid var(--accent);
      border-radius: 36px;
      transition: 0.3s;

      display: flex;
      align-items: center;
      justify-content: space-between;

      padding: 0 10px;
      box-sizing: border-box;

      font-family: 'Courier New', Courier, monospace;
      font-size: 15px;
      color: var(--text);
    }

    .slider::before {
      content: "";
      position: absolute;
      height: 28px;
      width: 28px;
      left: 4px;
      top: 4px;
      background-color: var(--grid-lines);
      border-radius: 50%;
      transition: 0.3s;
      z-index: 2;
    }

    input:checked + .slider {
      background-color: var(--accent);
    }

    input:checked + .slider::before {
      transform: translateX(44px);
    }

     .label-left,
    .label-right {
      z-index: 1;
      user-select: none;
    }