:root {
  color-scheme: light;
  --bg: #f2f5f8;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #68758a;
  --line: #dbe3ee;
  --accent: #147a73;
  --accent-dark: #0f5f5a;
  --warn: #9a5b00;
  --error: #b42318;
  --ok: #087443;
  --shadow: 0 22px 60px rgba(25, 36, 58, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(20, 122, 115, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(80, 117, 164, 0.12), transparent 28%),
    var(--bg);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: 100%;
  height: 100%;
  padding: 12px;
}

.player-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid rgba(219, 227, 238, 0.95);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 14px;
}

.player-shell.maximized {
  position: fixed;
  inset: 0;
  z-index: 50;
  border-radius: 0;
  border: 0;
  padding: 10px;
}

.topbar,
.input-row,
.statusbar,
.topbar-actions,
.brand {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
}

.brand {
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), #4b78a8);
  box-shadow: 0 6px 18px rgba(20, 122, 115, 0.28);
  flex: 0 0 auto;
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  gap: 8px;
}

.icon-button,
.primary-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}

.icon-button {
  width: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #f8fbff;
  border-color: var(--line);
  color: #25364d;
  font-size: 19px;
}

.icon-button:hover:not(:disabled) {
  background: #eef5fb;
  border-color: #b9c8da;
}

.icon-button:disabled,
.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.close-button {
  background: #1d2737;
  color: #fff;
  border-color: #1d2737;
}

.input-row {
  gap: 10px;
  min-height: 46px;
}

input {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: 0;
  padding: 0 14px;
}

input:focus {
  border-color: rgba(20, 122, 115, 0.78);
  box-shadow: 0 0 0 3px rgba(20, 122, 115, 0.12);
}

.primary-button {
  min-width: 82px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-dark);
}

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #080d18;
  border: 1px solid #141c2b;
}

iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #080d18;
}

.stage-empty,
.loading-mask {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.stage-empty {
  background:
    linear-gradient(145deg, rgba(20, 122, 115, 0.2), transparent 34%),
    linear-gradient(315deg, rgba(75, 120, 168, 0.18), transparent 30%),
    #080d18;
}

.empty-mark {
  width: min(22vw, 140px);
  aspect-ratio: 16 / 10;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  position: relative;
}

.empty-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-42%, -50%);
  border-left: 26px solid rgba(255, 255, 255, 0.5);
  border-top: 17px solid transparent;
  border-bottom: 17px solid transparent;
}

.loading-mask {
  background: rgba(8, 13, 24, 0.52);
}

.loading-mask span {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.statusbar {
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

#statusText.success {
  color: var(--ok);
}

#statusText.warn {
  color: var(--warn);
}

#statusText.error {
  color: var(--error);
}

#interfaceText {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 8px;
  }

  .player-shell {
    padding: 10px;
    gap: 10px;
  }

  .input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  h1 {
    font-size: 18px;
  }

  .primary-button {
    min-width: 70px;
    padding: 0 14px;
  }
}
