:root {
  --primary-color: #0056b3;
  --primary-hover: #004494;
  --bg-color: #f8f9fa;
  --surface-color: #ffffff;
  --text-main: #202124;
  --text-muted: #5f6368;
  --border-color: #dadce0;
  --danger-color: #d93025;
  --focus-ring: rgba(0, 86, 179, 0.4);
}

html, body {
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Hiragino Kaku Gothic ProN', 'ヒラギノ角ゴ ProN W3', 'Noto Sans JP', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
}

h1, h2, h3 {
  font-weight: 500;
  letter-spacing: 0.05em;
  margin: 0;
}

.app-header {
  height: 56px;
  background-color: var(--surface-color);
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
}

.app-header h1 {
  font-size: 1.3rem;
  color: var(--primary-color);
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.container {
  display: grid;
  grid-template-columns: 55% 45%;
  gap: 1.25rem;
  padding: 1rem;
  max-width: 1600px;
  height: calc(100vh - 56px);
  margin: 0 auto;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  html, body {
    overflow: auto;
    height: auto;
  }
  .container {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.video-section {
  background: var(--surface-color);
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  height: fit-content;
}

.video-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 48vh;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.controls-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.subtitle-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
}

details.card-accordion {
  background: var(--surface-color);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

#add-accordion {
  position: sticky;
  top: 0;
  z-index: 10; /* リストの上に重なるように設定 */
  background: var(--surface-color);
}

details.list-accordion {
  flex-shrink: 0;
}

summary.accordion-header {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  background-color: var(--surface-color);
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
}

summary.accordion-header::-webkit-details-marker {
  display: none;
}

summary.accordion-header::after {
  content: '▼';
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

details[open] summary.accordion-header::after {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 0.75rem 1rem 1rem 1rem;
  border-top: 1px solid var(--border-color);
}

.list-accordion .accordion-body {
  padding: 0.5rem 1rem 1rem 1rem;
}

.subtitle-list-container {
  padding-right: 0.25rem;
}

button {
  font-family: inherit;
  cursor: pointer;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--surface-color);
  color: var(--text-main);
  font-size: 0.85rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

button:hover {
  background-color: #f1f3f4;
}

button.primary {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  font-weight: bold;
}

button.primary:hover {
  background-color: var(--primary-hover);
}

button.danger {
  color: var(--danger-color);
  border-color: var(--border-color);
}

button:focus, input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary-color);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

input[type="text"], input[type="file"], select, textarea {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  font-size: 0.9rem;
}

label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.subtitle-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.subtitle-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--surface-color);
}

.time-adjust-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
  white-space: nowrap;
}

.time-clickable {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 0.1rem 0.2rem;
  transition: background-color 0.2s;
}

.time-clickable:hover {
  background-color: #e8f0fe;
  color: var(--primary-color);
}

.time-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  width: 36px;
  flex-shrink: 0;
}

.time-val {
  font-variant-numeric: tabular-nums;
  font-weight: bold;
  font-size: 0.85rem;
  width: 105px;
  flex-shrink: 0;
}

.time-adjust-group button {
  padding: 0.15rem 0.35rem;
  font-size: 0.75rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

textarea.sub-text {
  resize: vertical;
  min-height: 44px;
}