:root {
  --primary-color: #26a69a;
  --accent-color: #ff9800;
  --bg-dark: #0d1117;
  --bg-card: #161b22;
  --bg-code: #0d1117;
  --text-light: #f0f6fc;
  --text-muted: #8b949e;
  --border-color: #30363d;
  --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(38, 166, 154, 0.2);
  --gradient: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius: 8px;
  --header-height: 64px;
  --z-modal: 10000;
  --z-toast: 10001;
  --z-progress: 1000;
  --z-fixed: 9998;
}

.high-contrast {
  --primary-color: #ffffff;
  --accent-color: #ffff00;
  --bg-dark: #000000;
  --bg-card: #000000;
  --bg-code: #000000;
  --text-light: #ffffff;
  --text-muted: #cccccc;
  --border-color: #ffffff;
  --shadow-light: 0 4px 20px rgba(255, 255, 255, 0.1);
  --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.3);
}

[data-md-color-scheme="slate"] {
  --md-default-bg-color: var(--bg-dark);
  --md-code-bg-color: var(--bg-code);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
  border: 3px solid var(--bg-dark);
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) var(--bg-dark);
}

.md-header {
  box-shadow: 0 0 25px rgba(38, 166, 154, 0.3);
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.md-header--shadow {
  box-shadow: 0 0 30px rgba(38, 166, 154, 0.4);
}

.md-typeset {
  font-family: 'Roboto Mono', monospace;
  line-height: 1.6;
  font-size: 1.15em;
  font-weight: 400;
  color: var(--text-light);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1em;
  line-height: 1.3;
  color: var(--primary-color);
  position: relative;
  transition: var(--transition);
  text-shadow: var(--shadow-glow);
  letter-spacing: -0.02em;
}

.md-typeset h1::before,
.md-typeset h2::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 50px;
  height: 4px;
  background: var(--gradient);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.md-typeset h1:hover::before,
.md-typeset h2:hover::before {
  width: 70px;
}

.md-typeset h1 {
  font-size: 2.5em;
  margin-bottom: 2rem;
  font-weight: 700;
}

.md-typeset h2 {
  font-size: 1.8em;
}

.md-typeset h3 {
  font-size: 1.5em;
}

.md-typeset h4 {
  font-size: 1.3em;
}

.md-typeset h5 {
  font-size: 1.1em;
}

.md-typeset h6 {
  font-size: 1em;
}

.md-typeset p {
  margin-bottom: 1.2em;
  text-align: left;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: 0.01em;
  word-spacing: 0.05em;
  text-rendering: optimizeLegibility;
}

.md-typeset ul,
.md-typeset ol {
  text-align: left;
  padding-left: 2em;
  margin-bottom: 1.2em;
}

.md-typeset li {
  margin-bottom: 0.4em;
  line-height: 1.6;
  font-weight: 400;
}

.md-nav__link {
  transition: color 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  margin: 0.2rem 0;
  position: relative;
  overflow: hidden;
  font-weight: 500;
}

.md-nav__link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient);
  opacity: 0.1;
  transition: left 0.4s ease;
  z-index: -1;
}

.md-nav__link:hover::before {
  left: 0;
}

.md-nav__link:hover {
  color: var(--primary-color);
  transform: translateX(4px);
}

.md-nav__link--active {
  color: var(--accent-color);
  font-weight: 600;
}

.md-nav__item--active>.md-nav__link {
  color: var(--accent-color);
  font-weight: 600;
  background: rgba(38, 166, 154, 0.1);
  border-left: 4px solid var(--accent-color);
  padding-left: calc(1rem - 4px);
}

.md-typeset code {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.95em;
  font-weight: 500;
  background-color: rgba(38, 166, 154, 0.1);
  border-radius: 4px;
  padding: 0.2em 0.4em;
  transition: var(--transition);
}

.md-typeset code:hover {
  background-color: rgba(38, 166, 154, 0.15);
}






#readingTime {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--gradient);
  color: white;
  padding: 10px 16px;
  border-radius: 24px;
  font-size: 0.85em;
  font-weight: 600;
  z-index: var(--z-fixed);
  opacity: 0.95;
  transition: all 0.3s ease;
  font-family: 'Roboto Mono', monospace;
  display: block;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

#readingTime:hover {
  opacity: 1;
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 6px 20px rgba(38, 166, 154, 0.4);
}

#readingTime:active {
  transform: scale(0.98);
}

#backToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 50%;
  width: 55px;
  height: 55px;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  z-index: var(--z-modal);
  opacity: 0.95;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

#backToTop:hover {
  opacity: 1;
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 6px 20px rgba(38, 166, 154, 0.4);
}

#backToTop:active {
  transform: scale(0.95);
}

#progressBar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-progress);
  height: 4px;
  background: var(--gradient);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px var(--primary-color);
}

#shortcuts-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto Mono', monospace;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.shortcuts-modal-overlay {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.shortcuts-modal-content {
  background: var(--bg-card);
  color: var(--text-light);
  padding: 30px;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.shortcuts-modal-content h2 {
  margin: 0 0 25px 0;
  color: var(--primary-color);
  font-size: 1.8em;
  text-align: center;
  text-shadow: var(--shadow-glow);
  font-weight: 600;
}

.shortcuts-list {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(38, 166, 154, 0.05);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  font-weight: 500;
}

.shortcut-item:hover {
  background: rgba(38, 166, 154, 0.1);
  border-color: var(--primary-color);
  transform: translateX(5px);
}

.shortcut-keys {
  display: flex;
  gap: 8px;
  align-items: center;
}

.shortcut-desc {
  color: var(--text-muted);
  font-size: 0.95em;
  font-weight: 400;
}

.shortcuts-modal-content kbd {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.85em;
  font-family: 'Roboto Mono', monospace;
  font-weight: 500;
  color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  min-width: 30px;
  text-align: center;
  display: inline-block;
}

.shortcuts-close-btn {
  background: var(--gradient);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  margin-top: 20px;
  width: 100%;
  font-size: 1em;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.shortcuts-close-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(38, 166, 154, 0.4);
}

.shortcuts-close-btn:active {
  transform: translateY(0);
}

.md-typeset .admonition {
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius);
  background: rgba(38, 166, 154, 0.05);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
}

.md-typeset .admonition:hover {
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.md-typeset a {
  color: var(--primary-color);
  text-decoration: none;
  position: relative;
  transition: color 0.3s ease;
  font-weight: 500;
}

.md-typeset a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient);
  transition: width 0.3s ease;
}

.md-typeset a:hover {
  color: var(--accent-color);
}

.md-typeset a:hover::after {
  width: 100%;
}

.md-typeset table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-color);
}

.md-typeset th,
.md-typeset td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
}

.md-typeset th {
  background: var(--gradient);
  color: white;
  font-weight: 600;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.md-typeset tr:nth-child(even) {
  background: rgba(38, 166, 154, 0.02);
}

.md-typeset tr:hover {
  background: rgba(38, 166, 154, 0.05);
  transition: background 0.2s ease;
}

.md-typeset tbody tr:last-child td {
  border-bottom: none;
}

#toast-container {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-light);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-light);
  opacity: 0;
  transform: translateX(120%);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  min-width: 250px;
  backdrop-filter: blur(10px);
  font-weight: 500;
}

.toast--visible {
  opacity: 1;
  transform: translateX(0);
}

.toast__icon {
  flex-shrink: 0;
  font-size: 1.5em;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast__message {
  flex: 1;
  font-size: 0.9em;
  line-height: 1.4;
  word-break: break-word;
  font-weight: 500;
}

.toast--success {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, rgba(38, 166, 154, 0.1), rgba(38, 166, 154, 0.05));
}

.toast--success .toast__icon {
  color: var(--primary-color);
}

.toast--error {
  border-color: #f44336;
  background: linear-gradient(135deg, rgba(244, 67, 54, 0.1), rgba(244, 67, 54, 0.05));
}

.toast--error .toast__icon {
  color: #f44336;
}

.toast--warning {
  border-color: var(--accent-color);
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), rgba(255, 152, 0, 0.05));
}

.toast--warning .toast__icon {
  color: var(--accent-color);
}

.toast--info {
  border-color: #2196f3;
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
}

.toast--info .toast__icon {
  color: #2196f3;
}

@media screen and (max-width: 768px) {

  /* Larger elements for mobile */
  #readingTime {
    top: 70px;
    right: 10px;
    font-size: 1.1em;
    padding: 12px 18px;
    width: auto;
    min-width: 200px;
  }

  #backToTop {
    bottom: 20px;
    right: 15px;
    width: 65px;
    height: 65px;
    font-size: 28px;
  }

  #toast-container {
    right: 15px;
    left: 15px;
    max-width: calc(100% - 30px);
    top: 120px;
  }

  .toast {
    min-width: auto;
    font-size: 1.1em;
    padding: 16px 20px;
    min-height: 60px;
  }

  .toast__icon {
    font-size: 1.8em;
    width: 30px;
    height: 30px;
  }

  .shortcuts-modal-content {
    padding: 25px;
    margin: 15px;
    max-height: 85vh;
    max-width: calc(100% - 30px);
  }

  .shortcuts-modal-content h2 {
    font-size: 2.2em;
    margin-bottom: 30px;
  }

  .shortcut-item {
    padding: 16px 20px;
    font-size: 1.1em;
    min-height: 70px;
  }

  .shortcuts-close-btn {
    padding: 16px 24px;
    font-size: 1.2em;
    min-height: 60px;
  }

  /* Larger fonts for mobile */
  .md-typeset {
    font-size: 1.3em;
    line-height: 1.7;
  }

  .md-typeset h1 {
    font-size: 3em;
    margin-top: 2rem;
    margin-bottom: 2.5rem;
  }

  .md-typeset h2 {
    font-size: 2.4em;
  }

  .md-typeset h3 {
    font-size: 2em;
  }

  .md-typeset h4 {
    font-size: 1.6em;
  }

  .md-typeset h5 {
    font-size: 1.4em;
  }

  .md-typeset h6 {
    font-size: 1.2em;
  }

  .md-typeset p {
    font-size: 1.2em;
    margin-bottom: 1.5em;
  }

  .md-typeset li {
    font-size: 1.1em;
    margin-bottom: 0.6em;
  }

  .md-typeset code {
    font-size: 1.1em;
    padding: 0.3em 0.5em;
  }

  .md-nav__link {
    font-size: 1.2em;
    padding: 0.8rem 1.2rem;
    min-height: 50px;
  }

  /* Larger table cells */
  .md-typeset th,
  .md-typeset td {
    padding: 16px 20px;
    font-size: 1.1em;
  }

  /* Larger buttons and interactive elements */
  button,
  a,
  .md-nav__link {
    min-height: 50px;
    min-width: 50px;
    font-size: 1.1em;
  }

  /* Larger admonitions */
  .md-typeset .admonition {
    padding: 1.5rem 2rem;
    font-size: 1.1em;
  }
}

@media screen and (max-width: 480px) {

  /* Even larger for very small screens */
  .md-typeset {
    font-size: 1.4em;
    line-height: 1.8;
  }

  .md-typeset h1 {
    font-size: 3.5em;
  }

  .md-typeset h2 {
    font-size: 2.8em;
  }

  .md-typeset h3 {
    font-size: 2.4em;
  }

  .md-typeset p {
    font-size: 1.3em;
  }

  .shortcuts-modal-content {
    padding: 20px;
    margin: 10px;
  }

  .shortcuts-modal-content h2 {
    font-size: 2.5em;
  }

  #readingTime {
    font-size: 1.2em;
    padding: 14px 20px;
    min-width: 220px;
  }

  #backToTop {
    width: 70px;
    height: 70px;
    font-size: 32px;
  }

  .toast {
    font-size: 1.2em;
    padding: 18px 22px;
  }

  .md-nav__link {
    font-size: 1.3em;
    padding: 1rem 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }
}

@media (prefers-contrast: high) {
  :root {
    --primary-color: #00ffff;
    --accent-color: #ffff00;
    --text-light: #ffffff;
    --bg-dark: #000000;
    --border-color: #ffffff;
  }

  .md-typeset code {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #ffffff;
  }

  button,
  a,
  input,
  select,
  textarea {
    border: 1px solid var(--border-color);
  }
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  outline-style: solid;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 10003;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.md-typeset {
  color: var(--text-light);
}

.md-typeset code:not(.highlight code) {
  color: #e6db74;
}

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

@media print {

  #readingTime,
  #helpButton,
  #backToTop,
  #progressBar,
  #toast-container,
  #shortcuts-modal {
    display: none;
  }
}

@keyframes rainbow {
  0% {
    filter: hue-rotate(0deg);
  }

  100% {
    filter: hue-rotate(360deg);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

@keyframes glow {

  0%,
  100% {
    box-shadow: 0 0 10px currentColor;
  }

  50% {
    box-shadow: 0 0 20px currentColor;
  }
}

@media print {
  body {
    display: none;
  }

  .md-typeset code {
    background: white !important;
    color: black !important;
    border: 1px solid #000;
  }
}

.cj-toyota-shake {
  animation: cj-shake 0.8s cubic-bezier(.36, .07, .19, .97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

@keyframes cj-shake {

  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }

  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

/* Aggressively hide MkDocs Material built-in clipboard toast */
.md-clipboard__message,
.md-tooltip,
[data-md-component="announce"],
.md-announce,
.md-snackbar,
.md-toast {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: -9999 !important;
}

/* CRT Console Effects */
@keyframes scanline {
  0% {
    transform: translateY(-100%);
  }

  100% {
    transform: translateY(100%);
  }
}

#hacker-console::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  z-index: 2;
  background-size: 100% 2px, 3px 100%;
  pointer-events: none;
}

#hacker-console::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: rgba(18, 16, 16, 0.1);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  animation: flicker 0.15s infinite;
}

@keyframes flicker {
  0% {
    opacity: 0.02795172;
  }

  5% {
    opacity: 0.04853918;
  }

  10% {
    opacity: 0.01255307;
  }

  15% {
    opacity: 0.07962305;
  }

  20% {
    opacity: 0.04942887;
  }

  25% {
    opacity: 0.0946353;
  }

  30% {
    opacity: 0.01026178;
  }

  35% {
    opacity: 0.07954397;
  }

  40% {
    opacity: 0.01303619;
  }

  45% {
    opacity: 0.07954397;
  }

  50% {
    opacity: 0.02365804;
  }

  55% {
    opacity: 0.05362833;
  }

  60% {
    opacity: 0.09067055;
  }

  65% {
    opacity: 0.04183301;
  }

  70% {
    opacity: 0.09263399;
  }

  75% {
    opacity: 0.08384535;
  }

  80% {
    opacity: 0.0326423;
  }

  85% {
    opacity: 0.02687152;
  }

  90% {
    opacity: 0.02660253;
  }

  95% {
    opacity: 0.03693532;
  }

  100% {
    opacity: 0.03818638;
  }
}