:root {
  --bg: #0e1117;
  --panel: #161b22;
  --panel-2: #1c232d;
  --border: #2a3240;
  --text: #e6edf3;
  --muted: #8b97a8;
  --accent: #ff2d55;
  --accent-2: #ff9500;
  --ok: #27c93f;
  --warn: #ffb020;
  --bad: #ff3b30;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  min-height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #11151d, var(--bg));
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.3px;
}

.header-left .sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555;
  box-shadow: 0 0 8px #555;
}
.dot.online  { background: var(--ok);   box-shadow: 0 0 10px var(--ok); }
.dot.offline { background: var(--bad);  box-shadow: 0 0 10px var(--bad); }
.dot.connecting {
  background: var(--warn); box-shadow: 0 0 10px var(--warn);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

main {
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 20px 60px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.controls label {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

select, input[type="text"], button {
  font: inherit;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  outline: none;
}

select:focus, input[type="text"]:focus {
  border-color: var(--accent);
}

button {
  cursor: pointer;
  transition: 0.15s background-color, 0.15s border-color;
}
button:hover {
  border-color: var(--accent);
  background: #212a36;
}

.hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  margin-top: 18px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 50%, #151c26 0%, #0b0f15 80%);
  cursor: crosshair;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  transition: aspect-ratio 0.2s ease;
}

.screen:active { border-color: var(--accent); }

.screen-label {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  z-index: 3;
}

#screen-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;   /* aspect экрана задаётся через aspect-ratio по пропорциям картинки */
  display: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 1;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
  z-index: 2;
  padding: 20px;
}

.placeholder code {
  background: var(--panel-2);
  padding: 2px 6px;
  border-radius: 4px;
}

.ripple {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  transform: translate(-50%, -50%);
  animation: rippleAnim 0.7s ease-out forwards;
  pointer-events: none;
  z-index: 4;
}

@keyframes rippleAnim {
  0%   { width: 8px;  height: 8px;  opacity: 0.9; border-width: 3px; }
  100% { width: 120px; height: 120px; opacity: 0;  border-width: 1px; }
}

.advanced {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.advanced summary {
  cursor: pointer;
  user-select: none;
}

.advanced-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.advanced-body input[type="text"] {
  width: 100%;
  max-width: 520px;
}

.advanced-body .buttons {
  display: flex;
  gap: 8px;
}

.hint-small {
  font-size: 12px;
  color: var(--muted);
}

.hint-small code {
  background: var(--panel-2);
  padding: 1px 5px;
  border-radius: 4px;
}

.sent-info {
  font-size: 13px;
  color: var(--muted);
  margin-left: auto;
}
.sent-info.warn { color: var(--warn); }

@media (max-width: 640px) {
  header { padding: 12px 16px; }
  header h1 { font-size: 18px; }
  main { margin: 14px auto; padding: 0 10px 40px; }
  .panel { padding: 16px; }
}
