/* Chromium Network Error Page Styles */

/* CSS Variables for theming */
:root {
  --background-color: #fff;
  --text-color: #202124;
  --error-code-color: #5f6368;
  --link-color: #1a73e8;
  --google-blue-300: #7baaf7;
  --google-blue-600: #1a73e8;
  --google-gray-50: #f8f9fa;
  --google-gray-100: #f1f3f4;
  --google-gray-300: #dadce0;
  --google-gray-500: #9aa0a6;
  --google-gray-700: #5f6368;
  --google-gray-800: #3c4043;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #202124;
    --text-color: #e8eaed;
    --error-code-color: #9aa0a6;
    --link-color: #8ab4f8;
    --google-blue-300: #669df6;
    --google-blue-600: #8ab4f8;
    --google-gray-50: #3c4043;
    --google-gray-100: #5f6368;
    --google-gray-300: #5f6368;
    --google-gray-500: #9aa0a6;
    --google-gray-700: #bdc1c6;
    --google-gray-800: #3c4043;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a {
  text-decoration: none;
  color: var(--link-color);
}

a:hover {
  text-decoration: underline;
}

/* Main frame error container */
#main-frame-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  text-align: center;
}

.interstitial-wrapper {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

/* Error icon */
.icon {
  display: inline-block;
  margin-bottom: 20px;
  user-select: none;
}

.icon-generic {
  width: 120px;
  height: 120px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Ccircle cx='60' cy='60' r='58' fill='none' stroke='%23dadce0' stroke-width='2'/%3E%3Ccircle cx='60' cy='42' r='8' fill='%23dadce0'/%3E%3Crect x='56' y='54' width='8' height='32' rx='4' fill='%23dadce0'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

@media (prefers-color-scheme: dark) {
  .icon-generic {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Ccircle cx='60' cy='60' r='58' fill='none' stroke='%235f6368' stroke-width='2'/%3E%3Ccircle cx='60' cy='42' r='8' fill='%235f6368'/%3E%3Crect x='56' y='54' width='8' height='32' rx='4' fill='%235f6368'/%3E%3C/svg%3E");
  }
}

/* Error title */
h1 {
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 16px;
  word-wrap: break-word;
}

h1 span {
  font-weight: 500;
}

/* Error message */
#error-message {
  font-size: 15px;
  color: var(--error-code-color);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Error code */
#error-code {
  font-size: 13px;
  color: var(--error-code-color);
  margin-bottom: 32px;
  font-family: monospace;
}

/* Buttons */
#buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  padding: 10px 24px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

button:hover {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

button:active {
  box-shadow: none;
}

.blue-button {
  background-color: var(--google-blue-600);
  color: #fff;
}

.blue-button:hover {
  background-color: var(--google-blue-600);
  filter: brightness(1.1);
}

.secondary-button {
  background-color: #d9d9d9;
  color: #696969;
}

@media (prefers-color-scheme: dark) {
  .secondary-button {
    background-color: var(--google-gray-800);
    color: var(--google-gray-100);
  }
}

/* Suggestions */
.suggestions {
  margin-top: 32px;
  text-align: left;
}

.suggestions a {
  color: var(--google-blue-600);
}

.suggestion-header {
  font-weight: bold;
  margin-bottom: 4px;
}

.suggestion-body {
  color: #777;
  margin-bottom: 16px;
}

.suggestion-body p {
  margin: 0;
}

.suggestion-body ul {
  margin: 0;
  padding-left: 20px;
}

.suggestion-body li {
  margin-bottom: 4px;
}

/* Offline / Dino Game */
.offline {
  transition: filter 1.5s cubic-bezier(0.65, 0.05, 0.36, 1),
              background-color 1.5s cubic-bezier(0.65, 0.05, 0.36, 1);
}

.offline .interstitial-wrapper {
  padding-top: 100px;
  position: relative;
}

.offline #main-message > p {
  display: none;
}

.runner-container {
  position: absolute;
  top: 35px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 44px;
  height: 150px;
  overflow: hidden;
  direction: ltr;
  z-index: 10;
}

.runner-canvas {
  width: 100%;
  height: 150px;
  image-rendering: pixelated;
}

.controller {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9;
}

/* Dino game start text */
#offline-instruction {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 14px;
  color: var(--error-code-color);
  opacity: 0;
  transition: opacity 0.5s;
}

.runner-container:focus ~ #offline-instruction,
.runner-container.active ~ #offline-instruction {
  opacity: 1;
}

/* Offline resources hidden */
#offline-resources {
  display: none;
}

/* Snackbar notification */
.snackbar {
  position: fixed;
  bottom: 24px;
  left: 24px;
  max-width: 568px;
  min-width: 288px;
  background: #323232;
  border-radius: 2px;
  box-sizing: border-box;
  color: #fff;
  font-size: 0.87em;
  opacity: 0;
  padding: 16px 24px 12px;
  transform: translateY(90px);
  will-change: opacity, transform;
  z-index: 999;
}

.snackbar-show {
  animation:
    show-snackbar 250ms cubic-bezier(0, 0, 0.2, 1) forwards,
    hide-snackbar 250ms cubic-bezier(0.4, 0, 1, 1) forwards 5s;
}

@keyframes show-snackbar {
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hide-snackbar {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(90px);
  }
}

/* Responsive */
@media (max-width: 640px), (max-height: 640px) {
  h1 {
    margin: 0 0 15px;
  }
  .suggestions {
    margin-top: 10px;
  }
  .suggestion-header {
    margin-bottom: 0;
  }
}

@media (max-height: 350px) {
  h1 {
    margin: 0 0 15px;
  }
}

/* Keyboard focus styles */
button:focus-visible {
  outline: 2px solid var(--google-blue-300);
  outline-offset: 2px;
}

.runner-container:focus {
  outline: none;
}

.runner-container:focus-visible {
  outline: 3px solid var(--google-blue-300);
}

/* Dark mode icon filter */
@media (prefers-color-scheme: dark) {
  .icon {
    filter: invert(1);
  }
}
