:root {
  --bg: #232323;
  --panel: #292929;
  --panel-dark: #1a1a1a;
  --border-radius: 10px;
  --border: #2e2e2e;
  --gray: #bcbcbc;
  --gray-dark: #888;
  --gray-light: #e5e5e5;
  --white: #f8f8f8;
  --accent: #444;
  --focus: #666;
  --timeline-bg: #222;
  --timeline-cue: #181818;
  --timeline-cursor: #bcbcbc;
  --timeline-height: 90px;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--gray);
  font-family: 'Noto Sans', 'Arial', 'Source Sans Pro', sans-serif;
  box-sizing: border-box;
  padding-bottom: var(--timeline-height);
}

body, .app-root {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

.app-root {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

h1 {
  text-align: center;
  margin: 1.2em 0 0.2em 0;
  font-weight: 700;
  color: var(--gray-light);
  letter-spacing: 1px;
  font-size: 2em;
  text-shadow: 0 2px 8px #0002;
  flex-shrink: 0;
}

.inputs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5em;
  margin: 0 0 1em 0;
  height: 3em;
  flex-wrap: wrap;
  color: var(--gray-dark);
  flex-shrink: 0;
}

label {
  font-weight: 500;
  color: var(--gray-dark);
}

input[type="file"] {
  border: none;
  background: none;
  font-size: 1em;
  color: var(--gray);
}

button, #downloadLink {
  background: var(--panel-dark);
  color: var(--gray-light);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 0.5em 1.1em;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  margin-left: 0.5em;
  transition: background 0.2s, color 0.2s, border 0.2s;
  text-decoration: none;
  display: inline-block;
  box-shadow: none;
}
button:hover, #downloadLink:hover {
  background: var(--accent);
  color: var(--white);
  border: 1px solid var(--gray-dark);
}

.main-container {
  flex: 1 1 auto;
  display: flex;
  gap: 1.5em;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
  height: 0;
  padding-bottom: var(--timeline-height);
  box-sizing: border-box;
}

.video-container {
  flex: 1 1 60%;
  max-width: 800px;
  min-width: 0;
  background: var(--panel);
  border-radius: var(--border-radius);
  box-shadow: 0 1px 4px #0002;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  height: 100%;
  overflow: hidden;
  padding: 1.2em 1em;
}

video {
  width: 100%;
  height: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--border-radius);
  background: #111;
  display: block;
}

.subtitle-container {
  flex: 1 1 40%;
  max-width: 430px;
  min-width: 0;
  max-height: 100%;
  overflow-y: auto;
  background: var(--panel);
  border-radius: var(--border-radius);
  box-shadow: 0 1px 4px #0002;
  padding: 1.2em 1em;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-dark) var(--panel-dark);
}

.subtitle-container::-webkit-scrollbar {
  width: 8px;
}
.subtitle-container::-webkit-scrollbar-thumb {
  background: var(--gray-dark);
  border-radius: 8px;
}
.subtitle-container::-webkit-scrollbar-track {
  background: var(--panel-dark);
  border-radius: 8px;
}

#subtitleList {
  width: 100%;
}

.subtitle-row {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  margin-bottom: 0.8em;
  background: var(--panel-dark);
  border-radius: 8px;
  padding: 0.7em 0.7em 0.5em 0.7em;
  box-shadow: 0 1px 2px #0002;
  transition: box-shadow 0.15s, background 0.2s;
  color: var(--gray);
  min-width: 0;
}

.subtitle-row:focus-within {
  box-shadow: 0 2px 8px var(--gray-dark);
}

.subtitle-times {
  display: flex;
  gap: 1em;
  margin-bottom: 0.3em;
  flex-wrap: wrap;
  align-items: center;
}

.subtitle-row input[type="text"] {
  width: 6em;
  padding: 0.2em 0.4em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--gray-light);
  font-size: 1em;
  transition: border 0.2s;
  margin-right: 0.5em;
}
.subtitle-row input[type="text"]:focus {
  border: 1.5px solid var(--focus);
  outline: none;
}

.subtitle-row textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 2.1em;
  min-height: 2em;
  padding: 0.4em 0.6em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--gray-light);
  font-size: 1em;
  resize: vertical;
  transition: border 0.2s;
  margin-bottom: 0.2em;
}
.subtitle-row textarea:focus {
  border: 1.5px solid var(--focus);
  outline: none;
}

.subtitle-row button {
  background: transparent;
  color: var(--gray-dark);
  border: 1px solid var(--gray-dark);
  border-radius: 6px;
  padding: 0.3em 0.8em;
  font-size: 0.95em;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.2em;
  align-self: flex-end;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
.subtitle-row button:hover {
  background: var(--gray-dark);
  color: var(--panel-dark);
  border: 1px solid var(--gray-dark);
}

.subtitle-row.highlighted {
  background: #181818;
  box-shadow: 0 2px 8px var(--gray-dark);
}

.subtitle-row.current {
  background: #151515 !important;
  box-shadow: 0 2px 8px var(--gray-dark);
  color: var(--gray-light);
  border-left: 3px solid var(--gray-dark);
}

.timeline-container {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100vw;
  background: var(--timeline-bg);
  box-shadow: 0 -2px 12px #0002;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--timeline-height);
  border-radius: 0 0 16px 16px;
  z-index: 10;
}

#timeline {
  width: 92vw;
  max-width: 1200px;
  height: 90px;
  background: var(--timeline-bg);
  border-radius: 8px;
  box-shadow: 0 1px 4px #0002;
  margin: 0.5em 0;
  display: block;
}

@media (max-width: 900px) {
  .main-container {
    flex-direction: column;
    gap: 1.2em;
    height: 0;
    padding: 0 1em;
  }
  .video-container, .subtitle-container {
    max-width: 100%;
    height: 50vh;
  }
  .subtitle-row textarea {
    width: 100%;
  }
}
