:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-soft: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-soft: #6b7280;
  --text-faint: #9ca3af;
  --primary: #111827;
  --primary-contrast: #ffffff;
  --focus: rgba(17, 24, 39, 0.1);
  --danger: #b91c1c;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.05);
  --radius: 14px;
}

body.dark {
  --bg: #0d1117;
  --surface: #11161d;
  --surface-soft: #181e27;
  --border: #27303b;
  --text: #f3f4f6;
  --text-soft: #9ca3af;
  --text-faint: #667085;
  --primary: #f3f4f6;
  --primary-contrast: #111827;
  --focus: rgba(255, 255, 255, 0.08);
  --danger: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.hidden {
  display: none !important;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.nav {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.9;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  padding: 8px 10px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.nav-link:hover {
  color: var(--text);
}

.theme-toggle {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.theme-toggle:hover {
  background: var(--surface-soft);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

main {
  padding: 56px 0 72px;
}

.hero {
  max-width: 760px;
  margin: 0 auto 26px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
}

.hero h1,
.panel-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.panel-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.hero p,
.lede {
  margin: 14px auto 0;
  max-width: 620px;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.65;
}

.editor-wrap {
  max-width: 980px;
  margin: 0 auto;
}

.editor-card,
.options,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.editor-card,
.panel {
  overflow: hidden;
}

.local-save-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
}

.local-save-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.local-save-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.local-save-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.local-save-label input,
.option-left input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 18px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--text-faint);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.local-save-label input::before,
.option-left input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  background: var(--primary-contrast);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
}

.local-save-label input:checked,
.option-left input[type="checkbox"]:checked {
  border-color: var(--primary);
  background: var(--primary);
}

.local-save-label input:checked::before,
.option-left input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.local-save-label input:focus-visible,
.option-left input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}

.info-wrap {
  position: relative;
  display: inline-flex;
}

.info-btn {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.info-btn svg {
  width: 16px;
  height: 16px;
}

.info-btn:hover,
.info-btn[aria-expanded="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
}

.info-tip {
  display: none;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.5;
}

.local-save-bar:has(.info-wrap:hover) .info-tip,
.local-save-bar:has(.info-wrap:focus-within) .info-tip,
.local-save-bar:has(.info-btn[aria-expanded="true"]) .info-tip {
  display: block;
}

.new-note-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 0.88rem;
  font-weight: 700;
}

.new-note-btn svg {
  width: 16px;
  height: 16px;
}

.new-note-btn:hover {
  opacity: 0.88;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 7px;
  margin-right: 2px;
  border-right: 1px solid var(--border);
}

.toolbar-group:last-of-type {
  border-right: 0;
  margin-right: 0;
  padding-right: 0;
}

.fullpage-btn {
  margin-left: auto;
}

.fullpage-btn svg {
  width: 18px;
  height: 18px;
}

.editor-wrap.is-fullpage,
#editSection.is-fullpage {
  position: fixed;
  inset: 0;
  z-index: 40;
  max-width: none;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.editor-wrap.is-fullpage .editor-card,
#editSection.is-fullpage .editor-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  box-shadow: none;
}

.editor-wrap.is-fullpage .note-editor,
#editSection.is-fullpage .note-editor {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.editor-wrap.is-fullpage .options,
#editSection.is-fullpage .options {
  margin-top: 0;
  border-radius: 0;
  max-height: 34vh;
  overflow: auto;
}

body.notepad-fullpage {
  overflow: hidden;
}

.tool-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.86rem;
  font-weight: 600;
}

.tool-btn:hover,
.tool-btn.active {
  background: var(--surface-soft);
  color: var(--text);
}

.tool-select,
.option-control,
.key-input,
.note-editor:focus {
  outline: none;
}

.tool-select {
  height: 34px;
  max-width: 145px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.tool-select:focus,
.option-control:focus,
.key-input:focus,
.note-editor:focus {
  border-color: var(--text-faint);
  box-shadow: 0 0 0 4px var(--focus);
}

.note-editor {
  min-height: 430px;
  width: 100%;
  padding: 28px;
  outline: none;
  color: var(--text);
  background: var(--surface);
  line-height: 1.72;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.note-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
  pointer-events: none;
}

.note-readonly {
  min-height: 240px;
}

.note-readonly:empty::before {
  content: none;
}

.note-editor h2,
.note-editor h3 {
  letter-spacing: -0.02em;
}

.note-editor a {
  text-decoration: underline;
}

.note-editor blockquote {
  margin: 16px 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--border);
  color: var(--text-soft);
}

.note-editor pre {
  padding: 14px;
  overflow: auto;
  border-radius: 10px;
  background: var(--surface-soft);
  white-space: pre-wrap;
}

.note-editor ul,
.note-editor ol {
  margin: 12px 0;
  padding-left: 1.4rem;
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 18px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.78rem;
}

.options,
.panel-body {
  margin-top: 22px;
  padding: 22px;
}

.panel .panel-body {
  margin-top: 0;
}

.options-title,
.section-label {
  margin: 0 0 16px;
  font-size: 0.92rem;
  font-weight: 700;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.option-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.option-left {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.option-left input[type="checkbox"] {
  margin-top: 1px;
}

.option-spacer {
  width: 17px;
  flex: 0 0 17px;
}

.option-label {
  display: block;
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.35;
}

.option-help {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.45;
}

.inline-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.option-control {
  min-width: 86px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
}

.days-control {
  min-width: 108px;
}

.suffix {
  color: var(--text-soft);
  font-size: 0.84rem;
}

.save-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.save-row.split {
  justify-content: space-between;
}

.save-btn,
.ghost-btn,
.danger-btn {
  min-width: 124px;
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  font-weight: 700;
}

.save-btn {
  border: 0;
  background: var(--primary);
  color: var(--primary-contrast);
}

.save-btn:hover,
.ghost-btn:hover,
.danger-btn:hover {
  opacity: 0.9;
}

.save-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.ghost-btn,
.danger-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.danger-btn {
  color: var(--danger);
}

.status {
  min-height: 1.25em;
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.status.error {
  color: var(--danger);
}

.description {
  max-width: 760px;
  margin: 48px auto 0;
  text-align: center;
}

.description h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

.description p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.7;
}

.faq {
  max-width: 760px;
  margin: 56px auto 0;
}

.faq h2 {
  margin: 0 0 16px;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  text-align: center;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: -0.01em;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-right: 1.5px solid var(--text-soft);
  border-bottom: 1.5px solid var(--text-soft);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.faq-item[open] summary::after {
  transform: rotate(225deg);
}

.faq-item summary:hover {
  color: var(--text);
}

.faq-item p {
  margin: 0;
  padding: 0 18px 16px;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.65;
}

.faq-item p + p {
  padding-top: 0;
  margin-top: -6px;
}

footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.footer-link:hover {
  color: var(--text);
}

.key-input {
  width: 100%;
  height: 46px;
  margin-top: 16px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}

.stack .section-label,
.meta-line {
  margin: 0;
}

.meta-line {
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}

.key-value,
.share-url {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  user-select: all;
}

.callout {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.narrow {
  max-width: 640px;
  margin: 0 auto;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 1180px);
  }

  .nav {
    min-height: 62px;
  }

  .nav-link {
    display: none;
  }

  main {
    padding-top: 38px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .toolbar {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .note-editor {
    min-height: 360px;
    padding: 20px;
  }

  .option-row,
  .save-row.split,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-controls {
    width: 100%;
    padding-left: 28px;
  }

  .footer-inner {
    min-height: 72px;
    justify-content: center;
    padding: 14px 0;
  }
}
