:root{
  --bg:#2b2b2b;
  --panel:#ffffff;
  --muted:#555;
  --accent:#e6e6e6;
  --card-border:#dcdcdc;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background:var(--bg);
  color:#111;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  padding:18px;
}

/* Header controls row */
.site-header{
  margin-bottom:14px;
}
.controls-row{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
}

/* left / mid / right layout */
.left-controls, .mid-controls, .right-controls{
  display:flex;
  align-items:center;
  gap:10px;
}

/* left controls narrower */
.left-controls { flex:0 0 auto; }
.mid-controls { flex:1 1 60%; }
.right-controls { flex:0 0 auto; }

.control-select, .control-search{
  border:1px solid #bdbdbd;
  background:#fff;
  padding:8px 10px;
  border-radius:4px;
  font-size:14px;
  height:36px;
}

/* Make the show select visually like screenshot (rounded small dropdown) */
.control-select#show-select{
  min-width:220px;
  max-width:300px;
  font-weight:600;
}

/* episode select smaller */
.control-select#episode-select{
  min-width:200px;
  max-width:240px;
}

/* search input */
.control-search{
  margin-left:10px;
  flex:1;
  min-width:180px;
}

/* display count to the right */
.display-count{
  background:linear-gradient(#f5f5f5,#ececec);
  padding:10px 14px;
  border-radius:6px;
  border:1px solid #cfcfcf;
  font-size:13px;
  color:#111;
  min-width:170px;
  text-align:center;
}

/* Cards grid */
.cards-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:18px;
  align-items:stretch;
}

/* Card */
.episode-card{
  background:var(--panel);
  border-radius:10px;
  border:1px solid var(--card-border);
  padding:0;
  overflow:hidden;
  box-shadow:0 6px 0 rgba(0,0,0,0.05);
  display:flex;
  flex-direction:column;
  min-height:360px;
  height: 100%;
}

/* Episode card link wrapper */
.episode-link-wrapper {
  text-decoration: none;
  color: inherit;
  display: block;
}

.episode-link-wrapper:hover .episode-card {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

/* Label styling for better visibility */
label {
  color: #ffffff; 
  font-weight: 600;
  font-size: 14px;
}

/* top header (white rounded rectangle with bold center title) */
.card-header{
  background:transparent;
  border-bottom:1px solid transparent;
  padding:16px 12px;
  text-align:center;
  border-radius:10px 10px 0 0;
}

.episode-title{
  font-family: "Oswald", sans-serif;
  font-weight:500;
  margin:0;
  font-size:20px;
  letter-spacing:0.4px;
  padding:6px 8px;
  display:inline-block;
  background:var(--accent);
  border-radius:8px;
  border:1px solid var(--card-border);
  max-width:100%;
  box-shadow:0 1px 0 rgba(0,0,0,0.03) inset;
}

/* card body */
.card-body{
  padding:18px 20px;
  display:flex;
  flex-direction:column;
  gap:12px;
  flex:1 1 auto;
}

/* image */
.episode-image{
  display:block;
  width:100%;
  max-width:220px;
  height:auto;
  margin:8px auto;
  border-radius:4px;
  border:1px solid #ddd;
  box-shadow:0 2px 0 rgba(0,0,0,0.03);
}

/* summary text */
.episode-summary{
  font-size:13px;
  color: #555;
  line-height:1.45;
  text-align:left;
}

/* attribution */
.attribution{
  margin:10px 14px;
  font-size:12px;
  color:#333;
}

/* Footer attribution */
.site-footer {
  text-align: center;
  padding: 20px;
  margin-top: 40px;
  border-top: 1px solid var(--card-border);
  background: #dbeff8;
}

.site-footer p {
  margin: 0;
  font-size: 14px;
  color: #d10404; /* Changed from #666 to red for better visibility */
}

.site-footer a {
  color: #071b24; /* Changed to dark blue for better contrast */
  text-decoration: none;
  font-weight: 600;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* Back to top button */
#back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: #4fc3f7;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
  z-index: 1000;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
}

#back-to-top:hover {
  background: #0288d1;
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

#back-to-top:active {
  transform: translateY(-1px);
}

/* small devices: 1 column, medium: 2 columns */
@media (max-width:1100px){
  .cards-grid{ grid-template-columns:repeat(2,1fr); }
  .control-select#show-select{ min-width:160px; }
}
@media (max-width:680px){
  .controls-row{ flex-direction:column; align-items:stretch; gap:8px; }
  .mid-controls{ order:2; }
  .right-controls{ order:3; justify-content:flex-end; }
  .left-controls{ order:1; }
  .cards-grid{ grid-template-columns:1fr; }
}
