/* TextHandwriting.app - Main Stylesheet (Green Theme) */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --page-bg:        #eef2ed;
  --white:          #ffffff;
  --card-bg:        #ffffff;
  --border:         #d6ddd5;
  --border-dk:      #b8c2b6;
  --text-main:      #1a221d;
  --text-muted:     #56635a;
  --text-soft:      #8a9489;
  --green:          #115c36;
  --green-dk:       #0d4a2c;
  --green-md:       #1a7d4a;
  --green-bright:   #18c76f;
  --green-brighthv: #14b362;
  --green-lt:       #d6f0e0;
  --green-soft:     #e8f2ec;
  --accent:         #18c76f;
  --accent-hv:      #14b362;
  --red:            #c43838;
  --amber:          #c08a1a;
  --surface:        #f4f7f4;
  --active-bg:      #e0ede4;
  --radius:         10px;
  --radius-sm:      7px;
  --shadow:         0 1px 3px rgba(15,40,25,0.10), 0 1px 2px rgba(15,40,25,0.05);
  --shadow-md:      0 4px 14px rgba(15,40,25,0.10), 0 2px 4px rgba(15,40,25,0.05);
  --shadow-lg:      0 8px 36px rgba(15,40,25,0.12), 0 2px 8px rgba(15,40,25,0.06);
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--page-bg);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.55;
}

img { max-width: 100%; display: block; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========================
   HEADER
======================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hdr-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 22px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-pen {
  font-size: 22px;
  color: var(--green);
  line-height: 1;
}
.logo-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}
.logo-dot { color: var(--green); }
.logo-sm .logo-text { font-size: 15px; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.main-nav a {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.main-nav a:hover,
.main-nav a.active { background: var(--green-soft); color: var(--green); }

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

.btn-ghost {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--green);
  border: 1.5px solid var(--green);
  background: transparent;
  text-decoration: none;
  transition: background 0.12s;
  white-space: nowrap;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--green-soft); text-decoration: none; }

.btn-primary {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  background: var(--green);
  color: #fff;
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--green-dk); text-decoration: none; color: #fff; }

.btn-accent {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}
.btn-accent:hover { background: var(--accent-hv); color: #fff; text-decoration: none; }
.btn-green { /* alias */
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}
.btn-green:hover { background: var(--accent-hv); text-decoration: none; color: #fff; }

/* Profile avatar in header */
.profile-trigger {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  max-width: 36px;
  max-height: 36px;
  flex-shrink: 0;
  align-self: center;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--green-soft);
  cursor: pointer;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.12s;
  padding: 0;
  position: relative;
  /* Safari border-radius + overflow fix */
  isolation: isolate;
}
.profile-trigger:hover { border-color: var(--green); }
.profile-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
.profile-trigger .initial {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1;
}

.profile-dropdown {
  position: fixed;
  top: 64px;
  right: 22px;
  width: 240px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 8px 0;
  display: none;
  z-index: 300;
}
.profile-dropdown.open { display: block; }
.profile-dropdown .pd-head {
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.profile-dropdown .pd-head .pd-name { font-size: 13.5px; font-weight: 600; color: var(--text-main); }
.profile-dropdown .pd-head .pd-email { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; word-break: break-all; line-height: 1.45; }
.profile-dropdown a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-main);
  text-decoration: none;
  transition: background 0.1s;
}
.profile-dropdown a:hover { background: var(--surface); text-decoration: none; }
.profile-dropdown a.danger { color: var(--red); }

.nav-burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}
.nav-burger span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
}

.mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px 12px;
}
.mobile-nav a {
  padding: 10px 4px;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav.open { display: flex; }

/* ========================
   FOOTER
======================== */
.site-footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  margin-top: 60px;
}
.ft-top {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 22px 32px;
  display: grid;
  grid-template-columns: 1.8fr 2fr;
  gap: 48px;
}
.ft-brand p {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 360px;
}
.ft-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.ft-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ft-col strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.ft-col a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}
.ft-col a:hover { color: var(--green); text-decoration: underline; }
.ft-bottom {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-soft);
  flex-wrap: wrap;
  gap: 6px;
}

/* ========================
   HOME / BELOW-TOOL CONTENT
======================== */
.section { padding: 56px 20px; }
.section-inner { max-width: 1240px; margin: 0 auto; }

.bottom-hero {
  background: linear-gradient(135deg, #115c36 0%, #0a3f23 100%);
  color: #fff;
  padding: 64px 22px 72px;
  text-align: center;
  margin-top: 0;
  position: relative;
  overflow: hidden;
}
.bottom-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 30%, rgba(24,199,111,0.15), transparent 38%),
    radial-gradient(circle at 82% 70%, rgba(24,199,111,0.10), transparent 42%);
  pointer-events: none;
}
.bottom-hero > * { position: relative; }
.bottom-hero h2 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.6px;
  line-height: 1.18;
  max-width: 720px;
  margin: 0 auto 14px;
}
.bottom-hero p {
  font-size: 17px;
  opacity: 0.92;
  max-width: 580px;
  margin: 0 auto 28px;
  line-height: 1.7;
  font-weight: 300;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-btn-bright {
  padding: 13px 28px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  background: var(--green-bright);
  color: #fff;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(24,199,111,0.32);
}
.hero-btn-bright:hover {
  background: var(--green-brighthv);
  text-decoration: none;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(24,199,111,0.42);
}
.hero-btn-outline {
  padding: 13px 28px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  border: 2px solid rgba(255,255,255,0.55);
  color: #fff;
  background: transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.hero-btn-outline:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.85);
  text-decoration: none;
  color: #fff;
}

.section-heading {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}
.section-sub {
  font-size: 14.5px;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.tool-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-decoration: none;
  color: var(--text-main);
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  display: block;
}
.tool-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--green);
  text-decoration: none;
  color: var(--text-main);
}
.tool-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}
.tool-icon.green { background: var(--green-lt); color: var(--green); }
.tool-icon.sage  { background: #d5e7d8; color: #2d6a3e; }
.tool-icon.olive { background: #e3e8c8; color: #5a6a2a; }
.tool-icon.amber { background: #f0e5c8; color: #8a6a18; }

.tool-card h3 {
  font-size: 15.5px;
  font-weight: 600;
  margin-bottom: 6px;
}
.tool-card p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}
.tool-badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--green-lt);
  color: var(--green);
  letter-spacing: 0.3px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.feature-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
}
.feature-card h4 {
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}
.feature-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}

.faq-list { display: flex; flex-direction: column; gap: 10px; max-width: 780px; margin: 0 auto; }
.faq-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.faq-q {
  padding: 16px 20px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.faq-q .arr { color: var(--text-muted); font-size: 12px; transition: transform 0.2s; }
.faq-item.open .faq-q .arr { transform: rotate(180deg); }
.faq-a {
  display: none;
  padding: 0 20px 16px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.75;
}
.faq-item.open .faq-a { display: block; }

/* ========================
   TOOL PAGE LAYOUT
======================== */
.tool-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 18px 0;
}
.tool-bar {
  padding: 8px 0 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tool-bar h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
  flex: 1;
  color: var(--text-main);
}
.tool-bar .tbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tool-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

/* sidebar controls */
.ctrl-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}
.ctrl-panel::-webkit-scrollbar { width: 4px; }
.ctrl-panel::-webkit-scrollbar-thumb { background: var(--border-dk); border-radius: 2px; }

.ctrl-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 8px;
  display: block;
}

textarea.tool-textarea {
  width: 100%;
  height: 120px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-main);
  background: var(--surface);
  resize: none;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
textarea.tool-textarea:focus { border-color: var(--green); background: #fff; }
textarea.tool-textarea::placeholder { color: var(--text-soft); }

.font-list { display: flex; flex-direction: column; gap: 5px; }
.font-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.12s, background 0.12s;
}
.font-row:hover { border-color: var(--green); background: var(--green-soft); }
.font-row.on { border-color: var(--green); background: var(--green-soft); }
.font-row .fr-preview {
  font-size: 18px;
  line-height: 1.1;
  color: var(--text-main);
  width: 100px;
  flex-shrink: 0;
}
.font-row .fr-meta { flex: 1; }
.font-row .fr-name { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.font-row .fr-desc { font-size: 10px; color: var(--text-soft); }
.font-row .fr-check {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--border-dk);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.font-row.on .fr-check { background: var(--green); border-color: var(--green); }
.font-row.on .fr-check::after { content: ''; width: 5px; height: 5px; background: #fff; border-radius: 50%; }

.paper-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.p-tile {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
}
.p-tile:hover { border-color: var(--green); }
.p-tile.on { border-color: var(--green); }
.p-tile input { display: none; }
.p-thumb { display: block; width: 100%; height: 52px; }
.p-name {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 4px 5px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  letter-spacing: 0.2px;
}
.p-tile.on .p-name { color: var(--green); background: var(--green-soft); }

.ink-row { display: flex; gap: 7px; flex-wrap: wrap; }
.ink-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform 0.1s, border-color 0.12s;
}
.ink-dot:hover { transform: scale(1.15); }
.ink-dot.on { border-color: var(--green); }

.sliders { display: flex; flex-direction: column; gap: 12px; }
.sl-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}
.sl-top span { font-size: 12px; color: var(--text-muted); }
.sl-top .slv { font-size: 12px; color: var(--green); font-weight: 600; font-variant-numeric: tabular-nums; }
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
}

.canvas-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.canvas-actions { display: flex; gap: 8px; width: 100%; justify-content: flex-end; flex-wrap: wrap; }
.paper-frame {
  box-shadow: 0 4px 20px rgba(15,40,25,0.16), 0 1px 4px rgba(15,40,25,0.08);
  border-radius: 2px;
  max-width: 100%;
}
#paperCanvas, #cv {
  display: block;
  max-width: 100%;
  border-radius: 2px;
}
.page-counter {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-counter button {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, border-color 0.12s;
}
.page-counter button:hover:not(:disabled) { background: var(--green-soft); border-color: var(--green); }
.page-counter button:disabled { opacity: 0.4; cursor: default; }

/* ========================
   ABOUT / PROFILE
======================== */
.about-wrap {
  max-width: 820px;
  margin: 40px auto;
  padding: 0 22px;
}
.about-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.about-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.2px;
}
.about-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 22px 0 8px;
  color: var(--text-main);
}
.about-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 10px;
}
.about-card ul {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.about-card ul li {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* profile-specific */
.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--green-soft);
  border: 3px solid var(--white);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar .initial { font-size: 30px; font-weight: 700; color: var(--green); }
.profile-info h2 { font-size: 22px; margin-bottom: 4px; }
.profile-info .em { font-size: 13px; color: var(--text-muted); }

/* ========================
   LOGIN / SIGNUP
======================== */
.auth-wrap {
  min-height: calc(100vh - 58px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 60px;
}
.auth-box {
  width: 100%;
  max-width: 440px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 20px;
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  box-shadow: var(--shadow-md);
}
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
}
.auth-tab.on { color: var(--green); border-bottom-color: var(--green); }
.auth-panel { display: none; }
.auth-panel.on { display: block; }
.auth-panel h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.auth-panel .sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.form-field { margin-bottom: 14px; }
.form-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 5px;
}
.form-field input {
  width: 100%;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.form-field input:focus { border-color: var(--green); background: #fff; }
.form-field .hint { font-size: 11.5px; color: var(--text-soft); margin-top: 3px; }
.form-submit {
  width: 100%;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.12s;
}
.form-submit:hover { background: var(--green-dk); }
.form-or {
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
  margin: 14px 0;
  position: relative;
}
.form-or::before, .form-or::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--border);
}
.form-or::before { left: 0; }
.form-or::after  { right: 0; }
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.alert-err { background: #fdeaea; color: var(--red); border: 1px solid #f5c0c0; }
.alert-ok  { background: var(--green-soft); color: var(--green-dk); border: 1px solid var(--green-lt); }

/* ========================
   HANDWRITING TO TEXT
======================== */
.h2t-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.h2t-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.h2t-panel h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-main);
}
.drop-zone {
  border: 2px dashed var(--border-dk);
  border-radius: var(--radius-sm);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--green);
  background: var(--green-soft);
}
.drop-zone p { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.drop-icon { font-size: 32px; }
.dz-result {
  margin-top: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
#dzPreview { width: 100%; max-height: 240px; object-fit: contain; background: var(--surface); }
textarea.result-text {
  width: 100%;
  height: 280px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-main);
  resize: none;
  outline: none;
  background: var(--surface);
}
textarea.result-text:focus { border-color: var(--green); background: #fff; }
.ocr-loading {
  display: none;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* practice */
.guide-line-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.guide-opt {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
}
.guide-opt:hover, .guide-opt.on {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

@media (max-width: 980px) {
  .main-nav { display: none; }
  .nav-burger { display: flex; }
  .hdr-right .btn-ghost, .hdr-right .btn-primary { display: none; }
  .tool-layout { grid-template-columns: 1fr; }
  .ctrl-panel { position: static; max-height: none; }
  .h2t-layout { grid-template-columns: 1fr; }
  .ft-top { grid-template-columns: 1fr; gap: 28px; }
  .ft-links { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .bottom-hero h2 { font-size: 26px; }
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .ft-links { grid-template-columns: 1fr; }
  .about-card { padding: 22px 18px; }
}
