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

:root {
  --bg: #f0fdf4;
  --surface: #ffffff;
  --surface2: #f0fdf4;
  --border: #bbf7d0;
  --accent: #059669;
  --accent2: #047857;
  --accent-light: #ecfdf5;
  --text: #14532d;
  --muted: #6ee7b7;
  --label: #065f46;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

header { background: var(--accent); color: white; padding: 14px 20px; }
.header-inner { max-width: 860px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.logo { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.logo span { opacity: .7; }
header p { font-size: 13px; opacity: .85; }

.container { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }

/* TOOL TABS */
.tool-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tool-tab { padding: 7px 14px; border-radius: 20px; border: 1.5px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--label); transition: all .15s; }
.tool-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.tool-tab:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

/* MAIN EDITOR */
.editor-wrap { display: grid; grid-template-columns: 1fr 240px; gap: 16px; }
@media (max-width: 640px) { .editor-wrap { grid-template-columns: 1fr; } }

textarea#main-input {
  width: 100%; min-height: 280px; padding: 14px; border: 1.5px solid var(--border);
  border-radius: 14px; font-size: 15px; line-height: 1.6; resize: vertical;
  background: var(--surface); outline: none; font-family: inherit; color: var(--text);
}
textarea#main-input:focus { border-color: var(--accent); }

/* STATS PANEL */
.stats-panel { display: flex; flex-direction: column; gap: 8px; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat-box-label { font-size: 11px; font-weight: 700; color: var(--label); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.stat-box-value { font-size: 22px; font-weight: 800; color: var(--accent); }
.stat-box-sub { font-size: 11px; color: #6ee7b7; margin-top: 1px; }

/* TOOLBAR */
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tool-btn { padding: 7px 13px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--label); }
.tool-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.tool-btn.danger:hover { background: #dc2626; border-color: #dc2626; color: white; }

/* CASE TOOL */
.case-tool { display: none; }
.case-tool.active { display: block; }

/* OUTPUT */
.output-box { background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px; padding: 14px; min-height: 120px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.copy-bar { display: flex; justify-content: flex-end; margin-top: 8px; }
.copy-btn { padding: 7px 14px; border-radius: 8px; border: 1.5px solid var(--border); background: none; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--label); }
.copy-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* KEYWORD DENSITY */
.keyword-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.keyword-table th { background: var(--accent); color: white; padding: 8px 10px; text-align: left; font-size: 12px; }
.keyword-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.keyword-table tr:nth-child(even) td { background: var(--accent-light); }
.bar { height: 6px; background: var(--border); border-radius: 3px; margin-top: 3px; }
.bar-fill { height: 6px; background: var(--accent); border-radius: 3px; }

/* SEO */
.seo { margin-top: 32px; }
.seo h2 { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.seo h3 { font-size: 14px; font-weight: 700; margin: 14px 0 6px; color: var(--label); }
.seo p, .seo li { font-size: 14px; color: #065f46; line-height: 1.7; }
.seo ul, .seo ol { padding-left: 20px; margin-bottom: 10px; }
details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
summary { font-weight: 700; font-size: 14px; cursor: pointer; }
details p { font-size: 13px; color: #065f46; margin-top: 8px; line-height: 1.6; }
footer { text-align: center; padding: 20px; font-size: 12px; color: var(--muted); }
footer a { color: var(--accent); text-decoration: none; }
