:root {
  color-scheme: light;
  --paper: #f7f8f6;
  --surface: #ffffff;
  --ink: #17211f;
  --muted: #78817e;
  --line: #e3e8e5;
  --soft: #eef3f0;
  --accent: #2b6d5a;
  --accent-light: #dfece6;
  --warm: #f0b46d;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.app-shell {
  display: flex;
  width: 100%;
  height: 100dvh;
  min-height: 540px;
  flex-direction: column;
  padding: 0 5vw;
}

.topbar,
.site-footer {
  flex: 0 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #c7d7d0;
  border-radius: 8px;
  background: var(--accent-light);
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 13px;
  font-style: italic;
  font-weight: 700;
}

.privacy-note,
.site-footer {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.01em;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #55a783;
  box-shadow: 0 0 0 3px #e0f0e8;
}

.workspace {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  grid-template-columns: minmax(250px, 0.74fr) minmax(420px, 1.7fr);
  gap: clamp(36px, 7vw, 120px);
  padding: clamp(34px, 7vh, 80px) clamp(16px, 4vw, 64px) clamp(28px, 5vh, 58px);
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #18221f;
  font-size: clamp(36px, 4.5vw, 58px);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.97;
}

h1 em {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.stats {
  max-width: 390px;
  margin-top: clamp(34px, 7vh, 72px);
}

.stat {
  min-width: 0;
}

.count-panel {
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.count-panel:hover {
  background: var(--soft);
}

.count-panel.is-selected {
  background: var(--accent-light);
  box-shadow: inset 0 0 0 1px #c7d7d0;
}

.count-panel:focus-visible {
  outline: 2px solid rgba(43, 109, 90, 0.35);
  outline-offset: 2px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.stat-detail {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

.primary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.primary-stat {
  min-width: 0;
  padding: 0 18px 17px 0;
  overflow: hidden;
}

.primary-stat + .primary-stat {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.space-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  cursor: pointer;
  font-size: 8px;
  white-space: nowrap;
}

.toggle-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 21px;
  height: 12px;
  border-radius: 99px;
  background: #cbd4d0;
  transition: background 150ms ease;
}

.toggle::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 150ms ease;
}

.toggle-label input:checked + .toggle {
  background: var(--accent);
}

.toggle-label input:checked + .toggle::after {
  transform: translateX(9px);
}

.toggle-label input:focus-visible + .toggle {
  outline: 2px solid rgba(43, 109, 90, 0.3);
  outline-offset: 2px;
}

.stat-value {
  display: block;
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
  font-size: 29px;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.stat-grid .stat {
  padding: 18px 18px 18px 0;
}

.stat-grid .stat + .stat {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.time-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin-top: 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.time-option select {
  padding: 3px 20px 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: 0;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-size: 10px;
}

.time-option select:focus-visible {
  border-color: #c2d6cc;
  box-shadow: 0 0 0 2px rgba(43, 109, 90, 0.12);
}

.time-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding-top: 18px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.time-stat {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.time-icon {
  display: grid;
  width: 21px;
  height: 21px;
  margin-top: -1px;
  place-items: center;
  border: 1px solid #c9d8d1;
  border-radius: 50%;
  color: var(--accent);
  font-size: 13px;
}

.time-value {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.editor-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(24, 48, 39, 0.035);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 17px 22px;
}

.editor-toolbar {
  border-bottom: 1px solid var(--line);
}

.editor-body {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.line-number-gutter {
  flex: 0 0 34px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #fbfcfb;
  color: #a4afaa;
  text-align: right;
}

.line-numbers {
  padding: 29px 6px 24px 0;
  font-size: clamp(16px, 1.5vw, 19px);
  font-weight: 400;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  white-space: pre;
  user-select: none;
}

.line-number-row {
  line-height: inherit;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.editor-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.line-indicator {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.text-size-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.text-size-icon {
  display: inline-block;
  color: var(--accent);
  line-height: 1;
  user-select: none;
}

.text-size-icon-small {
  font-size: 10px;
}

.text-size-icon-large {
  font-size: 15px;
}

.text-size-control input {
  width: 76px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.reset-button {
  display: inline-flex;
  width: auto;
  height: 27px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

.reset-button > span:first-child {
  font-size: 17px;
  font-weight: 400;
}

.reset-button:hover,
.reset-button:focus-visible {
  border-color: #c2d6cc;
  background: var(--accent-light);
  color: var(--accent);
}

textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  resize: both;
  border: 0;
  outline: 0;
  padding: 29px 29px 24px 16px;
  background: transparent;
  color: var(--ink);
  font-size: clamp(16px, 1.5vw, 19px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.5;
  overflow: auto;
  max-width: 100%;
  max-height: 100%;
  scrollbar-color: #cbd9d3 transparent;
  scrollbar-width: thin;
}

textarea::placeholder {
  color: #b0b9b5;
}

textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(43, 109, 90, 0.1);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  border-top: 1px solid var(--line);
}

.site-footer nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 150ms ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 0 26px;
  }

  .workspace {
    gap: 34px;
    padding-right: 0;
    padding-left: 0;
  }

  h1 {
    font-size: clamp(34px, 5vw, 46px);
  }
}

@media (max-width: 650px) {
  .app-shell {
    min-height: 0;
    padding: 0 18px;
  }

  .topbar {
    height: 62px;
  }

  .privacy-note {
    font-size: 10px;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
    padding-top: 27px;
    padding-bottom: 14px;
  }

  .sidebar-intro {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
    align-items: end;
  }

  .eyebrow {
    grid-column: 1 / -1;
    margin-bottom: 12px;
  }

  h1 {
    font-size: clamp(32px, 10vw, 48px);
  }

  h1 br {
    display: none;
  }

  .stats {
    max-width: none;
    margin-top: 16px;
  }

  .primary-stat {
    padding-bottom: 9px;
  }

  .primary-stat + .primary-stat {
    padding-left: 14px;
  }

  .space-option {
    min-height: 29px;
  }

  .stat-grid .stat {
    padding: 8px 8px 8px 0;
  }

  .stat-grid .stat + .stat {
    padding-left: 8px;
    border-left: 1px solid var(--line);
  }

  .stat-value {
    font-size: 20px;
  }

  .time-stats {
    padding-top: 9px;
    gap: 12px;
  }

  .time-option {
    min-height: 29px;
    margin-top: 10px;
  }

  .time-value {
    margin-top: 2px;
    font-size: 12px;
  }

  .time-icon {
    width: 18px;
    height: 18px;
    font-size: 11px;
  }

  .editor-panel {
    flex: 1 1 auto;
    min-height: 0;
  }

  .editor-toolbar {
    padding: 13px 16px;
  }

  .toolbar-actions {
    gap: 9px;
  }

  .text-size-control input {
    width: 62px;
  }

  .line-indicator {
    font-size: 10px;
  }

  textarea {
    padding: 18px 16px 18px 12px;
    font-size: 15px;
    line-height: 1.45;
    resize: vertical;
  }

  .line-number-gutter {
    flex-basis: 30px;
  }

  .line-numbers {
    padding-right: 4px;
    font-size: 15px;
    line-height: 1.45;
  }

  .site-footer {
    min-height: 48px;
    gap: 10px;
    font-size: 9px;
  }

  .site-footer nav {
    gap: 6px;
  }

  .site-footer nav a:first-child {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 650px) and (max-height: 580px) {
  .workspace {
    padding-top: 18px;
  }

  .sidebar-intro {
    display: block;
  }

  .eyebrow {
    margin-bottom: 8px;
  }

  h1 {
    font-size: 31px;
  }

  .stats {
    margin-top: 12px;
  }

  .editor-toolbar {
    padding-top: 10px;
    padding-bottom: 10px;
  }
}

@media (max-height: 680px) and (min-width: 651px) {
  .workspace {
    padding-top: 30px;
    padding-bottom: 24px;
  }

  .stats {
    margin-top: 30px;
  }
}
