:root {
  --link-color: #660033;
  --page-top: 80px;
}
html {
  scrollbar-gutter: stable;
}
body {
  font-family: system-ui, sans-serif;
  margin: 0;
  background: #fafafa;
  color: #1c1c1c;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--page-top);
  background: #fafafa;
  z-index: 10;
}
.back {
  position: fixed;
  top: 12px;
  right: 168px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  color: var(--link-color);
  text-decoration: none;
  font-size: 22px;
  line-height: 1;
  z-index: 25;
}
.back:hover {
  background: #f0f0f0;
}
.back[aria-disabled="true"] {
  color: #ccc;
  cursor: default;
  pointer-events: none;
}
.back[aria-disabled="true"]:hover {
  background: #fff;
}
.lang-toggle {
  position: fixed;
  top: 12px;
  right: 116px;
  width: 44px;
  height: 44px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  z-index: 25;
  box-sizing: border-box;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 28px 21px;
}
.lang-toggle:hover {
  background-color: #f0f0f0;
}
.lang-toggle[data-current="en"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 480'%3E%3Cpath fill='%23012169' d='M0 0h640v480H0z'/%3E%3Cpath fill='%23FFF' d='m75 0 244 181L562 0h78v62L400 241l240 178v61h-80L320 301 81 480H0v-60l239-178L0 64V0z'/%3E%3Cpath fill='%23C8102E' d='m424 281 216 159v40L369 281zm-184 20 6 35L54 480H0zM640 0v3L391 191l2-44L590 0zM0 0l239 176h-60L0 42z'/%3E%3Cpath fill='%23FFF' d='M241 0v480h160V0zM0 160v160h640V160z'/%3E%3Cpath fill='%23C8102E' d='M0 193v96h640v-96zM273 0v480h96V0z'/%3E%3C/svg%3E");
}
.lang-toggle[data-current="pl"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 480'%3E%3Cpath fill='%23fff' d='M0 0h640v240H0z'/%3E%3Cpath fill='%23dc143c' d='M0 240h640v240H0z'/%3E%3C/svg%3E");
}
.coffee {
  position: fixed;
  top: 12px;
  right: 64px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  color: var(--link-color);
  text-decoration: none;
  font-size: 22px;
  line-height: 1;
  z-index: 25;
}
.coffee:hover {
  background: #f0f0f0;
}
.burger {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  z-index: 20;
  padding: 0;
}
.burger:hover {
  background: #f0f0f0;
}
.burger[aria-disabled="true"] {
  cursor: default;
  pointer-events: none;
}
.burger[aria-disabled="true"]:hover {
  background: #fff;
}
.burger[aria-disabled="true"] .burger-bars,
.burger[aria-disabled="true"] .burger-bars::before,
.burger[aria-disabled="true"] .burger-bars::after {
  background: #ccc;
}
.burger-bars,
.burger-bars::before,
.burger-bars::after {
  display: block;
  width: 22px;
  height: 3px;
  background: var(--link-color);
  border-radius: 2px;
}
.burger-bars {
  position: relative;
}
.burger-bars::before,
.burger-bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.burger-bars::before {
  top: -8px;
}
.burger-bars::after {
  top: 8px;
}
.burger-panel {
  position: fixed;
  top: 64px;
  right: 12px;
  min-width: 180px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 12px 16px;
  z-index: 19;
}
.menu {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 400px;
}
.menu li {
  margin-bottom: 10px;
}
.menu li:last-child {
  margin-bottom: 0;
}
.menu li.menu-divider {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}
.menu a {
  color: var(--link-color);
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
}
.menu a:hover {
  text-decoration: underline;
}

.give-up-row {
  margin-top: 16px;
  text-align: right;
}

.scope-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  user-select: none;
}
.scope-toggle input {
  margin: 0;
  cursor: pointer;
}
.give-up {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  color: var(--link-color);
  cursor: pointer;
}
.give-up:hover {
  background: #f0f0f0;
}
.give-up[hidden] {
  display: none;
}

#result {
  text-align: center;
  margin-top: 32px;
  animation: result-in 500ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes result-in {
  0%   { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}
.final-score {
  font-size: 32px;
  font-weight: 500;
  margin: 0 0 12px;
}
.time {
  font-size: 14px;
  color: #666;
  margin: 0 0 8px;
  font-variant-numeric: tabular-nums;
}
.best {
  font-size: 14px;
  color: #666;
  margin: 0 0 20px;
  font-variant-numeric: tabular-nums;
}
.best:empty {
  display: none;
}
.result-links {
  font-size: 14px;
  color: #666;
  margin: 0;
}
.result-links a {
  color: var(--link-color);
}
.result-links a[hidden] {
  display: none;
}
.best .new-badge {
  display: inline-block;
  color: #2a9d4a;
  font-weight: 500;
  margin-left: 6px;
  animation: new-record-bounce 2s ease-out;
  transform-origin: center bottom;
}
@keyframes new-record-bounce {
  0%   { transform: translateY(0); }
  18%  { transform: translateY(-12px); }
  32%  { transform: translateY(0); }
  45%  { transform: translateY(-8px); }
  60%  { transform: translateY(0); }
  75%  { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

dialog#zoom {
  width: min(80vw, 320px);
  padding: 16px;
  border: none;
  border-radius: 0;
  outline: none;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: scaleX(0);
  transition: opacity 150ms ease,
              transform 350ms cubic-bezier(0.4, 0, 0.2, 1),
              overlay 350ms ease allow-discrete,
              display 350ms ease allow-discrete;
}
dialog#zoom[open] {
  opacity: 1;
  transform: scaleX(1);
}
@starting-style {
  dialog#zoom[open] {
    opacity: 0;
    transform: scaleX(0);
  }
}
dialog#zoom::backdrop {
  background: rgba(0, 0, 0, 0);
  transition: background 200ms ease,
              overlay 200ms ease allow-discrete,
              display 200ms ease allow-discrete;
}
dialog#zoom[open]::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
@starting-style {
  dialog#zoom[open]::backdrop {
    background: rgba(0, 0, 0, 0);
  }
}
dialog#zoom img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #ddd;
  box-sizing: border-box;
}
dialog#zoom p {
  margin: 12px 0 0;
  text-align: center;
  font-size: 16px;
}

.home-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'/%3E%3C/svg%3E") center / contain no-repeat;
  vertical-align: middle;
}

.coffee-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 3H4v10c0 2.21 1.79 4 4 4h6c2.21 0 4-1.79 4-4v-3h2c1.11 0 2-.9 2-2V5c0-1.11-.89-2-2-2zm0 5h-2V5h2v3zM4 19h16v2H4z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 3H4v10c0 2.21 1.79 4 4 4h6c2.21 0 4-1.79 4-4v-3h2c1.11 0 2-.9 2-2V5c0-1.11-.89-2-2-2zm0 5h-2V5h2v3zM4 19h16v2H4z'/%3E%3C/svg%3E") center / contain no-repeat;
  vertical-align: middle;
}

@media (max-width: 600px) {
  .burger-panel {
    top: 64px;
    right: 0;
    left: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    min-width: 0;
  }
}
