:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --accent: #ffc600;
  --accent-hover: #e6b200;
  --accent-soft: rgba(255, 198, 0, 0.1);
  --accent-ring: rgba(255, 198, 0, 0.28);
  --border: rgba(15, 20, 25, 0.1);
  --border-strong: rgba(15, 20, 25, 0.16);
  --text: #0f1419;
  --text-secondary: #3d4654;
  --muted: #64748b;
  --background: #e8edf3;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-solid: #ffffff;
  --surface-elevated: rgba(255, 255, 255, 0.78);
  --glass-blur: 22px;
  --glass-border: rgba(255, 255, 255, 0.72);
  --glass-highlight: rgba(255, 255, 255, 0.95);
  --shadow-sm: 0 1px 2px rgba(15, 20, 25, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 20, 25, 0.07);
  --shadow-lg: 0 16px 48px rgba(15, 20, 25, 0.1);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --btn-primary-bg: #141820;
  --btn-primary-hover: #1e2430;
  --brace: #1a8f1a;
  --comment-value: #9333ea;
  --bracket: #2563eb;
  --chord: #ea580c;
  --max-width: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--background);
  background-image:
    radial-gradient(ellipse 70% 55% at 12% -8%, rgba(255, 198, 0, 0.07), transparent 55%),
    radial-gradient(ellipse 55% 45% at 88% 4%, rgba(37, 99, 235, 0.05), transparent 50%),
    linear-gradient(180deg, #eef2f7 0%, #e3e9f0 48%, #dde4ec 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- top logo strip --- */
.site-logo {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 0 24px 32px;
  background: none;
}

.site-logo img {
  width: 188px;
  height: auto;
  max-width: 100%;
  filter: drop-shadow(0 1px 1px rgba(15, 20, 25, 0.06));
}

/* --- hero --- */
header.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 58vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px 64px;
  background: #dfe8f2;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-backdrop-gradient,
.hero-backdrop-mesh,
.hero-backdrop-dots {
  position: absolute;
  inset: 0;
}

.hero-backdrop-gradient {
  background: linear-gradient(
    125deg,
    #eef3f9 0%,
    #c8dcff 18%,
    #fff4cc 36%,
    #ddd0f8 54%,
    #b8d8f5 72%,
    #eef3f9 100%
  );
  background-size: 300% 300%;
  animation: heroGradientFlow 14s ease infinite;
}

.hero-backdrop-mesh {
  background:
    radial-gradient(circle at 15% 25%, rgba(255, 198, 0, 0.28), transparent 42%),
    radial-gradient(circle at 85% 18%, rgba(37, 99, 235, 0.22), transparent 40%),
    radial-gradient(circle at 55% 90%, rgba(147, 51, 234, 0.16), transparent 38%),
    radial-gradient(circle at 72% 58%, rgba(255, 255, 255, 0.65), transparent 45%);
  animation: heroMeshDrift 18s ease-in-out infinite alternate;
}

.hero-backdrop-dots {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Crect x='3' y='3' width='2' height='2' fill='rgba(15,20,25,0.22)'/%3E%3C/svg%3E");
  background-size: 8px 8px;
  image-rendering: pixelated;
  opacity: 0.55;
  mix-blend-mode: multiply;
  mask-image: radial-gradient(ellipse 95% 85% at 50% 45%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 95% 85% at 50% 45%, #000 25%, transparent 78%);
  animation: heroDotsPan 20s linear infinite;
}

@keyframes heroGradientFlow {
  0% {
    background-position: 0% 0%;
  }

  25% {
    background-position: 100% 0%;
  }

  50% {
    background-position: 100% 100%;
  }

  75% {
    background-position: 0% 100%;
  }

  100% {
    background-position: 0% 0%;
  }
}

@keyframes heroMeshDrift {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(6%, -5%) scale(1.12);
  }
}

@keyframes heroDotsPan {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 8px 8px;
  }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 680px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 40px 36px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.hero-title {
  font-size: clamp(2.35rem, 5.5vw, 3.65rem);
  font-weight: 800;
  margin: 0;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--text);
}

.hero-subtitle {
  font-size: clamp(1.05rem, 2.1vw, 1.28rem);
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
  max-width: 540px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: var(--text);
  padding: 13px 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid rgba(255, 198, 0, 0.35);
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.hero-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 20, 25, 0.12);
}

/* --- core sections --- */
main {
  background: transparent;
  border-radius: 0;
  margin-top: 0;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 72px;
}

section {
  padding: 0 24px;
}

.converter-section {
  padding-bottom: 80px;
}

.converter-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.converter-grid {
  display: grid;
  gap: 20px;
  min-height: 0;
  margin-top: 60px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 2.5vw, 28px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 960px) {
  .converter-grid {
    grid-template-columns: 1fr;
  }
}

.pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

textarea {
  width: 100%;
  flex: 1;
  min-height: 0;
  resize: none;
  overflow-y: auto;
  font-family: "JetBrains Mono", "Fira Code", "Fira Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 0 3px rgba(15, 20, 25, 0.06);
}

textarea::placeholder {
  color: var(--muted);
}

.input-wrapper,
.output-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.input-wrapper {
  position: relative;
  min-height: 520px;
}

.input-highlight {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  font-family: "JetBrains Mono", "Fira Code", "Fira Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 20, 25, 0.22) transparent;
  pointer-events: none;
}

#inputField {
  position: absolute;
  inset: 0;
  z-index: 1;
  resize: none;
  overflow-y: auto;
  font-family: "JetBrains Mono", "Fira Code", "Fira Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 14px 16px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: transparent;
  caret-color: var(--text);
  -webkit-text-fill-color: transparent;
}

#inputField:focus {
  background: transparent;
}

#inputField::placeholder {
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
}

#inputField::selection {
  background: rgba(37, 99, 235, 0.18);
}

.input-chord {
  padding: 0;
  border: none;
  border-radius: 4px;
  background: #e5e7eb;
  box-shadow: -3px 0 0 #e5e7eb, 3px 0 0 #e5e7eb;
  color: var(--text);
  font-weight: 800;
  line-height: inherit;
}

#outputDisplay {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: "JetBrains Mono", "Fira Code", "Fira Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre;
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 20, 25, 0.22) transparent;
}

#outputDisplay::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#outputDisplay::-webkit-scrollbar-track {
  background: transparent;
}

#outputDisplay::-webkit-scrollbar-thumb {
  background: rgba(15, 20, 25, 0.18);
  border-radius: var(--radius-sm);
}

.brace {
  color: var(--brace);
}

.comment-label {
  color: var(--brace);
  font-weight: 600;
}

.comment-value {
  color: var(--comment-value);
  font-weight: 600;
}

.bracket {
  color: var(--bracket);
  font-weight: 600;
}

.chord {
  color: var(--chord);
  font-weight: 600;
}

.buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  background-color: var(--btn-primary-bg);
  color: #f8fafc;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

button:hover:not(:disabled) {
  background-color: var(--btn-primary-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
  transform: none;
}

button.secondary {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  border-color: var(--border);
}

button.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.78);
  border-color: var(--border-strong);
}

button.secondary.active {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: inset 0 0 0 1px rgba(15, 20, 25, 0.06);
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-inline-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.transpose-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0.88rem;
}

.transpose-label {
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.transpose-value {
  min-width: 34px;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

button.transpose-step {
  background-color: rgba(255, 255, 255, 0.75);
  color: var(--text);
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

button.transpose-step:hover:not(:disabled) {
  background: var(--surface-solid);
  border-color: var(--border-strong);
}

button.transpose-step:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.status {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  min-height: 1em;
}

.converter-instructions {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
  text-align: center;
}

.features-section {
  padding-bottom: 80px;
}

.section-header {
  max-width: var(--max-width);
  margin: 0 auto 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 0 4px;
}

@media (max-width: 720px) {
  .section-header {
    align-items: center;
    text-align: center;
  }
}

.section-title {
  margin: 0;
  font-size: clamp(1.65rem, 3.2vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.65;
  max-width: 620px;
}

.features-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.feature-card {
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.feature-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.feature-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.feature-icon img {
  width: 100%;
  height: 100%;
}

/* -------------- feature request -------------- */
.feature-request-section {
  padding-bottom: 80px;
}

.feature-request-card {
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border-radius: var(--radius-lg);
  padding: 44px clamp(24px, 4vw, 56px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
}

#featureRequestForm {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
}

input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font: inherit;
  color: inherit;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(15, 20, 25, 0.06);
}

select {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

.primary-button {
  align-self: flex-start;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--btn-primary-bg);
  color: #f8fafc;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.primary-button:hover {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
}

@media (max-width: 720px) {
  .feature-request-card {
    align-items: stretch;
    text-align: left;
  }

  .primary-button {
    align-self: stretch;
    text-align: center;
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .donation-card {
    align-items: center;
    text-align: center;
  }
}

footer {
  padding: 28px 24px 56px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  background: transparent;
  border-radius: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  white-space: nowrap;
  clip-path: inset(50%);
  clip: rect(0 0 0 0);
  overflow: hidden;
}

.chord {
  cursor: pointer;
}

.chord.chord-active {
  border-radius: 4px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chord.chord-tutorial-target {
  position: relative;
  z-index: 2;
  border-radius: 4px;
  animation: chordTutorialPulse 1.6s ease-in-out infinite;
}

@keyframes chordTutorialPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 198, 0, 0.35);
    outline: 1px solid var(--accent);
    outline-offset: 2px;
  }

  50% {
    box-shadow: 0 0 0 8px rgba(255, 198, 0, 0);
    outline: 1px solid rgba(255, 198, 0, 0.55);
    outline-offset: 3px;
  }
}

.chord-tutorial {
  position: fixed;
  z-index: 1000;
  max-width: min(280px, calc(100vw - 24px));
  pointer-events: auto;
  animation: chordTutorialEnter 0.35s ease-out;
}

.chord-tutorial.hidden {
  display: none;
}

.chord-tutorial-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.chord-tutorial-icon {
  font-size: 1.5rem;
  animation: chordTutorialBounce 1.2s ease-in-out infinite;
}

.chord-tutorial-text {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.chord-tutorial-keys {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}

.chord-tutorial-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(15, 20, 25, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 0 rgba(15, 20, 25, 0.08);
}

.chord-tutorial-btn {
  margin-top: 2px;
  padding: 8px 18px;
  font-size: 0.85rem;
}

.chord-tutorial-arrow {
  width: 12px;
  height: 12px;
  margin: -7px auto 0;
  background: var(--surface-elevated);
  border-right: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  transform: rotate(45deg);
}

@keyframes chordTutorialEnter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chordTutorialBounce {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

/* --- Chord shape popover --- */
.chord-shape-popover {
  position: fixed;
  z-index: 1100;
  width: 220px;
  padding: 14px 16px 16px;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--glass-border);
  animation: chordTutorialEnter 0.25s ease-out;
}

.chord-shape-popover.hidden {
  display: none;
}

.chord-shape-header {
  text-align: center;
  margin-bottom: 4px;
}

.chord-shape-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.chord-shape-diagram {
  display: flex;
  justify-content: center;
  min-height: 110px;
  align-items: center;
}

.chord-shape-loading,
.chord-diagram-fallback {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.chord-diagram-svg {
  width: 140px;
  height: auto;
  display: block;
}

.chord-diagram-string,
.chord-diagram-fret {
  stroke: #333;
  stroke-width: 1;
}

.chord-diagram-nut {
  stroke: #111;
  stroke-width: 3;
}

.chord-diagram-barre {
  stroke: #111;
  stroke-width: 5;
  stroke-linecap: round;
}

.chord-diagram-dot {
  fill: #111;
}

.chord-diagram-open {
  fill: none;
  stroke: #111;
  stroke-width: 1.5;
}

.chord-diagram-muted {
  font-size: 11px;
  font-weight: 700;
  fill: #333;
}

.chord-diagram-finger {
  font-size: 9px;
  font-weight: 700;
  fill: #fff;
}

.chord-diagram-base-fret {
  font-size: 11px;
  font-weight: 600;
  fill: var(--muted);
}

.chord-shape-popover--piano {
  width: 250px;
}

.chord-shape-popover--piano .chord-shape-diagram {
  min-height: 88px;
}

.chord-piano-svg {
  width: 100%;
  max-width: 220px;
  height: auto;
}

.chord-piano-white {
  fill: #f7f8fa;
  stroke: rgba(15, 20, 25, 0.18);
  stroke-width: 1;
}

.chord-piano-black {
  fill: #2a3038;
  stroke: rgba(15, 20, 25, 0.35);
  stroke-width: 1;
}

.chord-piano-white.is-active {
  fill: #c8e6f5;
  stroke: #1a94c9;
  stroke-width: 1.5;
}

.chord-piano-black.is-active {
  fill: #1a94c9;
  stroke: #147aa3;
  stroke-width: 1.5;
}

.chord-piano-label {
  font-size: 8px;
  font-weight: 700;
  fill: #0f1419;
  pointer-events: none;
}

.chord-piano-label-dark {
  fill: #f8fafc;
}

.chord-shape-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 12px;
}

.chord-shape-nav-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.chord-shape-nav-btn:disabled {
  opacity: 0.35;
}

.chord-shape-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 4.5rem;
  text-align: center;
}

.chord-instrument-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 10px;
}

.chord-instrument-option {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 6px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chord-instrument-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chord-instrument-option:has(input:checked) {
  background: var(--text);
  color: var(--surface-solid);
  border-color: var(--text);
}

.chord-instrument-option:hover:not(:has(input:checked)) {
  background: var(--surface-solid);
  border-color: var(--border-strong);
}

.chord-shape-play {
  width: 100%;
  padding: 10px;
  font-size: 0.92rem;
  background: var(--btn-primary-bg);
  color: #f8fafc;
  border-radius: var(--radius-md);
}

.chord-shape-play:hover:not(:disabled) {
  background: var(--btn-primary-hover);
}

.chord-shape-hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}

.chord-shape-hint.hidden {
  display: none;
}

/* --- Icon button --- */
button.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
}

.icon-btn-svg {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}

/* --- Metronome --- */
.metronome-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.metronome-trigger.is-playing {
  background-color: var(--btn-primary-bg);
  border-color: transparent;
  color: #f8fafc;
  box-shadow: none;
}

.metronome-trigger.is-playing:hover:not(:disabled) {
  background-color: var(--btn-primary-hover);
  border-color: transparent;
  color: #f8fafc;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.metronome-trigger.is-playing .icon-btn-svg {
  opacity: 1;
}

.metronome-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 1200;
  width: 240px;
  padding: 14px 16px 16px;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--glass-border);
  animation: chordTutorialEnter 0.25s ease-out;
}

.metronome-popover.hidden {
  display: none;
}

.metronome-header {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.metronome-bpm-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.metronome-dial-wrap {
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
}

.metronome-dial {
  position: relative;
  width: 120px;
  height: 120px;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.metronome-dial.is-dragging {
  cursor: grabbing;
}

.metronome-dial:focus-visible {
  outline: 2px solid rgba(15, 20, 25, 0.25);
  outline-offset: 4px;
  border-radius: 50%;
}

.metronome-dial-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.metronome-dial-track {
  fill: none;
  stroke: rgba(15, 20, 25, 0.18);
  stroke-width: 2.5;
}

.metronome-dial-arm {
  position: absolute;
  inset: 0;
  transform: rotate(180deg);
  transform-origin: center center;
  pointer-events: none;
}

.metronome-dial-knob {
  position: absolute;
  top: calc(50% - 52px);
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  background: #d8dce3;
  box-shadow: 0 0 0 1px rgba(15, 20, 25, 0.08);
}

.metronome-dial-readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.metronome-dial-bpm {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.05;
}

.metronome-dial-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.metronome-tap-btn {
  width: 100%;
  margin-bottom: 12px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.metronome-tap-btn:hover:not(:disabled) {
  background: var(--surface-solid);
  border-color: var(--border-strong);
}

.metronome-tap-btn.is-tapping {
  background: rgba(15, 20, 25, 0.08);
  border-color: rgba(15, 20, 25, 0.2);
}

.metronome-step-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.metronome-step-btn:hover:not(:disabled) {
  background: var(--surface-solid);
  border-color: var(--border-strong);
}

.metronome-bpm-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
}

.metronome-bpm-box input {
  width: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  padding: 0;
  line-height: 1.1;
  -moz-appearance: textfield;
  appearance: textfield;
}

.metronome-bpm-box input::-webkit-outer-spin-button,
.metronome-bpm-box input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.metronome-bpm-box input:focus {
  outline: none;
  box-shadow: none;
}

.metronome-bpm-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.metronome-beats-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.metronome-beats-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.metronome-beats-value {
  min-width: 1.5ch;
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
  line-height: 1.1;
}

.metronome-beats-label {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-align: center;
}

.metronome-play-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.metronome-play-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.metronome-play-icon.hidden {
  display: none;
}

.audio-loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all 0.3s ease;
  opacity: 1;
  max-height: 52px;
  overflow: hidden;
}

.audio-loading-indicator.hidden {
  opacity: 0;
  max-height: 0;
  padding: 0;
  margin: 0;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(15, 20, 25, 0.12);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 14px;
  font-weight: 500;
}

/* --- Fix mobile converter layout --- */
@media (max-width: 960px) {

  /* Adjust main padding on mobile */
  main {
    padding-top: 24px;
    gap: 40px;
  }

  .converter-section {
    padding-bottom: 40px;
  }

  .converter-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }

  /* Give each pane a reasonable minimum height on mobile */
  .pane {
    min-height: 400px;
  }

  /* Ensure textarea and output display have proper height */
  .input-wrapper,
  textarea,
  #outputDisplay {
    min-height: 350px;
    font-size: 0.9rem;
  }
}

/* --- Better mobile header --- */
@media (max-width: 640px) {
  .site-logo img {
    width: 160px;
  }

  header.hero {
    min-height: auto;
    padding: 20px 16px 36px;
  }

  .site-logo {
    padding: 0 16px 24px;
  }

  .hero-content {
    padding: 28px 22px;
    width: 100%;
  }

  .hero-title {
    font-size: 2rem;
    line-height: 1.12;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-cta {
    padding: 12px 18px;
    font-size: 0.92rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-backdrop-gradient,
  .hero-backdrop-mesh,
  .hero-backdrop-dots {
    animation: none;
  }
}

/* --- Fix button layout on mobile --- */
@media (max-width: 480px) {
  .buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .buttons button {
    width: 100%;
    justify-content: center;
  }

  .transpose-controls {
    width: 100%;
    justify-content: center;
  }

  /* Stack controls vertically on very small screens */
  .converter-wrapper {
    gap: 16px;
  }

  /* Reduce padding further on small screens */
  .converter-grid {
    padding: 16px;
  }

  section {
    padding: 0 16px;
  }
}

/* --- Fix loading indicator on mobile --- */
@media (max-width: 640px) {
  .audio-loading-indicator {
    padding: 12px;
    font-size: 0.9rem;
  }

  .loading-spinner {
    width: 16px;
    height: 16px;
  }

  .loading-text {
    font-size: 13px;
  }
}

/* --- Ensure output display is scrollable --- */
#outputDisplay {
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* Smooth scrolling on iOS */
}

/* --- Fix feature cards on mobile --- */
@media (max-width: 640px) {
  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .feature-card {
    padding: 20px;
  }

  .section-title {
    font-size: 1.75rem;
  }
}

/* --- Improve button touch targets on mobile --- */
@media (hover: none) and (pointer: coarse) {
  button {
    min-height: 44px;
    /* iOS recommended touch target */
    min-width: 44px;
  }

  .transpose-step {
    width: 44px;
    height: 44px;
  }

  /* Make chord elements easier to tap */
  .chord {
    padding: 2px 4px;
    margin: -2px -4px;
    display: inline-block;
  }
}

/* --- Fix viewport height issues on mobile --- */
@media (max-width: 960px) {

  /* Use viewport height carefully to avoid issues with mobile browser chrome */
  header.hero {
    min-height: 50vh;
  }

  /* Ensure converter section is visible */
  .converter-section {
    min-height: auto;
  }
}

/* --- Prevent horizontal scroll --- */
html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  position: relative;
}

/* --- Fix text wrapping in output --- */
#outputDisplay {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

/* --- Ensure proper spacing between sections on mobile --- */
@media (max-width: 640px) {
  main {
    border-radius: 0;
  }

  .features-section,
  .feature-request-section {
    padding-bottom: 40px;
  }
}

/* --- Feature Request Section --- */
.feature-request-section {
  padding-bottom: 80px;
}

.feature-request-card {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border-radius: var(--radius-lg);
  padding: 40px clamp(24px, 4vw, 52px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
}

.mailto-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--btn-primary-bg);
  color: #f8fafc;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  margin: 24px 0 16px;
  transition: background 0.18s ease, transform 0.18s ease;
}

.mailto-button:hover {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
}

.mailto-button:active {
  transform: translateY(0);
}

.feature-request-subtext {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

@media (max-width: 640px) {
  .feature-request-card {
    padding: 32px 20px;
  }

  .mailto-button {
    font-size: 1rem;
    padding: 14px 24px;
  }
}

/* -------------- Media Player Styles -------------- */

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Media Loader Dialog */
.media-loader-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 20, 25, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
}

.media-loader-content {
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.media-loader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.35);
}

.media-loader-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.media-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
  padding: 0;
}

.media-close-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--border-strong);
  transform: none;
}

.media-loader-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.save-format-fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.save-format-fieldset legend {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.save-format-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.save-format-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.45);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.save-format-option:has(input:checked) {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(15, 20, 25, 0.04);
}

.save-format-option input {
  accent-color: var(--text);
}

.save-as-actions {
  display: flex;
  gap: 8px;
}

.save-as-actions button {
  flex: 1;
}

.media-input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.media-input-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0;
}

.media-input-group input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.55);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.media-input-group input[type="text"]:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(15, 20, 25, 0.06);
}

.media-input-group input[type="file"] {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.media-input-group input[type="file"]:hover {
  border-color: var(--border-strong);
}

.media-input-group button {
  align-self: flex-start;
  padding: 12px 24px;
}

.media-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.media-divider::before,
.media-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Media Player Container - matches converter-grid styling */
.media-player-container {
  margin: 24px auto 0 auto;
  background: black;
  border-radius: var(--radius-md);
  padding: 0;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  max-width: 900px;
  width: 100%;
  transition: all 0.3s ease;
}

/* Mode: YouTube (Fixed 16:9) */
.media-player-container.mode-youtube {
  aspect-ratio: 16 / 9;
}

/* Mode: Local Video (Adaptive) */
.media-player-container.mode-video {
  background: black;
  aspect-ratio: auto;
}

/* Mode: Audio (Custom UI) */
.media-player-container.mode-audio {
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: 56px 32px 32px 32px;
  aspect-ratio: auto;
  border-radius: var(--radius-lg);
}

.media-player-container.mode-audio .media-player-wrapper {
  background: transparent;
  /* Remove black background for audio mode */
  min-height: auto;
}

/* Custom Audio Player Styles */


.audio-player-ui {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.audio-slider-container {
  width: 100%;
  position: relative;
  height: 6px;
  background: #f3f4f6;
  border-radius: 3px;
  cursor: pointer;
}

.audio-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--text);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}

.audio-slider-input {
  position: absolute;
  top: -7px;
  left: 0;
  width: 100%;
  height: 20px;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.audio-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #4b5563;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.audio-btn:hover {
  color: var(--text);
  transform: scale(1.06);
}

.audio-btn-play {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--btn-primary-bg);
  color: #f8fafc;
  box-shadow: var(--shadow-sm);
}

.audio-btn-play:hover {
  background: var(--btn-primary-hover);
  color: #f8fafc;
  transform: scale(1.04);
  box-shadow: var(--shadow-md);
}

/* Floating Close Button */
.media-close-floating {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.media-close-floating:hover {
  background: rgba(220, 38, 38, 0.9);
  transform: scale(1.1);
}

/* Title Overlay (for audio or non-YouTube) */
.media-title-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: white;
  pointer-events: none;
}

.media-title {
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.9;
}

.media-player-wrapper {
  width: 100%;
  height: 100%;
  /* Fill the 16:9 container */
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-player-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.media-player-wrapper audio {
  width: 100%;
  padding: 20px;
  background: #1a1a1a;
}

.media-player-wrapper video {
  width: 100%;
  max-height: 450px;
  background: #000;
}

/* Mobile Responsive Styles */
@media (max-width: 640px) {
  .media-loader-dialog {
    padding: 16px;
  }

  .media-loader-content {
    border-radius: var(--radius-lg);
  }

  .media-loader-header {
    padding: 16px 20px;
  }

  .media-loader-body {
    padding: 20px;
  }

  .save-format-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .save-as-actions {
    flex-direction: column;
  }

  .media-player-container {
    margin-top: 16px;
    border-radius: var(--radius-md);
  }

  .media-player-header {
    padding: 12px 16px;
  }

  .media-title {
    font-size: 0.9rem;
  }

  .media-player-wrapper iframe {
    max-height: 280px;
  }

  .media-player-wrapper video {
    max-height: 280px;
  }
}

@media (max-width: 480px) {
  .media-input-group button {
    align-self: stretch;
    text-align: center;
  }
}

/* YouTube Fallback Styles (for file:// protocol) */
.youtube-fallback-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0f0f0f;
  padding: 20px;
}

.youtube-link {
  position: relative;
  display: block;
  width: 100%;
  max-width: 800px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.youtube-link:hover {
  transform: scale(1.02);
}

.youtube-link:hover .youtube-play-overlay {
  opacity: 1;
}

.youtube-thumbnail {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.youtube-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.9;
  transition: opacity 0.2s ease;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.youtube-info-text {
  margin: 16px 0 0;
  color: #aaa;
  font-size: 0.9rem;
  text-align: center;
}

/* --- Custom File Drop Zone --- */
.drop-zone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
  outline: none;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.68);
}

.drop-zone:focus-visible {
  box-shadow: 0 0 0 3px rgba(15, 20, 25, 0.08);
  border-color: var(--border-strong);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  /* Let clicks pass to parent */
}

.drop-zone-icon {
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.drop-zone:hover .drop-zone-icon,
.drop-zone.drag-over .drop-zone-icon {
  color: var(--text);
}

.drop-zone-text {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.95rem;
}

.file-name-display {
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.75);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-top: 4px;
  border: 1px solid var(--border);
}

.file-name-display.hidden {
  display: none;
}

.drop-zone-label {
  display: block;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

/* --- Floating Player State --- */
.media-player-container.floating {
  position: fixed;
  top: 90px;
  right: 24px;
  width: 340px;
  max-width: 90vw;
  margin: 0;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  animation: floatIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Adjustments for floating audio player */
.media-player-container.floating.mode-audio {
  padding: 48px 24px 24px;
  background: var(--surface-elevated);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
}

/* Hide overlay title in floating mode unless hovered */
.media-player-container.floating .media-title-overlay {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.media-player-container.floating:hover .media-title-overlay {
  opacity: 1;
}

/* Make sure close button is easily accessible */
.media-player-container.floating .media-close-floating {
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  font-size: 12px;
}