* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: #b0b0b0;
}

.panel-section {
  background: #151515;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

button {
  background: #1a6b3c;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
}

button:hover {
  background: #1f8148;
}

button:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
}

input,
textarea {
  background: #1a1a1a;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.5rem;
  width: 100%;
  font-family: monospace;
  font-size: 0.8rem;
}

textarea {
  resize: vertical;
  min-height: 3rem;
}

.row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.output {
  background: #0d0d0d;
  border: 1px solid #222;
  border-radius: 4px;
  padding: 0.75rem;
  margin-top: 0.75rem;
  font-family: monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 2rem;
}

.label {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.25rem;
}

.pass {
  color: #4ade80;
}

.fail {
  color: #f87171;
}

#loading {
  text-align: center;
  padding: 2rem;
  color: #888;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.info-tip {
  position: relative;
  cursor: help;
  color: #666;
  font-size: 0.75rem;
}

.info-tip:hover {
  color: #999;
}

.info-tip .info-tip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 0.75rem;
  line-height: 1.4;
  padding: 0.5rem 0.65rem;
  border-radius: 4px;
  border: 1px solid #444;
  width: 220px;
  white-space: normal;
  z-index: 100;
  pointer-events: none;
}

.info-tip:hover .info-tip-text {
  display: block;
}

.dropzone {
  border: 2px dashed #333;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  color: #666;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: #1a6b3c;
  color: #4ade80;
}

.dropzone .file-info {
  color: #e0e0e0;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

hr {
  border: none;
  border-top: 1px solid #2a2a2a;
  margin: 1rem 0;
}

progress {
  width: 100%;
  height: 8px;
  appearance: none;
  border: none;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.5rem;
}

progress::-webkit-progress-bar {
  background: #1a1a1a;
  border-radius: 4px;
}

progress::-webkit-progress-value {
  background: #1a6b3c;
  border-radius: 4px;
}

progress::-moz-progress-bar {
  background: #1a6b3c;
  border-radius: 4px;
}

/* Browser Chrome Bar */
#browser-chrome {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #111;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  position: relative;
}

#gear-btn {
  background: none;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}
#gear-btn:hover { color: #e0e0e0; border-color: #555; background: #1a1a1a; }

.nav-btn {
  background: none;
  border: none;
  color: #777;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem 0.35rem;
  line-height: 1;
  flex-shrink: 0;
  border-radius: 3px;
}
.nav-btn:hover:not(:disabled) { color: #e0e0e0; background: #1a1a1a; }
.nav-btn:disabled { color: #555; cursor: default; opacity: 0.5; }

#gear-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0.75rem;
  z-index: 1000;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  min-width: 220px;
  padding: 0.5rem 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.gear-menu-header {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.gear-menu-sep {
  border: none;
  border-top: 1px solid #2a2a2a;
  margin: 0.25rem 0;
}
.gear-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 1rem;
  background: none;
  border: none;
  color: #ccc;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}
.gear-menu-item:hover { background: #252525; color: #fff; }
.gear-menu-item.active { background: #1a3a2a; color: #4ade80; }
.gear-menu-item:disabled { color: #555; cursor: not-allowed; }
.gear-menu-item:disabled:hover { background: none; }
.gear-menu-icon { width: 1.2em; text-align: center; flex-shrink: 0; }

#chrome-address-bar {
  flex: 1;
  width: auto;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.45rem 0.6rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: #ddd;
  min-width: 0;
}
#chrome-address-bar:focus { outline: none; border-color: #10b981; background: #222; }

#btn-go {
  background: #10b981;
  border: none;
  color: #fff;
  font-weight: bold;
  padding: 0.45rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
}
#btn-go:hover { background: #059669; }

#btn-external-tab {
  background: #f59e0b;
  border: none;
  color: #fff;
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
#btn-external-tab:hover { background: #d97706; }

/* Viewport */
#viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #0a0a0a;
  min-height: 0;
}
.viewport-panel {
  display: none;
  width: 100%;
  height: 100%;
}
.internal-page {
  overflow-y: auto;
  padding: 2rem;
}
.internal-page-content {
  max-width: 800px;
  margin: 0 auto;
}

/* Tab Bar */
#tab-bar {
  display: flex;
  align-items: stretch;
  background: #0d0d0d;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 30px;
  scrollbar-width: none;
}
#tab-bar::-webkit-scrollbar { display: none; }
#tab-list {
  display: flex;
  align-items: stretch;
  min-width: 0;
}
.tab {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.4rem 0.25rem 0.7rem;
  background: #111;
  border-right: 1px solid #1a1a1a;
  cursor: pointer;
  white-space: nowrap;
  max-width: 180px;
  min-width: 40px;
  font-size: 0.72rem;
  color: #777;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  flex-shrink: 0;
}
.tab:hover { background: #1a1a1a; color: #ccc; }
.tab.active {
  background: #0a0a0a;
  color: #e0e0e0;
  border-bottom: 2px solid #10b981;
}
.tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.tab-close {
  background: none;
  border: none;
  color: #555;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 0.15rem;
  line-height: 1;
  flex-shrink: 0;
  border-radius: 3px;
}
.tab-close:hover { color: #ef4444; background: rgba(239,68,68,0.15); }
#tab-new {
  background: none;
  border: none;
  border-right: 1px solid #1a1a1a;
  color: #555;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.7rem;
  flex-shrink: 0;
}
#tab-new:hover { color: #10b981; background: #1a1a1a; }

/* Status Bar */
#status-bar {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  background: #111;
  border-top: 1px solid #222;
  font-size: 0.75rem;
  color: #666;
  font-family: monospace;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
#status-bar .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
}
#status-bar .status-dot.connected { background: #4ade80; }

/* History items (used in history panel) */
.history-item {
  font-size: 0.75rem;
  padding: 0.4rem;
  margin-bottom: 0.25rem;
  background: #151515;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-item:hover {
  background: #1a1a1a;
}

.history-item.active {
  background: #1a6b3c;
  border-color: #1f8148;
}

.history-item.downloaded {
  background: #0d3d20;
  border-color: #1a6b3c;
}

.history-item.downloaded:hover {
  background: #114d28;
}

.history-item.active.downloaded {
  background: #1a6b3c;
  border-color: #1f8148;
}

.history-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  cursor: pointer;
}

.history-delete {
  flex-shrink: 0;
}

/* Browser progress bar (thin) */
#browser-progress {
  width: 100%;
  height: 3px;
  flex-shrink: 0;
  display: none;
  margin: 0;
}
#browser-progress::-webkit-progress-bar { background: #0a0a0a; border-radius: 0; }
#browser-progress::-webkit-progress-value { background: #10b981; border-radius: 0; }
#browser-progress::-moz-progress-bar { background: #10b981; border-radius: 0; }

/* Volume slider: custom styling so thumb visually spans the full track.
   The input is widened by thumb-width (12px) with negative margins so the
   thumb center can reach both edges of the visible 80px track. */
.vc-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 92px;
  height: 20px;
  background: transparent;
  outline: none;
  cursor: pointer;
  margin: 0 -2px;
}
.vc-vol-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 9999px;
}
.vc-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  cursor: pointer;
  margin-top: -4px;
}
.vc-vol-slider::-moz-range-track {
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 9999px;
}
.vc-vol-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  border: none;
  cursor: pointer;
}

/* Seek bar */
#vc-seekbar {
  flex: 1;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}
#vc-seek-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  position: relative;
  overflow: visible;
  transition: height 0.15s;
}
#vc-seekbar:hover #vc-seek-track {
  height: 6px;
}
#vc-seek-buffered {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  width: 0%;
}
#vc-seek-played {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: #10b981;
  border-radius: 2px;
  width: 0%;
}
#vc-seek-thumb {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  transform: translate(-50%, -50%);
  left: 0%;
  opacity: 0;
  transition: opacity 0.15s;
}
#vc-seekbar:hover #vc-seek-thumb {
  opacity: 1;
}

/* Registration Wizard */
.wizard-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 0;
}
.wizard-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.wizard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #333;
  transition: background 0.2s;
}
.wizard-dot.active {
  background: #10b981;
}
.wizard-dot.completed {
  background: #1a6b3c;
}
.wizard-step {
  display: none;
}
.wizard-step.active {
  display: block;
}
.wizard-back {
  background: none;
  border: none;
  color: #888;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.wizard-back::before {
  content: '\2190';
}
.wizard-back:hover {
  color: #e0e0e0;
}
.wizard-heading {
  font-size: 1.5rem;
  color: #e0e0e0;
  margin-bottom: 0.5rem;
}
.wizard-subtext {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.wizard-field {
  margin-bottom: 1rem;
}
.wizard-field .label {
  margin-bottom: 0.35rem;
}
.wizard-btn {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.5rem;
}
.wizard-btn:hover {
  background: #059669;
}
.wizard-btn:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
}
.wizard-btn-secondary {
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.wizard-btn-secondary:hover {
  background: #333;
  color: #fff;
}
.wizard-status {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #0d0d0d;
  border: 1px solid #222;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}
.wizard-status:empty {
  display: none;
}
.wizard-link {
  color: #60a5fa;
  word-break: break-all;
}
.wizard-success {
  text-align: center;
  padding: 1rem 0;
}
.wizard-success .wizard-heading {
  color: #4ade80;
}
.wizard-key-display {
  background: #0d0d0d;
  border: 1px solid #222;
  border-radius: 4px;
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 1rem 0;
  text-align: left;
  line-height: 1.6;
}
