* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  min-height: 100%;
  background: #f7f6f3;
  color: #2e2e2c;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", "Liberation Mono", Menlo, monospace;
  overflow: hidden;
}

.window {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  border: 2px solid #2e2e2c;
  background: #f7f6f3;
}

/* Title bar */
.titlebar {
  background: #2e2e2c;
  border-bottom: 2px solid #2e2e2c;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  user-select: none;
  flex-wrap: wrap;
}

.titlebar .title {
  color: #f7f6f3;
  letter-spacing: 1px;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
}

.titlebar .status {
  color: #a8a59e;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-transform: none;
  letter-spacing: normal;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #f7f6f3;
  border-radius: 50%;
  margin-right: 9px;
  vertical-align: middle;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: #f7f6f3;
  border-bottom: 2px solid #2e2e2c;
  flex-wrap: wrap;
}

.toolbar .left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.support {
  font-size: 14px;
  color: #6e6b66;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.support a {
  color: #2e2e2c;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.support a:hover { color: #6e6b66; }
.support .sep { color: #b5b2ac; }

/* Writing areas */
.panels {
  flex: 1;
  display: flex;
  gap: 14px;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
  background: #ebe8e1;
}

.panel {
  flex: 1 1 0;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  border: 2px solid #2e2e2c;
  border-radius: 0;
  overflow: hidden;
  background: rgba(247, 246, 243, 0.92);
  position: relative;
}

.panel.active {
  border-color: #2e2e2c;
  box-shadow: 0 0 0 2px #2e2e2c inset;
}

.panel-remove {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  background: none;
  border: none;
  color: #9c9992;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 6px;
}
.panel-remove:hover { color: #2e2e2c; }

textarea.notes {
  flex: 1;
  width: 100%;
  background: transparent;
  color: #2e2e2c;
  border: none;
  padding: 20px 18px;
  font-size: 24px;
  line-height: 1.4;
  font-family: inherit;
  resize: none;
  outline: none;
  caret-color: #2e2e2c;
}

textarea.notes::placeholder { color: #b5b2ac; font-size: 18px; }

/* Buttons */
.btn {
  background: #f7f6f3;
  border: 2px solid #2e2e2c;
  color: #2e2e2c;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 0;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.btn:hover { background: #2e2e2c; color: #f7f6f3; }
.btn:active { background: #3a3a3a; border-color: #3a3a3a; }

.btn.danger { border-style: dotted; }

.btn.ghost { border-color: #b5b2ac; color: #6e6b66; }
.btn.ghost:hover { background: #2e2e2c; color: #f7f6f3; border-color: #2e2e2c; }

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: #f7f6f3 !important;
  color: #b5b2ac !important;
  border-color: #b5b2ac !important;
}

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #2e2e2c;
  border-top: 2px solid #2e2e2c;
  font-size: 15px;
  color: #a8a59e;
  gap: 12px;
  flex-wrap: wrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer .hint { color: #a8a59e; text-transform: none; letter-spacing: normal; }

.footer .buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.footer .btn { background: #2e2e2c; color: #f7f6f3; border-color: #f7f6f3; }
.footer .btn:hover { background: #f7f6f3; color: #2e2e2c; }

/* Overlay / dialog */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(46, 46, 44, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.overlay.visible { display: flex; }

.chooser {
  background: #f7f6f3;
  border: 2px solid #2e2e2c;
  border-radius: 0;
  padding: 24px 26px;
  min-width: 280px;
  max-width: 360px;
  text-align: center;
}

.chooser h3 {
  color: #2e2e2c;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.panel-checklist {
  text-align: left;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 160px;
  overflow-y: auto;
  padding: 4px 2px;
}

.panel-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #2e2e2c;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.panel-checklist input { accent-color: #2e2e2c; }

.chooser .opts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.chooser .btn { min-width: 100px; justify-content: center; }

.chooser .cancel {
  margin-top: 16px;
  font-size: 14px;
  color: #6e6b66;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chooser .cancel:hover { color: #2e2e2c; }

/* Intro card */
.intro-card {
  max-width: 420px;
  text-align: left;
}

.intro-card h3 {
  margin-bottom: 18px;
}

.intro-text {
  color: #2e2e2c;
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 22px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.intro-card .btn {
  width: 100%;
  justify-content: center;
}

/* Mobile */
@media (max-width: 700px) {
  textarea.notes { font-size: 20px; }
  .footer .buttons { width: 100%; justify-content: space-between; }
  .btn { flex: 1; justify-content: center; font-size: 11px; padding: 11px 8px; }
  .support { font-size: 12px; gap: 6px; }
  .titlebar .status { font-size: 13px; }
}

@media (max-width: 700px) {
  .window {
    height: 100dvh;
    border-width: 1px;
  }

  .panels {
    padding: 10px;
  }

  .footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}