:root {
  --ink: #24292d;
  --muted: #4d545b;
  --line: rgba(77, 84, 91, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background: #e4e8eb;
}

footer {
  background: linear-gradient(180deg, #0a90bc 0%, #0a6a8c 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.2);
}

.page-main {
  max-width: 1200px;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding-top: 12px;
  padding-bottom: 12px;
}

.corrector-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  background: #9ea6ad;
  border: 1px solid rgba(77, 84, 91, 0.5);
  box-shadow: 0 0 0 2px rgba(228, 232, 235, 0.9);
}

.status-dot.active {
  background: #2f9f5b;
  border-color: #247c47;
  box-shadow: 0 0 0 2px rgba(228, 232, 235, 0.9), 0 0 8px rgba(47, 159, 91, 0.45);
}

.controls-card {
  margin: 0;
}

.toolbar-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-segment {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(77, 84, 91, 0.5);
  border-radius: 9px;
  overflow: hidden;
  background: #d2d7dc;
}

.lang-segment-btn {
  min-width: 42px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #24292d;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 0 10px;
  position: relative;
}

.lang-segment-btn + .lang-segment-btn {
  border-left: 1px solid rgba(77, 84, 91, 0.45);
}

.lang-segment-btn.active {
  background: #3b434a;
  color: #ffffff;
}

.lang-segment-btn.auto-picked {
  animation: autoPickPulse 0.72s ease-out;
}

.lang-segment-btn.auto-picked::before,
.lang-segment-btn.auto-picked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

.lang-segment-btn.auto-picked::before {
  background: #ffcc33;
  box-shadow:
    -14px -9px 0 #ffcc33,
    13px -10px 0 #0099cc,
    -15px 10px 0 #0099cc,
    14px 9px 0 #ffcc33;
  animation: autoSparkBurst 0.72s ease-out;
}

.lang-segment-btn.auto-picked::after {
  background: rgba(255, 255, 255, 0.95);
  box-shadow:
    -8px -12px 0 rgba(255, 255, 255, 0.9),
    8px 12px 0 rgba(255, 255, 255, 0.9);
  animation: autoSparkBurst 0.72s ease-out 0.06s;
}

@keyframes autoPickPulse {
  0% {
    transform: scale(1);
    box-shadow: inset 0 0 0 0 rgba(0, 153, 204, 0);
  }
  36% {
    transform: scale(1.06);
    box-shadow: inset 0 0 0 1px rgba(0, 153, 204, 0.45);
  }
  100% {
    transform: scale(1);
    box-shadow: inset 0 0 0 0 rgba(0, 153, 204, 0);
  }
}

@keyframes autoSparkBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.28);
  }
  28% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18);
  }
}

.lang-segment-btn:focus-visible {
  outline: 2px solid rgba(0, 153, 204, 0.55);
  outline-offset: -2px;
}

.status-light-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 24px;
  min-height: 24px;
  margin-left: auto;
  transform: translateY(-8px);
}

.status-text {
  font-size: 0.8rem;
  color: #4d545b;
  font-weight: 600;
  line-height: 1;
}

#runCorrect {
  background: #0099cc;
  border-color: #007aa3;
}

#runCorrect .icon-img {
  width: 14px;
  height: 14px;
  filter: brightness(0) saturate(100%) invert(100%);
  opacity: 0.95;
}

#runCorrect:hover {
  background: #007aa3;
  border-color: #00688b;
}

.menu-icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.menu-icon-button:hover {
  background: rgba(0, 153, 204, 0.14);
  transform: translateY(-1px);
}

.menu-icon-button:focus-visible {
  outline: 2px solid rgba(0, 153, 204, 0.55);
  outline-offset: 2px;
}

.menu-icon-button .icon-img {
  width: 22px;
  height: 22px;
  opacity: 0.84;
  transition: filter 0.16s ease, opacity 0.16s ease;
}

.menu-icon-button:hover .icon-img,
.menu-icon-button:focus-visible .icon-img {
  opacity: 1;
  filter: brightness(0) saturate(100%) invert(46%) sepia(99%) saturate(1175%) hue-rotate(164deg) brightness(95%) contrast(101%);
}

.stack {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.editor-input {
  width: 100%;
  background: #ffffff;
  color: var(--ink);
  caret-color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 16px;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.98rem;
  line-height: 1.6;
  min-height: 0;
  height: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

.editor-input:empty::before {
  content: attr(data-placeholder);
  color: #5b6a74;
}

.change {
  background: rgba(196, 61, 43, 0.2);
  color: #c43d2b;
  border-radius: 6px;
  padding: 0 2px;
  cursor: pointer;
}

.flag {
  background: rgba(243, 155, 47, 0.26);
  color: #b85c00;
  border-radius: 6px;
  padding: 0 2px;
}

.reverted {
  background: rgba(0, 153, 204, 0.22);
  color: #007aa3;
  border-radius: 6px;
  padding: 0 2px;
  cursor: pointer;
}

.meta {
  margin-top: auto;
  justify-content: flex-start;
  gap: 12px 24px;
  border-top: 0;
  padding-top: 0;
}

.corrector-options-dialog {
  width: min(280px, calc(100% - 32px));
  max-height: min(72vh, 620px);
}

.corrector-options-dialog .app-modal-body {
  flex: 0 1 auto;
}

.corrector-modal-body {
  display: grid;
  gap: 10px;
}

.corrector-modal-body p {
  margin: 0;
  color: var(--muted);
}

.corrector-modal-body textarea,
.corrector-modal-body input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(77, 84, 91, 0.34);
  background: #ffffff;
  color: var(--ink);
  padding: 9px 10px;
  font-size: 0.9rem;
}

.corrector-modal-body textarea {
  min-height: 110px;
  max-height: 220px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.corrector-modal-body textarea:focus,
.corrector-modal-body input:focus {
  outline: none;
  border-color: #0099cc;
  box-shadow: 0 0 0 1px rgba(0, 153, 204, 0.28);
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 760px) {
  .app-footer-row.meta {
    font-size: 0.78rem;
    gap: 8px 16px;
  }
}
