/* style.css */
/* dev@cadrexa.com */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@300;400;700&family=EB+Garamond:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@300;400&display=swap');

/*  Variables */
:root {
  --bg:          #0d0d0d;
  --surface:     #161616;
  --surface2:    #1e1e1e;
  --border:      rgba(255,255,255,0.07);
  --border2:     rgba(255,255,255,0.13);
  --gold:        #c9a84c;
  --gold-dim:    rgba(201,168,76,0.15);
  --gold-glow:   rgba(201,168,76,0.35);
  --text:        #e8e0d0;
  --text-dim:    rgba(232,224,208,0.35);
  --text-mid:    rgba(232,224,208,0.6);
  --red:         #e05a4e;
  --green:       #6dbf8e;
  --radius:      6px;
  --mono:        'JetBrains Mono', monospace;
  --serif:       'EB Garamond', 'Noto Serif SC', serif;
  --transition:  0.25s cubic-bezier(0.4,0,0.2,1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

/*  Noise overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.6;
}

/*  Scrollbar  */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/*  Typography utilities  */
.mono { font-family: var(--mono); }
.gold { color: var(--gold); }
.dim  { color: var(--text-dim); }
.mid  { color: var(--text-mid); }

/*  Layout  */
.app-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/*  Header  */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
}
.logo-text {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0.08em;
}
.logo-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  font-family: var(--mono);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-switcher {
  display: flex;
  gap: 0;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
}
.lang-switcher button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 5px 10px;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.06em;
}
.lang-switcher button.active {
  background: var(--gold-dim);
  color: var(--gold);
}
.lang-switcher button:hover:not(.active) { color: var(--text); }

/*  Page sections  */
.page { display: none; flex: 1; flex-direction: column; }
.page.active { display: flex; }

/*  Language select page  */
.lang-select-page {
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  text-align: center;
  gap: 40px;
}

.brand-block { display: flex; flex-direction: column; gap: 8px; }

.brand-name {
  font-family: var(--mono);
  font-size: 3rem;
  color: var(--gold);
  letter-spacing: 0.15em;
  font-weight: 300;
}

.brand-tagline {
  font-size: 1rem;
  color: var(--text-mid);
  letter-spacing: 0.08em;
}

.lang-options {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.lang-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 40px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 150px;
}
.lang-card:hover {
  border-color: var(--gold);
  background: var(--gold-dim);
  transform: translateY(-2px);
}
.lang-card .lang-flag { font-size: 2rem; }
.lang-card .lang-name { font-family: var(--mono); font-size: 0.85rem; color: var(--text-mid); }

/*  Home page  */
.home-page { gap: 48px; }

.speed-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.stat-item { display: flex; flex-direction: column; gap: 4px; }
.stat-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.stat-value {
  font-family: var(--mono);
  font-size: 1.6rem;
  color: var(--gold);
  font-weight: 300;
}
.stat-unit {
  font-size: 0.75rem;
  color: var(--text-mid);
}

.menu-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.menu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px 28px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.menu-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--gold-dim) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}
.menu-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.menu-card:hover::after { opacity: 1; }

.menu-card-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.menu-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.menu-card-desc {
  font-size: 0.82rem;
  color: var(--text-mid);
  line-height: 1.5;
}
.menu-card-arrow {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--gold);
  opacity: 0;
  transition: opacity var(--transition);
}
.menu-card:hover .menu-card-arrow { opacity: 1; }

/*  Speed measure page  */
.speed-page { gap: 32px; }

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-title h2 {
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text);
}

.sample-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
}
.sample-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.sample-text {
  font-size: 1.15rem;
  line-height: 1.9;
  color: var(--text);
  user-select: none;
}

.speed-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.timer-display {
  font-family: var(--mono);
  font-size: 2.2rem;
  color: var(--gold);
  font-weight: 300;
  min-width: 100px;
  letter-spacing: 0.05em;
}

.speed-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 28px;
  display: none;
}
.speed-results.visible { display: block; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 16px;
}

.speed-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.history-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 44px;
}
.history-bar {
  flex: 1;
  background: var(--gold);
  opacity: 0.5;
  border-radius: 2px 2px 0 0;
  min-height: 4px;
  transition: opacity var(--transition);
}
.history-bar:hover { opacity: 1; }
.history-bar:last-child { opacity: 1; }

/*  Write page  */
.write-page { gap: 32px; }

.write-input-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.text-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.8;
  min-height: 140px;
  resize: vertical;
  transition: border-color var(--transition);
  width: 100%;
}
.text-input:focus {
  outline: none;
  border-color: var(--gold);
}
.text-input::placeholder { color: var(--text-dim); }

/*  Writing mode display  */
.writing-display { display: none; flex-direction: column; gap: 24px; }
.writing-display.active { display: flex; }

.write-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.write-timer {
  font-family: var(--mono);
  font-size: 1.3rem;
  color: var(--text-mid);
  font-weight: 300;
}
.write-timer span { color: var(--gold); }

.write-controls { display: flex; gap: 8px; }

/* Current highlighted character/word */
.current-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.current-block::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, var(--gold-dim) 0%, transparent 70%);
  pointer-events: none;
}

.current-label {
  position: absolute;
  top: 12px;
  left: 16px;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.current-char {
  font-size: 3.5rem;
  color: var(--gold);
  font-weight: 300;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.05em;
  transition: opacity 0.15s ease;
}

/* Upcoming text */
.upcoming-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 28px;
}
.upcoming-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.upcoming-text {
  font-size: 1.1rem;
  line-height: 2;
  color: var(--text-dim);
  word-break: break-all;
}
.upcoming-text .token {
  display: inline;
  transition: all 0.2s ease;
  border-radius: 3px;
  padding: 0 1px;
}
.upcoming-text .token.soon {
  color: var(--text-mid);
}
.upcoming-text .token.next {
  color: var(--text);
  background: rgba(232,224,208,0.08);
}

/* Progress bar */
.progress-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, #e8c85a 100%);
  border-radius: 2px;
  transition: width 0.5s linear;
  width: 0%;
}

/* Completed overlay */
.completed-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,13,13,0.92);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  text-align: center;
  backdrop-filter: blur(8px);
}
.completed-overlay.active { display: flex; }

.completed-icon {
  font-size: 3rem;
  animation: pop 0.5s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.completed-title {
  font-family: var(--mono);
  font-size: 1.8rem;
  color: var(--gold);
  letter-spacing: 0.12em;
}
.completed-msg { font-size: 1rem; color: var(--text-mid); }

/*  Buttons  */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-gold {
  background: var(--gold);
  color: #0d0d0d;
  border-color: var(--gold);
  font-weight: 600;
}
.btn-gold:hover:not(:disabled) {
  background: #d9b85c;
  box-shadow: 0 0 20px var(--gold-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border-color: var(--border2);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(224,90,78,0.3);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(224,90,78,0.1);
  border-color: var(--red);
}

.btn-sm { padding: 6px 14px; font-size: 0.75rem; }

/*  Divider  */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

/*  Toast  */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 10px 20px;
  border-radius: 20px;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/*  Animations  */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page.active { animation: fadeIn 0.3s ease; }

/*  Footer  */
.site-footer {
  padding: 24px 0;
  margin-top: auto;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  border-top: 1px solid var(--border);
}

/*  Rhythm delay control  */
.delay-control {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.delay-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-mid);
}
.delay-label > span:first-child {
  color: var(--text);
  font-weight: 500;
}
.delay-hint {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.delay-slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.delay-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  background: var(--border2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.delay-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 0 8px var(--gold-glow);
  transition: transform var(--transition);
}
.delay-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.delay-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: none;
}

.delay-value {
  font-size: 0.88rem;
  color: var(--gold);
  min-width: 34px;
  text-align: right;
}

.delay-marks {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  padding: 0 2px;
}

/*  Settings Page  */
.settings-page { gap: 24px; }

.settings-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.settings-group-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 12px 20px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 12px;
}

.settings-row-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.9rem;
  color: var(--text);
}
.settings-row-sub {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Changelog inside settings */
.settings-group-changelog .changelog-body {
  padding: 20px;
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-mid);
  max-height: 420px;
  overflow-y: auto;
}
.settings-group-changelog .changelog-body::-webkit-scrollbar { width: 3px; }
.settings-group-changelog .changelog-body::-webkit-scrollbar-thumb {
  background: var(--border2); border-radius: 2px;
}

.changelog-body h1,
.changelog-body h2,
.changelog-body h3 {
  font-family: var(--mono);
  color: var(--gold);
  font-weight: 400;
  margin: 14px 0 6px;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}
.changelog-body h1 { font-size: 0.95rem; margin-top: 0; }
.changelog-body p  { margin: 5px 0; }
.changelog-body ul,
.changelog-body ol { padding-left: 18px; margin: 6px 0; }
.changelog-body li { margin: 3px 0; }
.changelog-body em { color: var(--text-dim); font-style: normal; }
.changelog-body hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.changelog-body code {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text);
}
.changelog-body a { color: var(--gold); }

.update-loading {
  text-align: center;
  padding: 28px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* NEW badge */
.new-badge {
  background: var(--gold);
  color: #0d0d0d;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.08em;
}

/* Loading dot animation */
.changelog-loading-dot::after {
  content: '…';
  animation: blink 1.2s step-start infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/*  Landscape warning  */
.landscape-warn {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--bg);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding: 24px;
}
.landscape-warn.active { display: flex; }

.landscape-icon {
  font-size: 3rem;
  animation: rotate-hint 2s ease-in-out infinite;
}
@keyframes rotate-hint {
  0%   { transform: rotate(0deg); }
  30%  { transform: rotate(-90deg); }
  70%  { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}
.landscape-text {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text-mid);
  max-width: 260px;
  line-height: 1.6;
}

/*  Responsive  */
@media (max-width: 600px) {
  .menu-cards       { grid-template-columns: 1fr; }
  .speed-summary    { grid-template-columns: 1fr 1fr; }
  .result-grid      { grid-template-columns: 1fr 1fr; }
  .brand-name       { font-size: 2rem; }
  .current-char     { font-size: 2.5rem; }
  .lang-options     { flex-direction: column; align-items: center; }
  .speed-controls   { flex-direction: column; align-items: flex-start; }
}

/*  Stats Page  */
.stats-page { gap: 28px; }

.stats-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 600px) { .stats-metrics { grid-template-columns: 1fr 1fr; } }

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.metric-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.metric-value {
  font-size: 1.5rem;
  color: var(--gold);
  font-weight: 300;
}
.metric-unit {
  font-size: 0.72rem;
  color: var(--text-mid);
}

/* Chart */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 20px 12px;
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.chart-title {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-mid);
  letter-spacing: 0.08em;
}
.chart-legend {
  display: flex;
  gap: 16px;
  align-items: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}
.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.legend-line {
  width: 18px; height: 2px;
  background: repeating-linear-gradient(
    90deg, rgba(201,168,76,0.4) 0, rgba(201,168,76,0.4) 4px,
    transparent 4px, transparent 8px
  );
}

.speed-chart {
  display: block;
  width: 100%;
  border-radius: 4px;
}

.no-data-msg {
  text-align: center;
  padding: 40px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Stability section */
.stability-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stability-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-mid);
  letter-spacing: 0.08em;
}
.stability-score-val {
  font-size: 1.4rem;
  font-weight: 300;
}
.stability-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.stability-bar-fill {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: width 1s cubic-bezier(0.22,1,0.36,1);
}
.stability-desc {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-mid);
}

/*  Adaptive pace indicator  */
.pace-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
}
.pace-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}
.pace-value {
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.4s ease;
}

/* Focus mode */
body.focus-mode {
  background: #000;
}
body.focus-mode .site-header,
body.focus-mode .site-footer,
body.focus-mode .write-page > .page-title,
body.focus-mode #write-input-area,
body.focus-mode #upcoming-block,
body.focus-mode .progress-track,
body.focus-mode .write-header .write-timer,
body.focus-mode .write-header .pace-indicator {
  display: none !important;
}

body.focus-mode #write-header {
  justify-content: flex-end;
  padding: 16px;
  position: fixed;
  top: 0; left: 0; right: 0;
  background: transparent;
  border: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.4s ease;
}
body.focus-mode #write-header:hover { opacity: 1; }

body.focus-mode #writing-display {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  gap: 0;
}

body.focus-mode #current-block {
  border: none;
  background: transparent;
  width: 100%;
  height: 100vh;
  border-radius: 0;
  padding: 0;
}
body.focus-mode #current-block::before { display: none; }

body.focus-mode #current-char {
  font-size: clamp(5rem, 20vw, 12rem);
  color: #fff;
}

body.focus-mode #current-label { display: none; }

.focus-exit-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: rgba(255,255,255,0.2);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  white-space: nowrap;
}

/*  Warn bar  */
.warn-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--gold);
}
.warn-icon { font-size: 1rem; }
/*  Speed Sharing (Settings)  */
.settings-group-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-family: var(--mono);
  line-height: 1.6;
  margin-bottom: 14px;
}

.settings-group-sublabel {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Export section: sits inside a .settings-row so gets 16px 20px padding */
.share-export-section,
.share-import-section {
  display: block;
  padding: 16px 20px;
}

.share-import-section {
  border-top: 1px solid var(--border);
}

/* Full-width column inside the row */
.share-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.share-code-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.share-code-input {
  flex: 1;
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--transition);
  letter-spacing: 0.03em;
}

.share-code-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-dim);
}

.share-code-input::placeholder {
  color: var(--text-dim);
}

.share-import-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

/* Auto language note (lang select page) */
.auto-lang-note {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/*  Lang card selected state  */
.lang-card.selected {
  border-color: var(--gold);
  background: var(--gold-dim);
}