html {
  height: 100%;
  width: 100%;
}

/* Foundation */
:root {
  --primary-orange: #e64a2e;
  --accent-red: #D84315;
  --bg-white: #FAFAFA;
  --text-dark: #2D2D2D;
  --card-bg: #FFFFFF;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Joan', serif;
  background-color: var(--bg-white);
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Header Bar */
.main-nav {
  background-color: var(--primary-orange);
  padding: 0.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.4s ease-in-out;
}

.nav-content {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: white;
  font-weight: bold;
  font-size: 1.4rem;
}

.nav-links {
  display: flex;
  gap: 10px;
  height: 100%;
}

.nav-item {
  background: transparent;
  border: none;
  color: white;
  font-family: 'Joan', serif;
  font-size: 1rem;
  padding: 0 15px;
  cursor: pointer;
  position: relative;
  transition: background 0.3s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.15);
}

.nav-item:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.95);
}

.performing .main-nav,
.performing .viewer-actions {
  transform: translateY(-150%);
  opacity: 0;
  pointer-events: none;
}

.support-btn {
  font-weight: bold;
}

/* Main Layout Containers */
.container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  text-align: center;
}

/* Editor Mode (Textarea) */
.theme-btn {
  position: absolute;
  top: 90px;
  right: 20px;
  width: 45px;
  height: 45px;
  font-size: 1.1rem;
  background: #444;
}

#lyrics-input {
  width: 100%;
  height: 60vh;
  padding: 1.5rem;
  border: 3px solid #eee;
  border-radius: 25px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.1rem;
  resize: none;
  outline: none;
  transition: border-color 0.3s;
}

#lyrics-input:focus {
  border-color: var(--primary-orange);
}

.input-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  margin-bottom: 20px;
}

.input-group input {
  width: 100%;
  padding: 12px 20px;
  border: 2px solid #ddd;
  border-radius: 50px;
  font-family: 'Joan', serif;
  outline: none;
}

.input-group input:focus {
  border-color: var(--primary-orange);
}

.input-group label {
  margin-left: 15px;
  font-size: 0.9rem;
  color: #666;
}

/* Padding for "Get Scrollin'" Button*/
#editor-view {
  padding-bottom: 100px;
}

.btn-primary {
  background-color: var(--primary-orange);
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 1.2rem;
  font-family: 'Joan', serif;
  border-radius: 50px;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(255, 86, 56, 0.3);
  transition: all 0.2s ease;
  margin-top: 20px;
}

.btn-primary:hover {
  background-color: var(--accent-red);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 86, 56, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Viewer Mode (Display) */
#lyrics-display {
  font-family: 'Courier New', Courier, monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
  text-align: left;

  font-size: 1rem;
  line-height: 1.5;

  padding: 15px;
  padding-bottom: 250px;
  max-width: 100%;
}

/* Responsive Design */
@media (max-width: 600px) {
  #song-title-display {
    font-size: 1.5rem;
    margin-top: 1rem;
    padding: 0 10px;
  }

  #lyrics-display {
    padding-left: 10px;
    padding-right: 10px;
    line-height: 1.8;
    font-size: 0.85rem;
    letter-spacing: -0.5px;
  }

  .controls {
    bottom: 90px;
    width: 95%;
    justify-content: center;
    gap: 10px;
  }

  .circle-btn {
    width: 55px;
    height: 55px;
    font-size: 1.1rem;
  }
}

/* Circular Buttons (Controls) */
.controls {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 100;
}

.circle-btn {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  border: none;
  background: var(--primary-orange);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 87, 34, 0.3);
  transition: transform 0.2s, background 0.2s;
}

.circle-btn:active {
  transform: scale(0.9);
  background: var(--accent-red);
}

.viewer-actions {
  position: fixed;
  top: 90px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 1001;
  transition: transform 0.4s ease-in-out, opacity 0.3s;
}

.edit-top-btn,
.delete-top-btn {
  position: relative;
  top: auto;
  right: auto;
}


#btn-delete {
  background-color: #444;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#btn-delete:active {
  background-color: var(--accent-red);
}

.speed-badge {
  position: fixed;
  bottom: 160px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(45, 45, 45, 0.9);
  color: var(--bg-white);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: bold;
  z-index: 2000;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0;
}

.speed-badge.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Gallery Mode (Saved Songs) */
.library-actions {
  display: flex;
  gap: 20px;
  margin-bottom: 10px;
}

.action-link {
  background: transparent;
  border: none;
  color: var(--primary-orange);
  font-family: 'Joan', serif;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.2s;
}

.action-link:hover {
  opacity: 0.7;
  text-decoration: underline;
}

label.action-link {
  margin-bottom: 0;
}

.songs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
  padding-bottom: 100px;
}

.song-card {
  background: white;
  padding: 20px;
  border-radius: 20px;
  border: 2px solid #eee;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 120px;
}

.song-card:hover {
  border-color: var(--primary-orange);
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.song-card h3 {
  font-size: 1.1rem;
  color: var(--text-dark);
  margin-bottom: 5px;
}

.song-card p {
  font-size: 0.85rem;
  color: var(--primary-orange);
  font-weight: bold;
}

.empty-msg {
  grid-column: 1 / -1;
  color: #888;
  margin-top: 50px;
  font-style: italic;
}

.library-header {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

#search-input {
  width: 100%;
  max-width: 500px;
  padding: 12px 25px 12px 45px;
  border: 2px solid #ddd;
  border-radius: 50px;
  font-family: 'Joan', serif;
  outline: none;
  transition: border-color 0.3s;
  background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="grey" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat 15px center;
  background-size: 18px;
}

#search-input:focus {
  border-color: var(--primary-orange);
}

/* Support Me Drawer */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drawer-content {
  position: relative;
  background: white;
  padding: 30px 20px;
  border-radius: 30px 30px 0 0;
  text-align: center;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.drawer-handle {
  width: 50px;
  height: 6px;
  background: #ccc;
  border-radius: 10px;
  margin: 0 auto 20px;
  transition: background 0.2s;
  cursor: pointer;
}

.drawer-handle,
.support-link {
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.drawer-handle:hover {
  background: #999;
}

.drawer.active .drawer-overlay {
  opacity: 1;
}

.drawer.active .drawer-content {
  transform: translateY(0);
}

.support-options {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 25px 0;
}

.support-link {
  text-decoration: none;
  padding: 0;
  border-radius: 12px;
  font-weight: bold;
  font-size: 1rem;
  transition: background 0.2s, transform 0.1s;
  width: 217px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.support-link:active {
  transform: scale(0.98);
}

.support-link:hover {
  background: #eee;
  color: var(--primary-orange);
}

.work-btn {
  background-color: #0068d6 !important;
  color: white !important;
}

.creations-btn {
  background-color: #1e7634 !important;
  color: white !important;
}

.gear-btn {
  background-color: #b30083 !important;
  color: white !important;
}

.bmc-container {
  margin: 0;
  display: flex;
  justify-content: center;
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 60px;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  border-top: 1px solid #eee;
  z-index: 1000;
}

/* Utility */
.hidden {
  display: none;
}

/* Themes */
/* Dark Mode */
body.dark-mode {
  --bg-white: #1a1a1a;
  --text-dark: #f0f0f0;
  --card-bg: #2d2d2d;
}

body.dark-mode #lyrics-input,
body.dark-mode .song-card,
body.dark-mode .footer,
body.dark-mode .drawer-content {
  background-color: #2d2d2d;
  color: #f0f0f0;
  border-color: #444;
}

body.dark-mode .input-group input,
body.dark-mode #search-input {
  background-color: #333;
  color: white;
  border-color: #555;
}

body.dark-mode #lyrics-display {
  color: #e0e0e0;
}
