:root {
  --bg: #f8f9fa;
  --page: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --line-soft: #e8eaed;
  --hover: #f1f3f4;
  --active: #e8f0fe;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.18), 0 1px 3px rgba(60, 64, 67, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input[type="number"],
summary {
  height: 32px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
}

button,
summary {
  cursor: pointer;
  padding: 0 10px;
}

select,
input[type="number"] {
  padding: 0 8px;
}

button:hover,
select:hover,
input[type="number"]:hover,
summary:hover {
  background: var(--hover);
  border-color: var(--line-soft);
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible,
textarea:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--page);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 16px;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.divider {
  width: 1px;
  height: 24px;
  background: var(--line-soft);
  margin: 0 6px;
}

.select-label {
  color: var(--muted);
  font-size: 12px;
  margin-left: 2px;
}

.stat {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 0 6px;
  white-space: nowrap;
}

#timerDisplay {
  color: var(--text);
}

#startPauseButton {
  background: var(--text);
  border-color: var(--text);
  color: var(--page);
}

#startPauseButton:hover {
  background: #000000;
}

#timerSelect {
  width: 86px;
}

#fontSelect {
  width: 118px;
}

.custom-minutes {
  width: 64px;
}

.menu {
  position: relative;
}

.menu summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu[open] summary {
  background: var(--active);
  border-color: transparent;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page);
  box-shadow: var(--shadow);
  z-index: 20;
}

.export-panel {
  display: grid;
  gap: 2px;
}

.export-panel button {
  width: 100%;
  text-align: left;
}

.options-panel {
  display: grid;
  gap: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  white-space: nowrap;
}

.checkbox-row input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.archive-menu .menu-panel {
  width: min(360px, 90vw);
  max-height: 380px;
  overflow: auto;
}

.session-list {
  display: grid;
  gap: 4px;
}

.session-item {
  border-radius: 4px;
}

.session-item button {
  width: 100%;
  height: auto;
  min-height: 44px;
  display: block;
  text-align: left;
  padding: 8px;
}

.session-title {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
}

.session-meta {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.empty-archive {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  padding: 8px;
}

.document-stage {
  min-height: calc(100vh - 48px);
  padding: 28px 16px 64px;
}

#draftEditor {
  width: min(100%, 816px);
  min-height: 1056px;
  display: block;
  margin: 0 auto;
  padding: 96px 96px;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--page);
  color: var(--text);
  box-shadow: var(--shadow);
  resize: vertical;
  line-height: 1.55;
  font-size: 16px;
}

#draftEditor.font-system {
  font-family: Arial, Helvetica, sans-serif;
}

#draftEditor.font-serif {
  font-family: Georgia, "Times New Roman", serif;
}

#draftEditor.font-garamond {
  font-family: Garamond, Baskerville, "Times New Roman", serif;
}

#draftEditor.font-mono {
  font-family: "Courier New", Courier, monospace;
}

#draftEditor.font-times {
  font-family: "Times New Roman", Times, serif;
}

#draftEditor.font-comic {
  font-family: "Comic Sans MS", "Comic Sans", "Comic Neue", cursive;
}

dialog {
  width: min(92vw, 360px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(32, 33, 36, 0.22);
}

dialog h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 400;
}

dialog p {
  margin: 0;
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 16px;
}

@media (max-width: 760px) {
  .toolbar {
    align-items: flex-start;
    gap: 10px;
  }

  .brand {
    padding-top: 8px;
  }

  .divider,
  .select-label {
    display: none;
  }

  .document-stage {
    padding: 12px 0 32px;
  }

  #draftEditor {
    min-height: calc(100vh - 96px);
    width: 100%;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
    padding: 32px 20px;
  }
}
