:root {
  --st-border-color: #3e4451;
  --st-code-background-color: #1e2127;
  --st-code-text-color: #abb2bf;
  --st-secondary-background-color: #21252b;
  --st-text-color: #abb2bf;
  --st-primary-color: #98c379;
  --st-green-color: #98c379;
  --st-green-text-color: #d7f5c8;
  --st-green-background-color: #2c3b2e;
  --st-red-color: #e06c75;
  --st-red-background-color: #4a2c31;
  --st-yellow-color: #e5c07b;
  --st-yellow-background-color: #3d3420;
  --st-font: "IBM Plex Sans", sans-serif;
  --st-code-font: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
  background: #282c34;
  color: var(--st-text-color);
  font-family: var(--st-font);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
}

.top, main {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.top { padding: 28px 0 8px; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
  width: fit-content;
}

.brand img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

.brand strong {
  display: block;
  font-size: 28px;
  color: #e6e9ef;
}

.brand small {
  color: #98c379;
  font-size: 14px;
}

.top p, .meta, #note {
  line-height: 1.5;
}

.upload, .controls, .actions {
  margin: 14px 0;
}

.upload input, button {
  font: inherit;
  color: inherit;
}

.controls, .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.group span {
  width: 100%;
  font-size: 14px;
}

button, .upload input {
  background: #21252b;
  border: 1px solid var(--st-border-color);
  border-radius: 6px;
  padding: 8px 12px;
}

button.on, button.primary {
  background: #98c379;
  color: #1b1f2a;
  border-color: #98c379;
  font-weight: 600;
}

button:disabled { opacity: 0.45; }

.meta strong {
  font-size: 32px;
  display: block;
  color: #e6e9ef;
}

#filename { margin-left: 12px; }

#root {
  height: 540px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--st-border-color);
  border-radius: 6px;
  background: var(--st-code-background-color);
  color: var(--st-code-text-color);
}

#status {
  min-height: 44px;
  padding: 10px 14px;
  background: var(--st-secondary-background-color);
  border-bottom: 1px solid var(--st-border-color);
}

#track { height: 4px; background: var(--st-border-color); }
#bar { height: 100%; width: 0; background: var(--st-green-color); transition: width 0.25s ease; }

#page {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 0 24px;
}

#lines {
  font-family: var(--st-code-font);
  font-size: 14px;
  line-height: 1.7;
}

.row { display: flex; min-height: 1.7em; padding-right: 16px; }
.row.active { background: color-mix(in srgb, var(--st-primary-color) 16%, transparent); }
.gutter {
  width: 52px;
  padding-right: 10px;
  text-align: right;
  color: color-mix(in srgb, var(--st-text-color) 45%, transparent);
  user-select: none;
}
.code { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.7em; }
.word { border-radius: 4px; padding: 0 2px; }
.word.bad {
  color: var(--st-red-color);
  background: var(--st-red-background-color);
  text-decoration: underline wavy var(--st-red-color);
  text-underline-offset: 3px;
}
.word.fixing {
  outline: 2px solid var(--st-yellow-color);
  background: var(--st-yellow-background-color);
  color: var(--st-yellow-color);
}
.word.good {
  color: var(--st-green-text-color);
  background: var(--st-green-background-color);
  animation: pop 0.35s ease;
}
@keyframes pop { from { transform: scale(1.18); } to { transform: scale(1); } }

#creature {
  position: absolute;
  left: 0;
  top: 0;
  width: 92px;
  height: 68px;
  z-index: 6;
  pointer-events: none;
  transition: transform 0.72s cubic-bezier(0.22, 0.8, 0.2, 1);
  filter: drop-shadow(0 8px 5px rgba(0, 0, 0, 0.5));
}
#bug { width: 92px; height: 68px; }
#creature.walking #bug { animation: hop 0.16s ease-in-out infinite alternate; }
#creature.walking .leg {
  transform-box: fill-box;
  transform-origin: center;
  animation: kick 0.16s ease-in-out infinite alternate;
}
#creature.walking .leg:nth-child(odd) { animation-delay: 0.08s; }
@keyframes hop { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@keyframes kick { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }

#list table { width: 100%; border-collapse: collapse; margin-top: 8px; }
#list td, #list th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--st-border-color);
}

details { min-width: 240px; }
summary { cursor: pointer; }
