﻿* { margin: 0; padding: 0; box-sizing: border-box; }
:root { --transition: 0.35s ease; }

[data-theme="dark"] {
  --bg: #1a1917;
  --surface: #23221f;
  --border: #33312c;
  --text: #e8e4dc;
  --muted: #8a857b;
  --accent: #9b6fd4;
  --hover: #2a2926;
  --scroll-thumb: #3d3a34;
  --track: #2e2c28;
  --overflow: #c0403a;
  --overflow-bg: color-mix(in srgb, #c0403a 12%, transparent);
  --ok: #4a9b6f;
}

[data-theme="light"] {
  --bg: #f4f1eb;
  --surface: #ece8e0;
  --border: #d4cfc6;
  --text: #1a1a1a;
  --muted: #7a756d;
  --accent: #7c4dba;
  --hover: #e4e0d7;
  --scroll-thumb: #c4bfb6;
  --track: #dedad2;
  --overflow: #b03530;
  --overflow-bg: color-mix(in srgb, #b03530 10%, transparent);
  --ok: #3a8a5f;
}

body {
  font-family: 'DM Mono', monospace;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--text); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

code {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  background: var(--hover);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--muted);
}



.page {
  /* Eyeballed this width; feels better than a strict grid here. */
  height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 32px;
  overflow: hidden;
}


nav {
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--transition);
  gap: 16px;
}

.logo { font-weight: 500; font-size: 14px; letter-spacing: -0.3px; flex-shrink: 0; cursor: pointer; }
.logo span { color: var(--accent); }

.nav-right { display: flex; align-items: center; gap: 12px; min-width: 0; }

.tool-tabs {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tool-tabs::-webkit-scrollbar { display: none; }

.tab {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab:hover { color: var(--text); border-color: var(--border); }
.tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.theme-toggle {
  width: 28px; height: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }


.hamburger {
  display: none;
  width: 28px; height: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hamburger:hover { color: var(--text); border-color: var(--muted); }
.hamburger.open { color: var(--accent); border-color: var(--accent); }

.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease, border-color var(--transition);
}
.mobile-menu.open { max-height: 600px; }

.mob-tool-item {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.mob-tool-item:last-child { border-bottom: none; }
.mob-tool-item:hover { color: var(--accent); background: var(--hover); }
.mob-tool-item.active { color: var(--accent); }


.main {
  flex: 1;
  min-height: 0;
  padding: 24px 0;
  overflow: hidden;
}



.tool-view {
  display: none;
  height: 100%;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  min-width: 0;
}
.tool-view.active { display: grid; }


.tool-view > * { min-width: 0; }


.home-view { align-items: center; }

.home-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 2px;
}

.info-card {  }

.info-card ul {
  list-style: none;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.85;
}
.info-card ul li::before { content: "-> "; color: var(--accent); }

.home-tools-wrap {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 6px;
  min-height: 0;
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}
.home-tools-wrap::-webkit-scrollbar { width: 3px; }
/* Tiny scrollbar on purpose; we don't want it stealing attention. */
.home-tools-wrap::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }

.home-tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
  flex-shrink: 0;
}
.home-tool-card:hover { border-color: var(--accent); }
.home-tool-card.hidden { display: none; }
.home-tool-card h3 { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.home-tool-card p { color: var(--muted); font-size: 11px; line-height: 1.45; }
.card-arrow { color: var(--muted); font-size: 14px; transition: color 0.2s; flex-shrink: 0; }
.home-tool-card:hover .card-arrow { color: var(--accent); }

.tags { margin-top: 6px; }
.tag {
  display: inline-block;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 3px;
  transition: border-color var(--transition);
}


.home-view .right {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}


.left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}
.left::-webkit-scrollbar { width: 3px; }
.left::-webkit-scrollbar-track { background: transparent; }
.left::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }

.tool-header h1 {
  font-family: 'Newsreader', serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.tool-header h1 em { font-style: italic; color: var(--accent); }
.tool-header p { color: var(--muted); font-size: 11px; line-height: 1.7; }


.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 14px 16px;
  transition: border-color var(--transition), background var(--transition);
}

.section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  margin-bottom: 10px;
}


.controls { display: flex; flex-direction: column; gap: 14px; }
.control-row { display: flex; flex-direction: column; gap: 6px; }
.control-top { display: flex; justify-content: space-between; align-items: center; }
.control-label { font-size: 11px; color: var(--muted); }
.control-val { font-size: 10px; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--track);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  background: var(--accent);
  border-radius: 50%;
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.3); }
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  background: var(--accent);
  border: none; border-radius: 50%;
}


.palette-grid { display: flex; flex-wrap: wrap; gap: 5px; }

.palette-pill {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 3px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.3px;
}
.palette-pill:hover { border-color: var(--muted); color: var(--text); }
.palette-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}


.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.toggle-wrap { position: relative; flex-shrink: 0; }
.toggle-wrap input { opacity: 0; position: absolute; width: 0; height: 0; }

.toggle-track {
  display: block;
  width: 32px; height: 16px;
  background: var(--track);
  border-radius: 8px;
  position: relative;
  transition: background 0.2s;
  cursor: pointer;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-wrap input:checked + .toggle-track { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.toggle-wrap input:checked + .toggle-track::after { transform: translateX(16px); background: var(--accent); }


.action-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 8px;
}
.btn-reset, .btn-export {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.btn-reset {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-reset:hover { border-color: var(--muted); color: var(--text); }
.btn-export {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid var(--accent);
  color: var(--accent);
}
.btn-export:hover { background: color-mix(in srgb, var(--accent) 25%, transparent); }

.hint { font-size: 10px; color: var(--muted); opacity: 0.7; line-height: 1.7; }



.right {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}


.input-area {
  flex: 1;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  line-height: 1.65;
  padding: 16px;
  resize: none;
  outline: none;
  transition: border-color 0.2s, background var(--transition);
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
  min-height: 0;
}
.input-area::-webkit-scrollbar { width: 3px; }
.input-area::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }
.input-area:focus { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.input-area::placeholder { color: var(--muted); opacity: 0.6; }
.input-area[readonly] { cursor: default; }
.input-area[readonly]:focus { border-color: var(--border); }


.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat-item { display: flex; flex-direction: column; gap: 1px; }
.stat-item.wide { grid-column: span 2; flex-direction: row; justify-content: space-between; align-items: baseline; }
.stat-val { font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.2; color: var(--text); }
.stat-lbl { font-size: 10px; color: var(--muted); }
.stat-item.wide .stat-val { font-size: 14px; }

.readability-list { display: flex; flex-direction: column; gap: 6px; }
.read-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.read-name { color: var(--muted); flex: 1; }
.read-val { color: var(--text); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.overflow-val { color: var(--overflow); }
.read-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--muted);
  flex-shrink: 0;
  min-width: 52px;
  text-align: center;
}
.read-badge.easy { color: var(--ok); border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.read-badge.hard { color: var(--overflow); border-color: var(--overflow); background: var(--overflow-bg); }
.read-badge.mid { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }


.two-pane {
  display: flex;
  flex-direction: column;
}
.two-pane .half { flex: 1; min-height: 0; border-radius: 0; }
.two-pane .half:first-child { border-radius: 5px 5px 0 0; border-bottom: none; }
.two-pane .half:last-child { border-radius: 0 0 5px 5px; border-top: none; }

.pane-divider {
  background: var(--hover);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 4px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.swap-btn {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  padding: 0 8px;
  transition: all 0.2s;
  line-height: 1.6;
}
.swap-btn:hover { color: var(--accent); border-color: var(--accent); }

.divider-label { font-size: 10px; color: var(--muted); letter-spacing: 0.8px; }


.freq-right {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.freq-input {
  flex: 0 0 auto;
  height: 35%;
  min-height: 80px;
  max-height: 35%;
  border-radius: 5px 5px 0 0;
  border-bottom: none;
}
.freq-table-wrap {
  flex: 1;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 5px 5px;
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}
.freq-table-wrap::-webkit-scrollbar { width: 3px; }
.freq-table-wrap::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }

.canvas-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--muted);
  pointer-events: none;
}

.freq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.freq-table th {
  position: sticky;
  top: 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-align: left;
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
}
.freq-table td {
  padding: 6px 16px;
  color: var(--text);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  vertical-align: middle;
}
.freq-table tr:last-child td { border-bottom: none; }
.freq-table tr:hover td { background: var(--hover); }
.freq-num { color: var(--muted); font-size: 10px; }
.freq-bar-cell { width: 80px; }
.freq-bar-wrap { height: 3px; background: var(--track); border-radius: 2px; overflow: hidden; }
.freq-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }


.dialogue-right {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.dlg-input {
  flex: 0 0 auto;
  height: 40%;
  max-height: 40%;
  min-height: 80px;
  border-radius: 5px 5px 0 0;
  border-bottom: none;
}
.dialogue-table-wrap {
  flex: 1;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 5px 5px;
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}
.dialogue-table-wrap::-webkit-scrollbar { width: 3px; }
.dialogue-table-wrap::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }
.dialogue-table { width: 100%; }


.unicode-right {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.uni-input {
  flex: 0 0 auto;
  height: 38%;
  max-height: 38%;
  min-height: 80px;
  border-radius: 5px 5px 0 0;
  border-bottom: none;
}
.unicode-display {
  flex: 1;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 5px 5px;
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 2;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
  word-break: break-all;
}
.unicode-display::-webkit-scrollbar { width: 3px; }
.unicode-display::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }

.emoji-hl   { background: color-mix(in srgb, #e0a020 25%, transparent); border-radius: 3px; padding: 1px 2px; }
.symbol-hl  { background: color-mix(in srgb, var(--accent) 25%, transparent); border-radius: 3px; padding: 1px 2px; }
.zw-hl      { background: var(--overflow-bg); border: 1px solid var(--overflow); border-radius: 3px; padding: 1px 4px; font-size: 10px; color: var(--overflow); }
.nonascii-hl { background: color-mix(in srgb, #20a0c0 20%, transparent); border-radius: 3px; padding: 1px 2px; }

.legend-grid {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 4px 8px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  display: inline-block;
}


.subtitle-right {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.sub-input {
  flex: 0 0 auto;
  height: 40%;
  max-height: 40%;
  min-height: 80px;
  border-radius: 5px 5px 0 0;
  border-bottom: none;
}
.sub-results {
  flex: 1;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 5px 5px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}
.sub-results::-webkit-scrollbar { width: 3px; }
.sub-results::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }

.sub-line {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 6px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  font-size: 11px;
  
  overflow: hidden;
  min-width: 0;
}
.sub-line:last-child { border-bottom: none; }
.sub-line:hover { background: var(--hover); }
.sub-line.overflow { background: var(--overflow-bg); }
.sub-line.overflow .sub-text { color: var(--overflow); }
.sub-idx { color: var(--muted); font-size: 10px; min-width: 28px; flex-shrink: 0; }

.sub-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sub-meta {
  color: var(--muted);
  font-size: 10px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}
.sub-meta .flag { color: var(--overflow); font-size: 10px; }

/* Diff checker is intentionally plain and dense: easier scanning over fancy chrome. */
.diff-right {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.diff-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 0 0 auto;
  height: 30%;
  min-height: 120px;
}
.diff-input {
  flex: none;
  height: 100%;
  min-height: 0;
}

.diff-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  flex: 0 0 auto;
}

.diff-results {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.diff-pane {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.diff-pane-head {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.diff-pane-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  font-size: 11px;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}
.diff-pane-body::-webkit-scrollbar { width: 3px; }
.diff-pane-body::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }

.diff-line {
  display: grid;
  grid-template-columns: 42px 1fr;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
  min-height: 22px;
}
.diff-line:last-child { border-bottom: none; }

.diff-line-num {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
  padding: 2px 8px 2px 2px;
  border-right: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  user-select: none;
}

.diff-line-txt {
  padding: 2px 8px;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-line.blank .diff-line-txt { color: color-mix(in srgb, var(--muted) 70%, transparent); }

.diff-add,
.diff-add-line {
  background: color-mix(in srgb, var(--ok) 20%, transparent);
  color: var(--ok);
  border-radius: 3px;
}

.diff-del,
.diff-del-line {
  background: var(--overflow-bg);
  color: var(--overflow);
  border-radius: 3px;
}


footer {
  padding: 14px 0;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color var(--transition);
  position: relative;
}
.footer-links {
  display: flex;
  gap: 16px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.footer-links a { color: var(--muted); font-size: 11px; }
.footer-links a:hover { color: var(--accent); }
.clock { font-variant-numeric: tabular-nums; }


@media (max-width: 768px) {
  body { overflow: auto; height: auto; }
  
  .page {
    height: auto;
    min-height: 100vh;
    padding: 0 20px;
    overflow: visible;
  }
  .main { flex: none; padding: 20px 0; overflow: visible; height: auto; }

  .tool-tabs { display: none; }
  .hamburger { display: flex; }
  .mobile-menu { display: flex; }

  .tool-view.active {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    height: auto;
  }
  .tool-view > * { min-width: 0; }

  .home-view.active { align-items: start; }
  .home-view .right { height: auto; }
  .home-tools-wrap { height: auto; max-height: none; overflow: visible; }
  .home-cards { grid-template-columns: 1fr; }

  .left { overflow: visible; padding-right: 0; }
  .right { height: auto; }

  
  .two-pane .half { flex: none; height: 180px; }

  
  .freq-right, .dialogue-right, .unicode-right, .diff-right { height: auto; }
  .freq-input, .dlg-input, .uni-input { flex: none; height: 180px; }
  .freq-table-wrap, .dialogue-table-wrap, .unicode-display { flex: none; max-height: 260px; position: static; }

  .diff-inputs { grid-template-columns: 1fr; height: auto; }
  .diff-input { height: 150px; }
  .diff-results { grid-template-columns: 1fr; flex: none; max-height: 360px; }

  
  .subtitle-right { height: auto; overflow: visible; }
  .sub-input { flex: none; height: 160px; }
  .sub-results { flex: none; max-height: 260px; position: static; overflow-y: auto; }

  
  .input-area { height: 220px; flex: none; }

  .tool-header h1 { font-size: 22px; }

  .footer-links { position: static; transform: none; }
  footer { flex-direction: column; gap: 10px; text-align: center; }
}


.upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 18px 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  word-break: break-all;
  overflow-wrap: anywhere;
  min-width: 0;
}
.upload-zone:hover { border-color: var(--accent); color: var(--accent); }
.upload-zone.has-file { border-color: var(--accent); color: var(--text); }
.upload-zone input { display: none; }

.control-row.dimmed { opacity: 0.3; pointer-events: none; }

.canvas-wrap {
  flex: 1;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: none;
  border-radius: 3px;
}
canvas.visible { display: block; }
.canvas-wrap.drag-over { border-color: var(--accent); }

#bg-wrap {
  background-image:
    linear-gradient(45deg, color-mix(in srgb, var(--hover) 70%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--hover) 70%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--hover) 70%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--hover) 70%, transparent) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

#bg-canvas { cursor: crosshair; touch-action: none; }

@media (max-width: 768px) {
  .canvas-wrap { height: 55vw; min-height: 200px; }
}



