* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --ink: #171717;
  --muted-ink: #666666;
  --hairline: #e9e9e9;
  --page-font: Georgia, serif;
  background: #ffffff;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: #ffffff;
}

body {
  min-height: 100vh;
}

button,
select {
  color: inherit;
  font: inherit;
}

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

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  width: 100%;
  height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.97);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  display: block;
  object-fit: contain;
}

.brand span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.065em;
}

.tools {
  display: flex;
  align-items: center;
  gap: 11px;
}

.font-select {
  max-width: 154px;
  height: 34px;
  padding: 0 21px 0 8px;
  border: 0;
  border-radius: 5px;
  outline: none;
  background-color: #ffffff;
  color: #343434;
  cursor: pointer;
  font-size: 13px;
}

.font-select:hover,
.font-select:focus-visible {
  background: #f8f8f8;
}

.icon-button,
.menu-button,
.add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: #ffffff;
  cursor: pointer;
}

.icon-button {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  color: #292929;
}

.icon-button:hover,
.menu-button:hover {
  background: #f6f6f6;
}

.font-upload {
  gap: 1px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
}

.tiny-plus {
  align-self: flex-start;
  margin-top: 3px;
  font-family: Arial, sans-serif;
  font-size: 10px;
}

.sync-indicator {
  width: 6px;
  height: 6px;
  margin: 0 2px 0 3px;
  border-radius: 50%;
  background: #b7b7b7;
}

.sync-indicator[data-state="saving"] {
  background: #777777;
}

.sync-indicator[data-state="error"] {
  background: #b53e3e;
}

.editor-shell {
  width: min(760px, calc(100% - 48px));
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  padding: 82px 0 130px;
}

.page {
  min-height: 62vh;
  font-family: var(--page-font);
}

.blocks {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.text-block-wrap,
.image-block-wrap {
  position: relative;
  width: 100%;
}

.text-block {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--page-font);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.72;
  resize: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.block-remove {
  position: absolute;
  z-index: 1;
  top: 0;
  right: -38px;
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: #777777;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, background-color 120ms ease;
}

.text-block-wrap:hover .block-remove,
.text-block-wrap:focus-within .block-remove,
.image-block-wrap:hover .block-remove,
.image-block-wrap:focus-within .block-remove {
  opacity: 1;
}

.block-remove:hover {
  background: #f6f6f6;
  color: #181818;
}

.block-remove svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.image-block-wrap {
  display: flex;
  align-items: flex-start;
}

.image-block {
  display: block;
  max-width: 100%;
  max-height: 760px;
  object-fit: contain;
  object-position: left top;
}

.add-controls {
  position: fixed;
  z-index: 10;
  right: 28px;
  bottom: 26px;
}

.add-button {
  width: 48px;
  height: 48px;
  border: 1px solid #dedede;
  border-radius: 50%;
  color: #171717;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.055);
  transition: border-color 140ms ease, transform 140ms ease;
}

.add-button:hover {
  transform: translateY(-1px);
  border-color: #b8b8b8;
}

.add-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.add-menu {
  position: absolute;
  right: 0;
  bottom: 60px;
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--hairline);
  border-radius: 9px;
  background: #ffffff;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.07);
}

.add-menu[hidden] {
  display: none;
}

.menu-button {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  color: #262626;
}

.menu-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
}

button:focus-visible,
select:focus-visible {
  outline: 2px solid #8b8b8b;
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .topbar {
    height: 60px;
    padding: 0 16px;
  }

  .brand {
    gap: 7px;
  }

  .brand span {
    font-size: 17px;
  }

  .brand img {
    width: 24px;
    height: 24px;
  }

  .tools {
    gap: 4px;
  }

  .font-select {
    max-width: 119px;
    font-size: 12px;
  }

  .editor-shell {
    width: calc(100% - 42px);
    min-height: calc(100vh - 60px);
    padding-top: 64px;
  }

  .text-block {
    font-size: 18px;
  }

  .block-remove {
    right: -18px;
    width: 26px;
    height: 26px;
    opacity: 1;
  }

  .add-controls {
    right: 17px;
    bottom: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
