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

body {
  font-family: Arial, sans-serif;
  padding: 20px;
  background: #f5f5f5;
}

/* APP LAYOUT */
.app {
  display: flex;
  min-height: 100vh;
}

/* LEFT PANEL */
.left-panel {
  width: 40%;
  padding: 20px;
  border-right: 2px solid #ddd;
  overflow-y: auto;
  background: #fff;
}

/* RIGHT PANEL */
.right-panel {
  width: 60%;
  padding: 20px;
  overflow-y: auto;
  background: #f9f9f9;
}

/* MOBILE TOGGLE BUTTON */
.mobile-toggle {
  display: none;
  padding: 8px 12px;
  font-size: 14px;
  margin-bottom: 10px;
}

/* INPUTS */
textarea {
  width: 100%;
  height: 80px;
  margin-bottom: 5px;
}

input, select {
  padding: 6px;
  margin-bottom: 10px;
}

/* LINE BLOCK */
.line-block {
  border: 1px solid #ccc;
  padding: 10px;
  margin-bottom: 10px;
  background: #fafafa;
  cursor: grab;
}

.line-block:active {
  cursor: grabbing;
}

/* LINE CONTROLS */
.line-controls {
  display: flex;
  gap: 10px;
  margin-top: 5px;
}

.line-controls button {
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
}

/* OUTPUT */
#output {
  margin-top: 20px;
  font-size: 18px;
}

/* PAGE */
.page {
  width: 100%;
  max-width: 794px; /* A4 width */
  margin: 10px auto;
  padding: 20px;

  background: white;
  border: 1px solid #ccc;
}

/* Desktop A4 height */
@media (min-width: 769px) {
  .page {
    min-height: 1122px;
  }
}

/* CONTENT SPACING */
.page-content {
  margin-left: 50px;
  margin-right: 20px;
}

/* HEADER */
.page-header {
  position: relative;
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* TITLE */
.song-title {
  font-size: 24px;
  font-weight: bold;
  margin-top: 90px;
}

/* BADGE */
.badge-container {
  position: absolute;
  top: 0;
  right: 0;

  display: flex;        /* 🔥 KEY */
  align-items: center;  /* vertical alignment */
  gap: 10px;            /* space between BPM and badge */
}

.scale-badge {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: red;
  color: white;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.badge-note {
  font-size: 18px;
  font-weight: bold;
}

.badge-type {
  font-size: 12px;
}

.badge-text {
  font-size: 10px;
}

/* LINES */
.output-line {
  margin-bottom: 20px;
}

.header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid black;

  display: flex;
  align-items: center;
  justify-content: center;
}

.lyrics-text {
  font-style: italic;
  line-height: 1.4;
}

/* TAB LAYOUT */
.full-line {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: 45px;
}

.group {
  display: flex;
  align-items: flex-start;
  gap: 2px;
}

.line {
  display: flex;
  gap: 10px;
}

.column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fret {
  font-size: 16px;
  font-weight: bold;
}

.arrow {
  font-size: 16px;
  color: #555;
}

.note {
  font-size: 12px;
  color: red;
}

.string {
  font-size: 16px;
  font-weight: bold;
}

/* TOOLBAR */
.toolbar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: bold;
}

/* MODAL */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);

  display: flex;
  justify-content: center;
  align-items: center;

  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-box {
  background: white;
  padding: 20px;
  border-radius: 12px;
  width: 280px;

  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  text-align: center;

  animation: popIn 0.2s ease;
}

.modal-box h3 {
  margin-bottom: 15px;
}

.modal-box label {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px;
  margin-bottom: 10px;

  border: 1px solid #ddd;
  border-radius: 8px;

  cursor: pointer;
}

.modal-box label:hover {
  background: #f5f5f5;
}

.modal-box button {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

.modal-box button:first-of-type {
  background: #007bff;
  color: white;
}

.modal-box button:last-of-type {
  background: #ddd;
}

/* ANIMATION */
@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* REPEAT */
.repeat-line {
  display: flex;
  justify-content: center;
  margin: 15px 0;
}

.repeat-container {
  display: flex;
  gap: 10px;
}

.circle.repeat {
  background: #eee;
  border: 2px dashed black;
}

.top-row {
  display: flex;
  justify-content: flex-end; /* push everything right */
  align-items: flex-start;
  gap: 15px;
  width: 100%;
}

.tempo-info {
  text-align: right;
  font-size: 12px;   /* 🔥 reduce size */
  line-height: 1.3;
  color: #333;       /* optional: softer than pure black */
}

.error-text {
  color: red;
  font-size: 16px;
  margin-top: 4px;
}

/* ========================= */
/* 🔥 MOBILE FIX (MAIN PART) */
/* ========================= */

@media (max-width: 768px) {

  body {
    padding: 10px;
  }

  .app {
    flex-direction: column;
  }

  .left-panel,
  .right-panel {
    width: 100%;
    padding: 10px;
    border: none;
  }

  /* toggle */
  .right-panel {
    display: none;
  }

  .app.preview-mode .left-panel {
    display: none;
  }

  .app.preview-mode .right-panel {
    display: block;
  }

  .mobile-toggle {
    display: inline-block;
  }

  /* 🔥 IMPORTANT: SCALE FULL PAGE */
  .page {
    width: 794px;
    height: 1122px;

    transform: scale(0.5);
    transform-origin: top center;

    margin: 0;
    position: relative;
    left: 50%;
    transform: translateX(-50%) scale(0.47);
  }

  #output {
    overflow-x: hidden;
    /* font-size: 16px; */
  }

  .toolbar {
    flex-wrap: wrap;
    gap: 10px;
  }
}