/* Base + thème via variables */
:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --text: #121316;
  --muted: #5a5f69;
  --border: rgba(18, 19, 22, 0.14);
  --shadow: 0 10px 30px rgba(0,0,0,.06);

  --accent: #3a3f46;
  --accent-2: #6b717c;

  --btn: #e7e7ea;
  --btn-text: #111216;

  --code-bg: #f1f2f4;
}

html[data-theme="dark"] {
  --bg: #121316;
  --panel: #191b1f;
  --text: #eef0f5;
  --muted: #a9aeb9;
  --border: rgba(238, 240, 245, 0.16);
  --shadow: 0 10px 30px rgba(0,0,0,.35);

  --accent: #d7dbe3;
  --accent-2: #a4aab4;

  --btn: #2a2d34;
  --btn-text: #eef0f5;

  --code-bg: #0f1013;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.4;
}

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.logo{
  width: 70px;
  height: auto;
  border-radius: 90px;
  display: grid;
  place-items: center;
  display: block;
}
.title { font-weight: 760; letter-spacing: .2px; }
.subtitle { color: var(--muted); font-size: 12.5px; }

.theme {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-label { color: var(--muted); font-size: 13px; }
.theme-select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

.container {
  max-width: 1100px;
  margin: 22px auto;
  padding: 0 20px 26px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
}

@media (max-width: 980px) {
  .container { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 720;
  color: color-mix(in srgb, var(--text) 88%, var(--accent-2));
}

.textarea-wrap textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px;
  background: var(--code-bg);
  color: var(--text);
  outline: none;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.textarea-wrap textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--btn);
  color: var(--btn-text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 650;
  letter-spacing: .2px;
}

.btn:hover { filter: brightness(0.98); }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--text);
}

.control-group {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.checkbox {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  user-select: none;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.help {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.help-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--accent);
}

/* Résultats */
.summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.summary-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.summary-label { color: var(--muted); font-size: 12.5px; }
.summary-value { font-weight: 800; font-size: 18px; margin-top: 4px; }

.results-wrap {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  min-height: 120px;
  overflow: auto;
}

.lines-grid {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px 12px;
  align-items: start;
}

.line-no {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  user-select: none;
}

.line-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--code-bg) 70%, transparent);
}

.line-chars {
  font-weight: 760;
  letter-spacing: .2px;
  color: color-mix(in srgb, var(--text) 92%, var(--accent-2));
  font-size: 13px;
}

.line-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
}

/* Footer */
.footer {
  padding: 16px 20px 24px;
  color: var(--muted);
  font-size: 12.5px;
}
