/* Steiermark Audiobook Player — mobile-first, kid-friendly */

:root {
  --bg: #fdf6e3;
  --text: #3e2723;
  --accent: #8d6e63;
  --accent-dark: #5d4037;
  --card-bg: #fff8e1;
  --card-border: #d7ccc8;
  --highlight: #ffcc80;
  --shadow: rgba(62, 39, 35, 0.15);
  --progress-bg: #d7ccc8;
  --progress-fill: #8d6e63;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior-y: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Views */
.view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.view.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

/* Chapter List */
#chapter-list header {
  padding: 2rem 1.5rem 1rem;
  text-align: center;
}

#chapter-list h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent-dark);
}

.subtitle {
  font-size: 1.1rem;
  color: var(--accent);
  margin-top: 0.25rem;
}

.chapters {
  flex: 1;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.chapter-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 1rem;
  box-shadow: 0 4px 12px var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
  width: 100%;
  overflow: hidden;
}

.chapter-thumb {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border-radius: 0.75rem;
  display: block;
  flex-shrink: 0;
}

.chapter-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.chapter-card:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px var(--shadow);
}

.chapter-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  background: var(--accent-dark);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}

.chapter-title {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.chapter-time {
  font-size: 0.8rem;
  color: var(--accent);
  flex-shrink: 0;
}

footer {
  padding: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--accent);
  opacity: 0.7;
}

/* Player */
.player-header {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  gap: 0.5rem;
  min-height: 3.5rem;
}

.player-title-wrap {
  flex: 1;
  text-align: center;
  overflow: hidden;
}

.player-title-wrap h2 {
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.player-subtitle {
  font-size: 0.8rem;
  color: var(--accent);
}

.spacer {
  width: 2.5rem;
}

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  fill: var(--accent-dark);
}

.icon-btn:active {
  background: var(--card-border);
}

.player-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 1.5rem 1.5rem 2.5rem;
  gap: 1.5rem;
}

.cover-art {
  width: min(78vw, 18rem);
  height: min(78vw, 18rem);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--card-bg), var(--highlight));
  border-radius: 1.25rem;
  box-shadow: 0 8px 24px var(--shadow);
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.9);
}

.cover-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.controls {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: none;
  background: none;
  cursor: pointer;
  fill: var(--accent-dark);
  padding: 0.5rem;
}

.ctrl-btn:not(.play) {
  width: 3.5rem;
  height: 3.5rem;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 50%;
}

.ctrl-btn svg {
  transition: transform 0.1s ease;
}

.ctrl-btn:active svg {
  transform: scale(0.9);
}

.ctrl-btn.play {
  background: var(--accent-dark);
  border-radius: 50%;
  width: 5rem;
  height: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px var(--shadow);
}

.ctrl-btn.play svg {
  fill: var(--bg);
}

.ctrl-label {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 500;
}

/* Progress */
.progress-area {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#current-time, #duration {
  font-size: 0.8rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
  text-align: center;
}

#progress-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 0.5rem;
  border-radius: 0.25rem;
  background: var(--progress-bg);
  outline: none;
}

#progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--progress-fill);
  cursor: pointer;
  box-shadow: 0 2px 6px var(--shadow);
}

#progress-slider::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--progress-fill);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px var(--shadow);
}
