/* =========================
   CSS Variables
========================= */
:root {
  --green: #4a8458;
  --light-green: #eaf4e6;
  --dark: #1f2933;
  --muted: #6b7280;
  --bg: #f9fafb;
  --card: #ffffff;
  --border: #e5e7eb;
  --chat-background: #e7f7ee;
  --icon-background: #fff;
  --example-background: #F7F5F3;
  --text: #0e0a0a;
  --error: #b91c1c;
}

/* =========================
   Reset / Base
========================= */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

/* =========================
   Login Prompt
========================= */

#auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

#auth-overlay[hidden] {
  display: none;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.auth-modal {
  position: relative;
  background: #fff;
  width: min(90%, 360px);
  padding: 20px;
  border-radius: 10px;
  z-index: 1;
}


.auth-switch .btn-login,
.auth-switch .btn-signup {
  color: var(--green)
}

/* --------------------
   Resend verification
-------------------- */

.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.notice-success {
  background: #f0f9f3;
  border: 1px solid #b7e3c3;
  color: #256c3a;
}
.notice-error {
  background: #fdf2f2;
  border: 1px solid #f5b7b7;
  color: #8a1c1c;
}
.auth-top-success {
  text-align: center;
}

/* --------------------
   Auth modal content
-------------------- */

.auth-modal p {
  margin-bottom: 16px;
  font-size: 15px;
}

.auth-actions {
  display: flex;
  gap: 12px;
}

.auth-actions a {
  flex: 1;
  padding: 10px 12px;
  text-align: center;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
}

.auth-actions a:first-child {
  background: var(--green);
  color: #fff;
}

.auth-actions a.secondary {
  background: #eee;
  color: #000;
}

.auth-actions a:hover {
  opacity: 0.9;
}

.auth-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}
.auth-message {
  text-align: center;
  max-width: 420px;
  margin: 0 auto 24px;
  color: #444;
}


/* =========================
   Login Header
========================= */

.auth-back {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 14px;
  color: #555;
  text-decoration: none;
}

.auth-back:hover {
  text-decoration: underline;
}

.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

main.auth .auth-top h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}
auth .auth-top-success h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
}

.auth-top .lang-switch {
  font-size: 14px;
  opacity: 0.7;
  white-space: nowrap;
}

.auth-top .lang-switch a {
  text-decoration: none;
  color: inherit;
}

.lang-switch a {
  color: inherit;
  text-decoration: none;
  -webkit-text-decoration: none;
}

.auth-top .lang-switch a:hover {
  text-decoration: underline;
}

.lang-switch a:active {
  text-decoration: underline;
}

.auth-top .lang-switch strong {
  font-weight: 500;
  opacity: 1;
}

.auth-link {
  color: #4a8458;
  text-decoration: underline;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}

.auth-link:hover {
  text-decoration: none;
}
.center {
  text-align: center;
}


/* =========================
   Menu Button
========================= */
.login-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  line-height: 1;
  background: transparent;
  border: solid 1px;
}

.login-pill:hover {
  background: var(--light-green);
  text-decoration: none;
}

.account .login-pill,
.account .login-pill:hover,
.account .login-pill:focus,
.account .login-pill:active {
  text-decoration: none;
}


.top {
  position: relative;
}

.menu-btn {
  width: 24px;
  height: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.menu-btn,
.menu-btn:focus,
.menu-btn:active,
.menu-btn:focus-visible {
  outline: none;
  border: none;
  box-shadow: none;
}


.menu-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: #111;
  border-radius: 2px;
}


.menu-dropdown {
  position: absolute;
  top: 56px;
  right: 12px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
}

.menu-dropdown a,
.menu-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  font-size: 14px;
  color: #111;
  cursor: pointer;
}


.menu-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 6px 0;
}

.menu-dropdown .menu-logout,
.menu-dropdown .menu-login {
  all: unset;
  display: block;
  width: 100%;
  padding: 10px 16px;

  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.menu-dropdown .menu-logout {
  color: #ce0f0f;
}

.menu-dropdown .menu-login {
  color: var(--green);
}

.menu-dropdown a.active {
  font-weight: 600;
}

.menu-dropdown .menu-logout:focus,
.menu-dropdown .menu-logout:active {
  background: #fef2f2;
  outline: none;
}

.menu-dropdown a:hover {
  background: #f3f4f6;
}




/* =========================
   Brand / Account
========================= */
.brand {
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
  color: var(--green);
}

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

.brand:hover {
  text-decoration: underline;
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.lang-switch {
  white-space: nowrap;
}

.account a,
.lang-switch {
  font-size: inherit;
  color: inherit;
  opacity: 0.7;
  text-decoration: none;
}

.account a:hover {
  text-decoration: underline;
  opacity: 1;
}

.lang-switch strong {
  opacity: 1;
  font-weight: 500;
}

.account a.logout {
  min-width: 64px;
  text-align: right;
  display: inline-block;
  letter-spacing: -0.01em;
}

.account a.login {
  min-width: 64px;
  text-align: right;
  display: inline-block;
  letter-spacing: -0.01em;
}

.account a,
.lang-switch {
  white-space: nowrap;
}

/* =========================
   Layout
========================= */
main {
  padding: 16px;
  max-width: 620px;
  margin: 0 auto;
}

header {
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.header-inner {
  padding: 12px 32px;
  max-width: 620px;
  margin: 0 auto;
}

header .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.meta {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-text {
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
  letter-spacing: 0.2px;
}

/* =========================
   Hero
========================= */

.hero-intro {
  text-align: center;
  padding: 12px;
  margin: 12px 0 8px;
  margin-top: 0;

  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
}

.hero-intro h1 {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
}

.hero-headline {
  white-space: pre-line;
}

.hero-subline {
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 0.95rem;
  color: #6b7280;
}

.hero-example {
  font-size: 0.9rem;
  color: #6b7280;
  margin-top: 12px;
}

/* ============================================================================================================*/


.example {
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  background: var(--example-background);
  display: flex;
  align-items: center;
  font-size: 13px;
  text-align: left;
  justify-content: center;
  gap: 24px;
  padding-bottom: 18px;


}

.chat-wrapper {
  max-width: 40%;
  display: flex;
  flex-direction: column;
}

.chat {
  margin-left: 8px;
  margin-top: 8px;
  background: #D9FDD3;
  padding: 12px 12px;
  border-radius: 0px 14px 14px 14px;
  line-height: 1.4;
  position: relative;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.08);
  line-height: 1.5;
}

.arrow-right {
  padding-top: 3px;
  display: inline-flex;
  color: var(--green);
  align-self: flex-end;
}

.resul-wrapper {
  display: flex;
  flex-direction: column;

}

.result {
  margin-right: 8px;
  background: var(--bg);
  border-radius: 14px;
  padding: 12px 12px;
  border-radius: 14px 14px 0px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  line-height: 1.5;
  transform: translateY(36px);
}

.arrow-down {
  padding-top: 3px;
  padding-bottom: 12px;
  display: inline-flex;
  color: var(--green);
  align-self: flex-end;
  padding-top: 50px;
  transform: translateY(36px);


}

.chat .time {
  display: block;
  color: #6b7280;
  text-align: right;
  margin-top: 6px;
  font-size: 10px;
}

.result div {
  display: flex;
  gap: 6px;
}

.check-icon {
  padding-top: 3px;
  display: inline-flex;
  color: var(--green);
}

.check-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 3;
}

/* ============================================================================================================*/

/* =========================
   Input
========================= */


#inputText {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  padding-right: 28px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0.3px;
  color: #374151;
  margin-top: 12px;

  background-color: var(--bg);

  border: 1px solid;
  border-radius: 10px;
  border-color: var(--green);

  resize: vertical;
  box-sizing: border-box;
  overflow: hidden;
  transition:
    min-height 0.6s ease,
    border-color 0.3s ease,
    background-color 0.3s ease;
}

#inputText:focus {
  outline: none;
  min-height: 280px;
  border-color: var(--green);
  background-color: var(--bg);
  border: 2px solid;
  border-color: var(--green);
}

#inputText::placeholder {
  color: #9ca3af;
}

.input-warning {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--error);
}

/* =========================
   Forms
========================= */
form>* {
  margin-bottom: 14px;
}

form>*:last-child {
  margin-bottom: 0;
}

input,
textarea {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}

textarea {
  min-height: 220px;
  resize: vertical;
}

@media (max-width: 768px) {
  textarea {
    min-height: 30vh;
    font-size: 16px;
  }
}

/* =========================
   Clear Button
========================= */
.input-wrap {
  position: relative;
  margin-bottom: 0;
}

.input-wrap textarea {
  padding-right: 44px;
}

.clear-btn {
  position: absolute;
  top: 20px;
  right: 10px;

  width: 24px;
  height: 24px;

  border: none;
  border-radius: 6px;
  /* not a circle */
  background: transparent;
  /* no bubble */

  color: #9aa0a6;
  font-size: 18px;
  line-height: 1;

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

  cursor: pointer;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, color 0.15s ease;
}


.clear-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.clear-btn:hover {
  color: #374151;
}

/* =========================
   Submit Button
========================= */

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* =========================
   Character Counter
========================= */


#charCounter.warn #charCount {
  color: #c05621;
}

.input-meta {
  display: flex;
  flex-direction: column;
  /* THIS */
  align-items: flex-start;
  /* left aligned */
  gap: 2px;
  /* small vertical spacing */
  margin-top: 4px;
  font-size: 0.70rem;
  color: #777;
}


.char-counter {
  color: inherit;
}



.quota {
  font-size: inherit;
  color: inherit;
  white-space: nowrap;
}



/* =========================
   Errors
========================= */
.error {
  color: var(--error);
  margin: 12px 0;
  font-size: 14px;
  text-align: center
}

/* =========================
   Actions (Submit only)
========================= */
.actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.actions button,
form button[type="submit"] {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
}

@media (min-width: 768px) {
  .actions {
    display: flex;
    gap: 12px;
  }

  .actions button,
  form button[type="submit"] {
    width: auto;
    min-width: 200px;
  }
}

.logout-form button.logout {
  all: unset;
  cursor: pointer;
  color: inherit;
  font: inherit;
  min-width: 64px;
  text-align: right;
  display: inline-block;
  letter-spacing: -0.01em;
}



/* ======================
   OUTPUT SECTION
   ====================== */


.output {
  margin-top: 0px;
  padding-top: 16px;
}

/* ---- Container ---- */

.output-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.output-box:focus-within {
  border-color: #9ca3af;
  background: #ffffff;
}

/* ---- Text base ---- */

.output-text {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15.5px;
  line-height: 1.45;
  color: #1f2937;

  padding: 48px 16px 16px 16px;
  background: transparent;
  border: none;
  outline: none;

  white-space: normal;
  /* IMPORTANT: stop pre-wrap spacing */
  word-break: break-word;

  cursor: text;
}

.example-output-text {
  white-space: pre-line;

  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #374151;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0.3px;
  font-weight: 400;

  padding: 12px 14px;
  padding-top: 0;
}

/* keep natural caret + focus */
.output-text:focus {
  outline: none;
}

/* ---- HARD reset for all content ---- */

.output-text * {
  margin: 0;
  padding: 0;
}

/* ---- Title ---- */

.output-text h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.35;
  color: #111827;
}

/* ---- Paragraphs ---- */

.output-text p {
  margin-bottom: 8px;
  line-height: 1.45;
}

.output-text p strong {
  display: inline-block;
  margin-bottom: 4px;
}

/* ---- Strong ---- */

.output-text strong {
  font-weight: 600;
}

@media (max-width: 480px) {
  .copy-control {
    width: 40px;
    height: 40px;
    top: 8px;
    right: 8px;
  }

  .output-text {
    padding-top: 44px;
  }
}


/* ---- Lists ---- */

.output-text ul {
  margin-bottom: 10px;
  padding-left: 16px;
}

.output-text li {
  margin-bottom: 6px;
}

.output-text li strong {
  display: inline-block;
  margin-bottom: 4px;
}

/* ---- Kill artificial spacing ---- */

.output-text br {
  display: none;
}

/* ---- Mobile ---- */

@media (max-width: 480px) {
  .output-text {
    font-size: 15px;
    line-height: 1.45;
  }
}

/* submit */
form>button[type="submit"] {
  display: block;
  margin: 0 auto;
  width: auto;
  min-width: 160px;
}


/* toolbar */
.output-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0px 12px;
}

/* Copy button container */
.copy-control {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 48px;
  height: 48px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: none;
  border: none;

  cursor: pointer;
  user-select: none;

  color: inherit;
}

.copy-control:focus {
  outline: none;
}



/* Icon + feedback share the same slot */
.copy-icon,
.copy-feedback {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hide feedback by default */
.copy-feedback {
  opacity: 0;
  pointer-events: none;
}

/* Toggle state */
.copy-control.copied .copy-icon {
  opacity: 0;
}

.copy-control.copied .copy-feedback {
  opacity: 1;
}

/* Lucide SVG sizing (same for copy + check) */
.copy-icon svg,
.copy-feedback svg {
  width: 28px;
  height: 28px;

  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;

  vector-effect: non-scaling-stroke;
}

/* Desktop: slightly smaller */
@media (min-width: 641px) {
  .copy-control {
    width: 36px;
    height: 36px;
  }

  .copy-icon svg,
  .copy-feedback svg {
    width: 24px;
    height: 24px;
  }
}

@supports (-webkit-touch-callout: none) {

  .copy-icon svg,
  .copy-feedback svg {
    stroke-width: 3;
  }
}

/* =========================
   Auth Pages
========================= */
main.auth {
  max-width: 420px;
  padding: 24px 16px;
  margin: 0 auto;
}

main.auth h1 {
  font-size: 22px;
  margin-bottom: 16px;
}

.auth-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  color: #666;
}

.auth-switch {
  margin: 0;
}

.auth-switch a {
  font-weight: 600;
  /* bold */
  color: #666;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* keep back home normal */
.auth-home {
  color: #666;
  text-decoration: none;
  font-weight: normal;
}

.auth-home:hover {
  text-decoration: underline;
}

/* =========================
   Example output
========================= */
.example-output {
  margin-top: 0px;
  opacity: 1;
  max-height: 500px;
  overflow: hidden;
  white-space: pre-line;
  transition: opacity 0.6s ease, max-height 1s ease;
}

.example-output.hidden {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
}


.output-toolbar {
  justify-content: flex-start;
  padding-bottom: 6px;
  font-size: 0.85rem;
  color: #777;
  padding-left: 16px;
}

.example-label {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #374151;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0.3px;
  font-weight: 400;
  margin-bottom: 0;
}

/* =========================
   Footer Icons
========================= */

.icon-wrap {
  width: 100%;
  display: inline-flex;
  justify-content: space-between;
  margin-top: 32px;
  background: var(--icon-background);
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-size: 12px;
  text-align: center;
  gap: 8px;
}

.icon-wrap div {
  flex: 1;
}

.icon {
  width: 24px;
  height: 24px;
  stroke: #4a8458;
  fill: none;
  stroke-width: 2.5;
  display: block;
  margin: auto;
  margin-bottom: 12px;
}

/* =========================
   Privacy
========================= */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}


.policy .container {
  text-align: center;
  padding: 12px;
  margin: 12px 0 8px;
  margin-top: 0;
  font-size: 0.9rem;
  /* smaller than app UI */
  line-height: 1.65;
  /* readable, legal-style */
  color: #374151;

  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  text-align: left;
}

.policy h1 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.policy h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1.4rem;
  margin-bottom: 0.3rem;
}

.policy p {
  font-size: 0.88rem;
  margin: 0.4rem 0;
}

.policy .muted {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 1.5rem;
}

.back-btn {
  margin-left: auto;
  font-size: 14px;
  color: #6b7280;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 64px;


}

.back-btn:hover {
  text-decoration: underline;
}