:root {
  color-scheme: dark;
  --launcher-bg: #272a37;
  --launcher-line: #3a3f51;
  --accent: #3099f5;
  --lite: #0d1b36;
  --prime: #1e2131;
  --pro: #071122;
  --frame-line: #3d465c;
  --text: #ffffff;
  --muted: #b7c0d8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #171a24;
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition: background-color 120ms ease, filter 120ms ease, transform 120ms ease, box-shadow 120ms ease;
  touch-action: manipulation;
  user-select: none;
}

button:not(:disabled):active {
  filter: brightness(0.82);
  transform: translateY(2px);
}

.launcher-plan-button:not(:disabled):active,
.start-trade-button:not(:disabled):active,
.call-button:not(:disabled):active,
.put-button:not(:disabled):active,
#stopButton:not(:disabled):active,
#pauseResumeButton:not(:disabled):active,
.instruction-actions button:not(:disabled):active,
.legacy-dialog-actions button:not(:disabled):active,
.status-window button:not(:disabled):active,
.launcher-close-button:not(:disabled):active,
.startup-close-button:not(:disabled):active {
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.38);
}

.auth-screen,
.launcher-screen,
.startup-screen,
.desktop-stage {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.web-auth {
  background: var(--launcher-bg);
  border: 1px solid var(--launcher-line);
  display: grid;
  gap: 14px;
  padding: 25px 28px;
  width: 360px;
}

.web-auth h1 {
  color: #ffffff;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  text-align: center;
}

.web-auth label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 6px;
}

.web-auth input,
.web-auth select {
  background: #f8fafc;
  border: 1px solid #b8c2d1;
  color: #111827;
  min-height: 36px;
  padding: 4px 10px;
  width: 100%;
}

.auth-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-top: 6px;
}

.auth-actions button {
  background: #3c435e;
  color: #ffffff;
  font-weight: 700;
  min-height: 38px;
}

.auth-actions button:hover:not(:disabled) {
  background: #566080;
}

.auth-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
  min-height: 36px;
  text-align: center;
}

.launcher-window {
  background: var(--launcher-bg);
  border: 1px solid var(--launcher-line);
  min-height: 265px;
  padding: 25px 28px;
  position: relative;
  text-align: center;
  width: 330px;
}

.launcher-window h1 {
  color: #ffffff;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 22px;
}

.launcher-buttons {
  display: grid;
  gap: 16px;
}

.launcher-plan-button {
  color: #ffffff;
  font-size: 16px;
  min-height: 40px;
  width: 100%;
}

.launcher-plan-lite:hover:not(:disabled) {
  background: #0e5e75;
}

.launcher-plan-prime:hover:not(:disabled) {
  background: #004a99;
}

.launcher-plan-pro:hover:not(:disabled) {
  background: #a72431;
}

.launcher-window.is-locked .launcher-plan-button,
.launcher-plan-button:disabled {
  cursor: default;
  filter: grayscale(0.35);
  opacity: 0.55;
}

.launcher-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 16px 0 0;
  min-height: 36px;
}

.launcher-plan-lite {
  background: #1483a3;
}

.launcher-plan-prime {
  background: #0069d7;
}

.launcher-plan-pro {
  background: #dc3545;
}

.startup-window {
  background: var(--launcher-bg);
  border: 1px solid var(--launcher-line);
  min-height: 170px;
  padding: 20px 28px;
  position: relative;
  text-align: center;
  width: 360px;
}

.launcher-close-button,
.startup-close-button {
  background: transparent;
  color: #ffffff;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  height: 24px;
  line-height: 24px;
  position: absolute;
  right: 5px;
  top: 4px;
  width: 24px;
}

.launcher-close-button:hover,
.startup-close-button:hover {
  background: #4c5677;
}

.startup-window h1 {
  color: #ffffff;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 14px;
}

.startup-progress {
  accent-color: var(--accent);
  height: 10px;
  width: 250px;
}

.startup-percent,
.startup-window p {
  color: #ffffff;
  font-size: 14px;
  margin-top: 6px;
}

.startup-window p {
  color: #dbe5f0;
  font-size: 13px;
}

.instruction-modal {
  align-items: center;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 20;
}

.instruction-window {
  background: #525561 url("/dewbot_images/image_bg.png") center / cover no-repeat;
  height: 450px;
  position: relative;
  width: 600px;
}

.instruction-content {
  background: #272a37;
  left: 50%;
  padding-top: 10px;
  position: absolute;
  top: 43%;
  transform: translate(-50%, -50%);
  width: 560px;
}

.instruction-content h2 {
  color: #ffffff;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  text-align: center;
}

.instruction-text {
  background: #272a37;
  color: #ffffff;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  height: 190px;
  line-height: 1.45;
  margin: 0 auto 15px;
  overflow: hidden;
  padding: 0 8px;
  white-space: pre-line;
  width: 520px;
}

.instruction-checkbox {
  align-items: center;
  background: #272a37;
  color: #ffffff;
  display: flex;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  gap: 6px;
  left: 50%;
  padding: 5px 8px;
  position: absolute;
  top: 75%;
  transform: translate(-50%, -50%);
}

.instruction-checkbox input {
  accent-color: var(--accent);
  min-height: auto;
  padding: 0;
  width: auto;
}

.instruction-actions {
  background: #272a37;
  display: flex;
  gap: 10px;
  left: 50%;
  padding: 0;
  position: absolute;
  top: 87%;
  transform: translate(-50%, -50%);
}

.instruction-actions button {
  background: #3c435e;
  color: #ffffff;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  min-height: 36px;
  width: 130px;
}

.instruction-actions button:hover:not(:disabled) {
  background: #566080;
}

.desktop-stage {
  align-items: flex-start;
  gap: 18px;
  padding-top: 3px;
}

.sr-only {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

.trading-window {
  background: var(--pro);
  border: 2px solid var(--frame-line);
  max-height: calc(100vh - 48px);
  min-height: min(552px, calc(100vh - 48px));
  overflow-y: auto;
  padding: 10px 5px 8px;
  scrollbar-color: #4c5f82 #101b31;
  scrollbar-width: thin;
  width: 360px;
}

.trading-window::-webkit-scrollbar {
  width: 8px;
}

.trading-window::-webkit-scrollbar-track {
  background: #101b31;
}

.trading-window::-webkit-scrollbar-thumb {
  background: #4c5f82;
}

.trading-window-lite {
  background: var(--lite);
  min-height: min(470px, calc(100vh - 48px));
  width: 355px;
}

.trading-window-prime {
  background: var(--prime);
  min-height: min(495px, calc(100vh - 48px));
  width: 355px;
}

.trading-window-pro {
  background: var(--pro);
  min-height: min(552px, calc(100vh - 48px));
  width: 360px;
}

.gui-header {
  align-items: center;
  display: flex;
  justify-content: center;
  margin: 0 auto 5px;
  padding: 5px;
}

.gui-header img {
  height: 35px;
  margin-right: 5px;
  width: 35px;
}

.gui-header h1 {
  color: #ffffff;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  font-weight: 700;
  margin: 5px 0 0;
}

.gui-separator {
  background: var(--accent);
  height: 1px;
  margin: 0 auto 8px;
  width: 170px;
}

.mode-radios {
  border: 0;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 8px 0 3px;
}

.mode-radios label {
  align-items: center;
  color: #ffffff;
  display: flex;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  gap: 5px;
  margin: 0 10px;
}

.mode-radios input,
.disable-martingale-row input,
.custom-time-toggle input {
  accent-color: var(--accent);
}

.gui-panel {
  border: 1px solid var(--frame-line);
  margin: 5px auto;
  width: calc(100% - 10px);
}

.parameters-frame {
  padding: 8px 10px 6px;
}

.martingale-frame {
  margin-top: 7px;
  padding: 5px 10px;
}

.gui-row,
.martingale-row label,
.custom-time-fields label {
  align-items: center;
  display: grid;
  grid-template-columns: 18ch minmax(0, 1fr);
  min-height: 30px;
}

.gui-row span,
.martingale-row span,
.custom-time-fields span {
  color: #ffffff;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.martingale-row {
  align-items: center;
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 8px;
  min-height: 34px;
}

.martingale-row label {
  grid-template-columns: 18ch 62px;
}

input,
select {
  background: #ffffff;
  border: 1px solid #9da8b8;
  color: #111827;
  min-height: 24px;
  padding: 1px 5px;
  text-align: center;
  width: 100%;
}

select {
  text-align: left;
}

.custom-time-fields {
  display: grid;
  gap: 2px;
  margin-top: 3px;
}

.action-buttons,
.control-buttons {
  display: flex;
  justify-content: center;
}

.action-buttons {
  margin-top: 10px;
}

.control-buttons {
  margin-top: 10px;
}

.start-trade-button,
.call-button,
.put-button {
  color: #ffffff;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-weight: 700;
}

.start-trade-button {
  background: #46b454;
  font-size: 17px;
  min-height: 37px;
  width: 242px;
}

.call-button,
.put-button {
  font-size: 16px;
  min-height: 35px;
  width: 121px;
}

.call-button {
  background: #46b454;
  margin-right: 6px;
}

.start-trade-button:hover:not(:disabled),
.call-button:hover:not(:disabled) {
  background: #32883f;
}

.put-button {
  background: #a51c18;
  margin-left: 6px;
}

.put-button:hover:not(:disabled) {
  background: #781310;
}

#stopButton,
#pauseResumeButton {
  color: #1b1e2b;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  min-height: 35px;
}

#stopButton {
  background: #ffa500;
  margin-right: 5px;
  width: 88px;
}

#stopButton:hover:not(:disabled) {
  background: #ffc24d;
}

#pauseResumeButton {
  background: #cae4ff;
  margin-left: 5px;
  width: 150px;
}

#pauseResumeButton:hover:not(:disabled) {
  background: #eff7ff;
}

button:disabled {
  cursor: default;
  filter: grayscale(0.4);
  opacity: 0.55;
}

.usage-tips {
  align-items: center;
  color: #ffffff;
  display: flex;
  flex-wrap: wrap;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  justify-content: center;
  margin-top: 9px;
}

.usage-tips a {
  color: #4a89e6;
  margin-left: 4px;
  text-decoration: underline;
}

.usage-tips .broker-link {
  background: #263a5f;
  border: 1px solid #3f5f96;
  color: #ffffff;
  flex-basis: calc(100% - 56px);
  margin: 0 28px 8px;
  min-height: 30px;
  padding: 5px 8px;
  text-align: center;
  text-decoration: none;
}

.usage-tips .broker-link:hover {
  background: #385c96;
}

.usage-tips small {
  color: var(--muted);
  flex-basis: 100%;
  font-size: 13px;
  margin-top: 4px;
  text-align: center;
}

.legacy-modal {
  align-items: center;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 10;
}

.legacy-dialog {
  background: #272a37;
  border: 4px solid #525561;
  box-sizing: border-box;
  color: #ffffff;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  max-width: 420px;
  padding: 18px 22px;
  width: calc(100% - 32px);
}

.legacy-dialog strong {
  color: #ff8a80;
  display: block;
  font-size: 15px;
  margin-bottom: 8px;
}

.legacy-dialog p {
  color: #ffffff;
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 12px;
}

.legacy-dialog-actions {
  display: grid;
  gap: 6px;
}

.legacy-dialog-actions button {
  background: #3c435e;
  border: 0;
  color: #3099f5;
  font-weight: 700;
  min-height: 30px;
}

.legacy-dialog-actions button:hover:not(:disabled) {
  background: #566080;
}

.status-modal {
  align-items: center;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 30;
}

.status-window {
  background: #525561 url("/dewbot_images/image_bg.png") center / cover no-repeat;
  height: 200px;
  padding: 10px;
  width: 400px;
}

.status-window-content {
  align-items: center;
  background: #272a37;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  padding: 10px 18px 15px;
  text-align: center;
}

.status-window h2 {
  color: var(--accent);
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 23px;
  font-weight: 700;
  margin: 0 0 8px;
}

.status-window p {
  color: #ffffff;
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  margin: 3px 0;
}

.status-window button {
  background: #3c435e;
  color: var(--accent);
  font-family: "Yu Gothic UI", "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  margin-top: 15px;
  min-height: 32px;
  width: 130px;
}

.status-window button:hover:not(:disabled) {
  background: #566080;
}

@media (max-width: 900px) {
  .desktop-stage {
    align-items: center;
    flex-direction: column;
  }

}

@media (max-width: 390px) {
  .auth-screen,
  .launcher-screen,
  .startup-screen,
  .desktop-stage {
    padding: 12px;
  }

  .web-auth,
  .launcher-window,
  .startup-window,
  .instruction-window,
  .status-window,
  .trading-window {
    width: 100%;
  }

  .instruction-window {
    height: 450px;
    max-width: 600px;
  }

  .instruction-content {
    width: calc(100% - 28px);
  }

  .instruction-text {
    width: calc(100% - 24px);
  }

  .gui-row,
  .martingale-row label,
  .custom-time-fields label {
    grid-template-columns: 16ch minmax(0, 1fr);
  }
}
