:root {
  --docs-blue: #1a73e8;
  --docs-link: #1155cc;
  --canvas-bg: #f9fbfd;
  --border: #dadce0;
  --text: #202124;
  --muted: #5f6368;
  --hover: #f1f3f4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: white;
}

.docs-app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.topbar {
  display: flex;
  align-items: flex-start;
  padding: 8px 16px 0;
  gap: 12px;
  background: white;
  flex-shrink: 0;
}

.docs-logo {
  flex-shrink: 0;
  margin-top: 4px;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.title-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.doc-title {
  font-size: 18px;
  font-weight: 400;
  border: 0;
  padding: 4px 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  outline: none;
  border-radius: 4px;
  width: auto;
  min-width: 80px;
}
.doc-title:hover { background: var(--hover); cursor: text; }
.doc-title:focus { background: white; box-shadow: 0 0 0 1px var(--docs-blue); }

.icon-btn {
  background: transparent;
  border: 0;
  padding: 6px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.icon-btn:hover { background: var(--hover); }

.saved {
  margin-left: 8px;
  display: flex;
  align-items: center;
  color: var(--muted);
  padding: 6px;
}

.menu {
  display: flex;
  gap: 2px;
  padding-left: 4px;
}
.menu span {
  padding: 4px 8px;
  font-size: 13px;
  color: var(--text);
  border-radius: 4px;
  cursor: default;
}
.menu span:hover { background: var(--hover); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.comments-btn {
  background: transparent;
  border: 0;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.comments-btn:hover { background: var(--hover); }

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #c2e7ff;
  color: #001d35;
  border: 0;
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.share-btn svg path { fill: #001d35; }
.share-btn:hover { background: #b3def0; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1a73e8;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 16px;
  margin: 4px 12px 8px;
  background: #edf2fa;
  border-radius: 24px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }

.tb, .tb-text {
  background: transparent;
  border: 0;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tb { min-width: 28px; height: 28px; justify-content: center; }
.tb-text.wide { min-width: 100px; }
.tb:hover, .tb-text:hover { background: rgba(60,64,67,0.08); }

.tb-text .caret { font-size: 9px; color: var(--muted); }

.tb-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

.size-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  background: white;
  margin: 0 2px;
}

.tb-color { flex-direction: column; gap: 0; padding: 4px 6px; }
.tb-color span:first-child { font-weight: 500; line-height: 1; }
.color-bar { display: block; width: 16px; height: 3px; background: #ea4335; margin-top: 1px; }

.canvas {
  flex: 1;
  background: var(--canvas-bg);
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 24px;
  border-top: 1px solid var(--border);
  position: relative;
}

.page {
  width: min(816px, calc(100% - 32px));
  background: white;
  box-shadow: 0 1px 3px 1px rgba(60,64,67,0.15);
  padding: 64px 96px;
  flex-shrink: 0;
  position: relative;
}

.page-content {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 11pt;
  line-height: 1.5;
  color: var(--text);
}

.doc-h1 {
  font-size: 26pt;
  font-weight: 400;
  margin: 0 0 6px;
  line-height: 1.1;
  color: var(--text);
}

.doc-sub {
  font-size: 14pt;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 400;
}

.doc-link {
  margin: 0 0 18px;
}

.doc-body {
  margin: 0 0 22px;
  color: var(--text);
}

.doc-h2 {
  font-family: Arial, sans-serif;
  font-size: 16pt;
  font-weight: 400;
  color: var(--text);
  margin: 28px 0 8px;
  line-height: 1.3;
}

.doc-list {
  margin: 0 0 18px;
  padding-left: 24px;
}
.doc-list li {
  margin: 4px 0;
}

.doc-quote {
  margin: 14px 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid #dadce0;
  color: #3c4043;
}
.doc-quote p {
  margin: 0 0 6px;
  font-style: italic;
  line-height: 1.55;
}
.doc-quote p:last-of-type {
  margin-bottom: 4px;
}
.doc-quote footer {
  font-style: normal;
  font-size: 10pt;
  color: var(--muted);
}

a {
  color: var(--docs-link);
  text-decoration: underline;
}
a:visited { color: #6f1ab1; }

.doc-cursor {
  margin: 12px 0 0;
  height: 18px;
}

.caret-blink {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--text);
  vertical-align: text-bottom;
  animation: blink 1.06s steps(2, start) infinite;
}

@keyframes blink {
  to { visibility: hidden; }
}

/* Tablet & phones: shrink the chrome but keep everything visible */
@media (max-width: 900px) {
  .topbar {
    padding: 6px 8px;
    gap: 6px;
    align-items: center;
  }
  .docs-logo { margin-top: 0; }
  .docs-logo svg { width: 28px; height: 28px; }

  .title-stack { gap: 0; min-width: 0; }
  .title-row { gap: 2px; }
  .doc-title {
    font-size: 15px;
    padding: 3px 6px;
    min-width: 0;
    flex: 1;
  }

  .icon-btn { padding: 4px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .saved { padding: 4px; margin-left: 2px; }
  .saved svg { width: 14px; height: 14px; }

  /* Menu wraps to multiple lines so every item stays visible */
  .menu {
    flex-wrap: wrap;
    padding-left: 0;
    margin-top: 1px;
    row-gap: 0;
  }
  .menu span {
    font-size: 12px;
    padding: 3px 6px;
    white-space: nowrap;
  }

  .topbar-right { gap: 4px; }
  .comments-btn { padding: 6px; }
  .comments-btn svg { width: 18px; height: 18px; }
  .share-btn {
    padding: 6px 12px;
    font-size: 13px;
  }
  .share-btn svg { width: 13px; height: 13px; }
  .avatar { width: 28px; height: 28px; font-size: 12px; }

  .toolbar { margin: 4px 8px 8px; padding: 4px 8px; }

  .page { padding: 36px 24px; }
  .doc-h1 { font-size: 22pt; }
  .doc-sub { font-size: 12pt; }
}

/* Narrow phones (≤480px): drop a few of the lowest-priority icons so the rest fit */
@media (max-width: 480px) {
  .title-row .icon-btn { display: none; }
  .saved { display: none; }
  .comments-btn { display: none; }
  .share-btn span { display: none; }
  .share-btn { padding: 8px; font-size: 0; }
  .share-btn svg { width: 16px; height: 16px; }
}
