/* ── Terminal Player (iOS-style) ── */
.term-player {
  --tp-bg: #1c1c1e;
  --tp-titlebar: #2c2c2e;
  --tp-tab-bg: #1c1c1e;
  --tp-tab-active: #3a3a3c;
  --tp-tab-text: #98989d;
  --tp-tab-active-text: #fff;
  --tp-text: #e5e5e7;
  --tp-cursor: #fff;
  --tp-prompt: #32d74b;
  --tp-radius: 0.75rem;
  --tp-font: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;

  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  border-radius: var(--tp-radius);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.06);
  font-family: var(--tp-font);
}

/* ── Title bar ── */
.tp-titlebar {
  background: var(--tp-titlebar);
  display: flex;
  align-items: center;
  padding: 0.6rem 0.75rem;
  gap: 0.5rem;
  position: relative;
}

.tp-dots {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.tp-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
}

.tp-dot-close { background: #ff5f57; }
.tp-dot-min   { background: #febc2e; }
.tp-dot-max   { background: #28c840; }

.tp-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--tp-tab-text);
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  line-height: 1;
}

/* ── Tab bar ── */
.tp-tabs {
  background: var(--tp-titlebar);
  display: flex;
  padding: 0 0.5rem;
  gap: 0.125rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tp-tabs::-webkit-scrollbar { display: none; }

.tp-tab {
  font-family: var(--tp-font);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--tp-tab-text);
  background: transparent;
  border: none;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  border-radius: 0.375rem 0.375rem 0 0;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.tp-tab:hover {
  color: var(--tp-tab-active-text);
  background: rgba(255,255,255,0.04);
}

.tp-tab.active {
  color: var(--tp-tab-active-text);
  background: var(--tp-tab-active);
}

.tp-tab-short { display: none; }

/* ── Screen ── */
.tp-screen {
  background: var(--tp-bg);
  padding: 0.75rem 1rem;
  height: 320px;
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #48484a transparent;
}

.tp-screen::-webkit-scrollbar { width: 6px; }
.tp-screen::-webkit-scrollbar-track { background: transparent; }
.tp-screen::-webkit-scrollbar-thumb {
  background: #48484a;
  border-radius: 3px;
}

.tp-lines {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--tp-text);
  white-space: pre-wrap;
  word-break: break-all;
}

.tp-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.15em;
  background: var(--tp-cursor);
  vertical-align: text-bottom;
  animation: tp-blink 2s step-end infinite;
}

@keyframes tp-blink {
  50% { opacity: 0; }
}

.tp-title-logo {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

.tp-prompt-text { color: var(--tp-prompt); }
.tp-cmd-text { color: var(--tp-text); }
.tp-output-text { color: #a1a1a6; }
.tp-url-text { color: #64d2ff; }
.tp-bold { font-weight: 700; }
.tp-dim { opacity: 0.6; }

/* ── Controls ── */
.tp-controls {
  background: var(--tp-titlebar);
  display: flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  gap: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.tp-btn {
  font-family: var(--tp-font);
  background: none;
  border: none;
  color: var(--tp-tab-text);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: color 0.15s, background 0.15s;
}

.tp-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.tp-btn svg {
  width: 1rem;
  height: 1rem;
}

.tp-progress {
  flex: 1;
  height: 3px;
  background: #3a3a3c;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.tp-progress-fill {
  height: 100%;
  background: #636366;
  border-radius: 2px;
  transition: width 0.1s linear;
}

.tp-progress:hover .tp-progress-fill {
  background: #86868b;
}

.tp-time {
  font-size: 0.65rem;
  color: var(--tp-tab-text);
  min-width: 2.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .term-player {
    border-radius: 0.5rem;
  }

  .tp-screen {
    height: 280px;
    padding: 0.5rem 0.75rem;
  }

  .tp-lines {
    font-size: 0.68rem;
  }

  .tp-tab-full { display: none; }
  .tp-tab-short { display: inline; }
}
