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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #2a2a44;
  color: #e0e0e0;
  min-height: 100vh;
}

header {
  padding: 0.5rem 1.5rem;
  background: #16162a;
  border-bottom: 1px solid #2a2a4a;
  display: flex;
  align-items: center;
  gap: 1rem;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #c9b8ff;
  white-space: nowrap;
}

#url-form {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

#url-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #3a3a5c;
  border-radius: 0;
  background: #222244;
  color: #e0e0e0;
  outline: none;
  font-size: 0.85rem;
}

#url-input:focus {
  border-color: #9b7aff;
}

#url-form button {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  border-radius: 0;
  background: #7c5cbf;
  color: #fff;
  cursor: pointer;
}

#url-form button:hover {
  background: #6a4aad;
}

#url-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#copy-link {
  background: #3a3a5c;
}

#copy-link:hover {
  background: #4a4a6c;
}

main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0;
  height: calc(100vh - 3.5rem);
}

#player-container {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#player-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
}

#player-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

#player-container {
  overflow-y: auto;
}

#video-info {
  padding: 1rem 0 0;
}

#video-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e0d8f0;
  margin-bottom: 0.25rem;
}

#video-author {
  font-size: 0.85rem;
  color: #9b8abf;
  margin-bottom: 0.75rem;
}

#video-description {
  font-size: 0.85rem;
  color: #8a8aaa;
  line-height: 1.5;
  white-space: pre-line;
}

#transcript-container {
  padding: 1rem 1rem 1rem 0;
  overflow-y: auto;
  height: calc(100vh - 3.5rem);
}

#transcript-loading {
  color: #888;
  padding: 1rem;
}

.segment {
  padding: 0.5rem 0.75rem;
  margin-bottom: 2px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.5;
  font-size: 0.95rem;
  color: #6a6a8a;
  transition: color 0.2s, background 0.2s;
}

.segment:hover {
  background: #222244;
  color: #a0a0c0;
}

.segment.active {
  background: #2e2854;
  color: #ede6ff;
}

.segment.active .segment-time {
  color: #b8a0ff;
}

.segment-time {
  font-size: 0.75rem;
  color: #4a4a6a;
  margin-right: 0.5rem;
  font-variant-numeric: tabular-nums;
}

#error {
  margin: 1rem 1.5rem;
  padding: 0.75rem 1rem;
  background: #3d1f2e;
  color: #f5a0b0;
  border-radius: 6px;
}

footer {
  position: fixed;
  bottom: 0.75rem;
  left: 1rem;
  font-size: 0.75rem;
  color: #4a4a6a;
}

.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
  }

  #transcript-container {
    padding: 1rem;
    height: 50vh;
  }
}
