* {
  box-sizing: border-box;
}

:root {
  --desktop-pad: 14px;
  --ui-scale: 1.5;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Tahoma, Verdana, sans-serif;
  color: #000;
  background: linear-gradient(180deg, #3d7bd7 0%, #2f5fae 100%);
}

.desktop {
  padding: var(--desktop-pad);
  min-height: 100vh;
  min-height: 100dvh;
}

.window {
  width: 100%;
  min-height: calc(100vh - (var(--desktop-pad) * 2));
  min-height: calc(100dvh - (var(--desktop-pad) * 2));
  margin: 0 auto;
  border: 1px solid #1f3b74;
  background: #ece9d8;
  box-shadow: 2px 2px 0 #1c3569;
  display: flex;
  flex-direction: column;
}

.titlebar {
  height: 30px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  background: linear-gradient(180deg, #0058ee 0%, #2b79eb 50%, #1157c3 100%);
  border-bottom: 1px solid #143d84;
  gap: 8px;
}

.titlebar span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.window-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #fff;
  background: linear-gradient(180deg, #ff8c76 0%, #d84a27 100%);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  cursor: default;
}

.content {
  padding: 12px;
  flex: 1;
  display: flex;
  overflow: visible;
}

.content-scale {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0 auto;
  zoom: var(--ui-scale);
}

.alertbox {
  border: 1px solid #7f9db9;
  background: #fff7cc;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.alertbox a {
  color: #003c74;
  font-weight: 700;
}

.alertbox-error {
  border: 1px solid #a52727;
  background: #ffd9d9;
  color: #670000;
}

.alertbox-error a {
  color: #670000;
}

.alert-close {
  width: 24px;
  min-width: 24px;
  height: 22px;
  padding: 0;
}

.alertbox.is-hidden {
  display: none;
}

.intro {
  margin: 0;
  font-size: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

label {
  font-size: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #7f9db9;
  background: #fff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

input {
  height: 25px;
  padding: 2px 6px;
}

button {
  height: 25px;
  padding: 0 10px;
  border: 1px solid #003c74;
  background: linear-gradient(180deg, #fefefe 0%, #d8e6f5 100%);
  font-family: Tahoma, Verdana, sans-serif;
  font-size: 12px;
  cursor: pointer;
}

button:active {
  background: linear-gradient(180deg, #d8e6f5 0%, #fefefe 100%);
}

.panel {
  border: 1px solid #b7b7b7;
  padding: 8px;
  background: #f6f4e8;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-head {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

textarea {
  min-height: 220px;
  flex: 1;
  resize: vertical;
  padding: 6px;
}

.secondary {
  min-width: 58px;
}

.output-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  flex: 1;
  align-items: stretch;
  min-height: 220px;
}

@media (min-width: 900px) {
  .output-grid {
    grid-template-columns: 1fr 1fr;
  }

  textarea {
    min-height: 260px;
  }
}

@media (min-width: 1440px) {
  :root {
    --ui-scale: 1.58;
  }
}

@media (min-width: 1920px) {
  :root {
    --ui-scale: 1.66;
  }
}

@media (max-width: 700px) {
  :root {
    --desktop-pad: 10px;
    --ui-scale: 1;
  }

  .desktop {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .content {
    overflow: visible;
  }

  .content-scale {
    width: 100%;
    zoom: 1;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  button,
  input {
    width: 100%;
    min-height: 32px;
  }

  textarea {
    min-height: 180px;
    flex: none;
  }

  .window-btn {
    min-height: 22px;
    width: 24px;
  }

  .panel-head {
    gap: 6px;
    flex-wrap: wrap;
  }
}
