:root {
  color-scheme: light;
  font-family: 'SF Pro Text', 'SF Pro Display', -apple-system, BlinkMacSystemFont,
    system-ui, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --echo-ink: #17251d;
  --echo-muted: #536158;
  --echo-line: #d8dfda;
  --echo-surface: #ffffff;
  --echo-canvas: #f4f7f5;
  --echo-brand: #315b40;
  --echo-brand-strong: #244631;
  --echo-focus: #e3a008;
}

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

body {
  margin: 0;
  background: var(--echo-canvas);
  color: var(--echo-ink);
  font-family: 'SF Pro Text', 'SF Pro Display', -apple-system, BlinkMacSystemFont,
    system-ui, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

body * {
  font-family: inherit;
}

.MuiPaper-root.MuiAppBar-root {
  background: var(--echo-brand-strong) !important;
  background-image: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

.MuiAppBar-root h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.MuiPaper-root {
  background-image: none;
  box-shadow: none;
}

.MuiPaper-rounded {
  border-radius: 8px !important;
}

body .MuiButtonBase-root,
body .MuiTypography-root {
  font-family: inherit !important;
}

main.MuiBox-root {
  background: var(--echo-canvas);
}

[role='gridcell'] > button,
[role='grid'] button {
  border-radius: 8px;
  box-shadow: none;
  transition:
    border-color 120ms ease,
    transform 120ms ease;
}

[role='gridcell'] > button:hover,
[role='grid'] button:hover {
  box-shadow: none;
  transform: translateY(-1px);
}

[role='gridcell'] > button:focus-visible,
[role='grid'] button:focus-visible,
.MuiButtonBase-root:focus-visible {
  outline: 3px solid var(--echo-focus);
  outline-offset: 2px;
}

[role='gridcell'] img,
[role='grid'] button img {
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  width: min(86%, 9rem);
  height: min(86%, 9rem);
  object-fit: contain;
  transform: translate(-50%, -50%);
}

[role='gridcell'] button span,
[role='grid'] button span {
  color: var(--echo-ink);
  font-weight: 700;
}

.MuiDrawer-paper,
aside.MuiPaper-root {
  border-color: var(--echo-line);
  background: var(--echo-surface);
}

#echo-ai-notice-card {
  border: 1px solid var(--echo-line);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(23, 37, 29, 0.22);
  font-family: inherit;
}

#echo-ai-notice-continue {
  border-radius: 6px;
  background: var(--echo-brand);
}

@media (prefers-reduced-motion: reduce) {
  [role='gridcell'] > button,
  [role='grid'] button {
    transition: none;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .MuiAppBar-root .MuiToolbar-root {
    box-sizing: border-box;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .MuiAppBar-root .MuiToolbar-root > .MuiStack-root,
  .MuiAppBar-root .MuiToolbar-root > .MuiBox-root {
    width: 100%;
  }

  .MuiAppBar-root .MuiPaper-rounded > .MuiStack-root > .MuiStack-root {
    flex-direction: column;
    align-items: stretch;
  }

  .MuiAppBar-root .MuiPaper-rounded .MuiStack-root {
    min-width: 0;
  }

  .MuiAppBar-root .MuiPaper-rounded button {
    min-width: 0;
  }

  main > .MuiStack-root {
    padding: 1rem;
  }

  [role='grid'] {
    gap: 0.5rem !important;
  }

  [role='grid'] > [role='row'] {
    flex-wrap: wrap;
    gap: 0.5rem !important;
    min-width: 0;
  }

  [role='grid'] > [role='row'] > button {
    width: calc((100% - 1rem) / 3) !important;
    min-width: 0 !important;
    flex: 0 0 calc((100% - 1rem) / 3) !important;
  }

  [role='grid'] button img {
    width: min(84%, 5.5rem);
    height: min(84%, 5.5rem);
  }
}
