:root {
  --bg: #F4EFE3;
  --bg-panel: #EAE2D0;
  --bg-panel-2: #FBF8F0;
  --text: #1A1A1A;
  --text-muted: #6B6455;
  --border: #D9CFB8;
  --brand: #134656;
  --brand-soft: #E4EEEC;
  --link-1: #134656;
  --link-2: #C4C752;
  --action: #D97F3D;
  --action-text: #FFFCF6;
  --success: #3F8F5B;
  --focus: #134656;
  --tooltip-bg: #1A1A1A;
  --tooltip-text: #F4EFE3;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12222A;
    --bg-panel: #1A2E37;
    --bg-panel-2: #16272F;
    --text: #F4EFE3;
    --text-muted: #A7B4B1;
    --border: #2B4048;
    --brand: #7FA89A;
    --brand-soft: #1E3038;
    --link-1: #7FA89A;
    --link-2: #C4C752;
    --action: #E5964F;
    --action-text: #1A1A1A;
    --success: #5CB37D;
    --focus: #7FA89A;
  }
}

:root[data-theme="dark"] {
  --bg: #12222A;
  --bg-panel: #1A2E37;
  --bg-panel-2: #16272F;
  --text: #F4EFE3;
  --text-muted: #A7B4B1;
  --border: #2B4048;
  --brand: #7FA89A;
  --brand-soft: #1E3038;
  --link-1: #7FA89A;
  --link-2: #C4C752;
  --action: #E5964F;
  --action-text: #1A1A1A;
  --success: #5CB37D;
  --focus: #7FA89A;
}

* { box-sizing: border-box; }
html { background: var(--bg); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  max-width: 920px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.brand-font {
  font-family: "Avenir Next", "Century Gothic", Futura, ui-sans-serif, sans-serif;
}

a { color: var(--link-1); }

.lang-switch {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.75rem;
  opacity: 0.6;
}
.lang-switch a { color: inherit; text-decoration: none; }
.lang-switch a:hover { text-decoration: underline; }
.lang-switch span[aria-current] { color: var(--text); font-weight: 600; }

#theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
}
#theme-toggle:hover { background: var(--bg-panel); }
#theme-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.hero-link { display: block; text-decoration: none; color: inherit; }

header.hero {
  margin: 0.5rem 0 2.5rem;
}

.intro-text {
  margin: -1.25rem 0 2rem;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
}

.mark {
  display: inline-block;
  vertical-align: text-bottom;
  margin-right: 1.1rem;
}
.mark svg { display: block; }

.wordmark {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
}

.subtitle {
  margin: 0.1rem 0 0 calc(52px + 1.1rem);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.3;
}

main.app { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; }
@media (max-width: 680px) { main.app { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .subtitle { margin-left: 0; } }

h2.section-title {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

textarea {
  width: 100%;
  min-height: 190px;
  background: var(--bg-panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}
textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
textarea.sample { color: var(--text-muted); }

.controls-panel {
  margin-top: 1rem;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.3rem 1.2rem;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field-group { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

select, input[type="number"] {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font-family: inherit;
  font-size: 0.9rem;
}
select:focus-visible, input[type="number"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.controls-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.toggle-group { display: flex; flex-wrap: wrap; gap: 1.3rem; }
.toggle-row { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; }
.toggle-row input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--action); cursor: pointer; }
.toggle-row label { cursor: pointer; }

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  cursor: help;
  position: relative;
  flex-shrink: 0;
  user-select: none;
}
.info-icon:hover, .info-icon:focus-visible { border-color: var(--brand); color: var(--brand); outline: none; }

.info-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 400;
  font-style: normal;
  font-family: inherit;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  z-index: 20;
}
.info-icon::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--tooltip-bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 20;
}
.info-icon:hover::after, .info-icon:focus-visible::after,
.info-icon:hover::before, .info-icon:focus-visible::before {
  opacity: 1;
  visibility: visible;
}

.btn-apply {
  background: var(--action);
  color: var(--action-text);
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}
.btn-apply:hover { filter: brightness(1.06); }
.btn-apply:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.clean-hint { margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--text-muted); }

@media (max-width: 480px) {
  .controls-grid { grid-template-columns: 1fr; }
  .controls-footer { align-items: flex-start; }
  .btn-apply { width: 100%; }
}

.instructions-box {
  margin-top: 1.75rem;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.3rem;
}
.instructions-box h3 { margin: 0 0 0.6rem; font-size: 0.95rem; }

ol.steps { margin: 0; padding-left: 1.2rem; color: var(--text-muted); font-size: 0.88rem; }
ol.steps li { margin-bottom: 0.35rem; }
ol.steps li:last-child { margin-bottom: 0; }

.post-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem 1rem;
  margin-bottom: 1rem;
  position: relative;
  transition: opacity 0.25s ease;
}
@media (prefers-reduced-motion: reduce) { .post-card { transition: none; } }

.post-card.copied-post { opacity: 0.55; }
.post-card.copied-post:hover,
.post-card.copied-post:focus-within { opacity: 1; }

.post-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.btn-copy {
  background: var(--brand);
  color: var(--bg-panel-2);
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-copy:hover { filter: brightness(1.1); }
.btn-copy:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn-copy.copied { background: var(--success); color: #fff; }

.char-count { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.post-text { font-size: 0.92rem; margin: 0; }
.post-text a { text-decoration: underline; }
.post-number { color: var(--text-muted); font-size: 0.85rem; }

.mention, .hashtag {
  color: var(--text-muted);
  background: var(--bg-panel-2);
  border-radius: 3px;
  padding: 0 3px;
}

footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}
footer a { color: var(--text-muted); text-decoration: underline; }
footer .credit { margin-top: 0.6rem; }
footer .credit p { margin: 0; }

main.article { max-width: 720px; }
main.article h1 { font-size: 1.7rem; margin: 0 0 1rem; }
main.article h2 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
main.article p { margin: 0 0 0.9rem; }

.faq-list details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
  background: var(--bg-panel-2);
}
.faq-list summary { font-weight: 700; cursor: pointer; }
.faq-list details[open] summary { margin-bottom: 0.6rem; }
.faq-list p { margin: 0; color: var(--text); font-size: 0.95rem; }
