* {
  box-sizing: border-box;
}

:root {
  --bg-cream: #F7F3EB;
  --card-white: #FFFDF9;
  --wood-dark: #4A3525;
  --wood-medium: #8C6239;
  --accent-green: #6B8E6E;
  --accent-orange: #D98245;
  --border-latte: #E0D5C5;
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  background-color: var(--bg-cream);
  color: var(--wood-dark);
  margin: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  overflow-x: hidden;
}

header {
  text-align: center;
  margin-bottom: 16px;
  width: 100%;
  max-width: 480px;
}

header h1 {
  font-size: 1.4rem;
  margin: 0;
  color: var(--wood-dark);
}

header p {
  font-size: 0.85rem;
  color: var(--wood-medium);
  margin: 4px 0 0;
}

.container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card-white);
  border: 2px solid var(--border-latte);
  border-radius: 16px;
  padding: 16px;
  width: 100%;
  box-shadow: 0 4px 10px rgba(74, 53, 37, 0.05);
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: bold;
  margin-bottom: 12px;
  color: var(--wood-medium);
}

/* スタンプカード */
.rank-badge {
  background: var(--wood-medium);
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: bold;
}

.beans-row {
  display: flex;
  justify-content: space-between;
  background: var(--bg-cream);
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.timer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.btn-small {
  background: var(--wood-dark);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
}

/* コードボタン＆試聴 */
.btn-sound {
  background: var(--accent-orange);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
}

.chord-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.chord-btn {
  background: var(--bg-cream);
  border: 2px solid var(--border-latte);
  border-radius: 12px;
  padding: 8px 0;
  font-size: 1.05rem;
  font-weight: bold;
  color: var(--wood-dark);
  cursor: pointer;
}

.chord-btn.active {
  background: var(--wood-medium);
  color: #fff;
  border-color: var(--wood-medium);
}

.diagram-box {
  background: var(--bg-cream);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.chord-name-display {
  font-size: 1.4rem;
  font-weight: bold;
  margin: 0 0 6px;
}

.chord-tip {
  font-size: 0.85rem;
  margin-top: 8px;
  line-height: 1.5;
  text-align: left;
}

/* コード進行レシピ */
.preset-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.btn-preset {
  flex: 1;
  background: var(--bg-cream);
  border: 1.5px solid var(--border-latte);
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 0.78rem;
  font-weight: bold;
  color: var(--wood-dark);
  cursor: pointer;
}

.custom-prog-box {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.custom-prog-box input {
  flex: 1;
  padding: 8px;
  border: 1.5px solid var(--border-latte);
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--wood-dark);
}

.prog-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-cream);
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 12px;
  justify-content: center;
}

.prog-chip {
  padding: 4px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1.5px solid var(--border-latte);
  font-weight: bold;
  font-size: 0.95rem;
}

.prog-chip.current {
  background: var(--accent-orange);
  color: #fff;
  border-color: var(--accent-orange);
  transform: scale(1.08);
}

/* ストローク＆メディア */
.pattern-select {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1.5px solid var(--border-latte);
  background: var(--bg-cream);
  color: var(--wood-dark);
  font-size: 0.8rem;
  font-weight: bold;
}

.preview-area {
  width: 100%;
  background: #3A2718;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.preview-area canvas,
.preview-area img,
.preview-area video {
  width: 100%;
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  display: block;
}

.media-upload {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.upload-label {
  flex: 1;
  background: var(--bg-cream);
  border: 1.5px dashed var(--wood-medium);
  border-radius: 10px;
  padding: 8px;
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--wood-dark);
  text-align: center;
  cursor: pointer;
}

.upload-label input[type="file"] {
  display: none;
}

.btn-reset {
  background: var(--border-latte);
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.75rem;
  color: var(--wood-dark);
  cursor: pointer;
}

/* コントロール＆ドット */
.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.controls-row label {
  font-size: 0.9rem;
  white-space: nowrap;
}

.controls-row input[type="range"] {
  width: 100%;
}

.btn-action {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: bold;
  color: #fff;
  background: var(--accent-green);
  cursor: pointer;
}

.btn-action.stop {
  background: var(--accent-orange);
}

.beat-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border-latte);
}

.dot.active {
  background: var(--accent-orange);
  transform: scale(1.2);
}

audio {
  width: 100%;
  margin-top: 10px;
  height: 36px;
}
/* チューナーデザイン */
.tuner-display {
  background: var(--bg-cream);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  margin-bottom: 10px;
}

.tuner-note {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--wood-dark);
}

.tuner-status {
  font-size: 0.85rem;
  color: var(--wood-medium);
  margin: 4px 0 10px;
  font-weight: bold;
}

.tuner-meter {
  position: relative;
  width: 100%;
  height: 16px;
  background: var(--border-latte);
  border-radius: 8px;
  overflow: hidden;
}

.tuner-center-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-green);
  transform: translateX(-50%);
}

.tuner-needle {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-orange);
  transform: translateX(-50%);
  transition: left 0.1s ease-out, background 0.1s;
}

.string-buttons {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.str-btn {
  background: var(--bg-cream);
  border: 1.5px solid var(--border-latte);
  border-radius: 8px;
  padding: 6px 0;
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--wood-dark);
  cursor: pointer;
}
/* インカメラ鏡・特訓・カポ・黒板メモ */
#mirrorVideo {
  width: 100%;
  max-height: 180px;
  border-radius: 10px;
  background: #000;
  transform: scaleX(-1);
  object-fit: cover;
}

.drill-box, .capo-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--bg-cream);
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.capo-msg {
  font-size: 0.8rem;
  color: var(--accent-green);
  font-weight: bold;
  line-height: 1.4;
}

.blackboard-card {
  background: #2C3E35;
  border-color: #8C6239;
  color: #FFFDF9;
}

.memo-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.memo-input-row input {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: none;
  font-size: 0.85rem;
}

.memo-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.memo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.memo-del {
  background: transparent;
  border: none;
  color: #D98245;
  font-weight: bold;
  cursor: pointer;
}

/* 夜カフェテーマ・クイズ・自動スクロール・YouTube */
body.night-cafe {
  --bg-cream: #1E1611;
  --card-white: #2B2019;
  --wood-dark: #F5EBE0;
  --wood-medium: #D5A373;
  --border-latte: #4A382B;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-theme {
  background: var(--wood-dark);
  color: var(--bg-cream);
  border: none;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: bold;
  cursor: pointer;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.lyrics-box {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border-latte);
  background: var(--bg-cream);
  color: var(--wood-dark);
  font-family: monospace;
  font-size: 0.95rem;
  line-height: 1.8;
  resize: vertical;
}

.yt-box {
  background: var(--bg-cream);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.yt-box iframe {
  width: 100%;
  height: 200px;
  border-radius: 8px;
  border: none;
}
/* マニュアル（ガイドブック）画面 */
.manual-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  padding: 16px;
}

.manual-modal {
  background: var(--card-white);
  color: var(--wood-dark);
  border: 2px solid var(--wood-medium);
  border-radius: 16px;
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.manual-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border-latte);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.manual-section {
  margin-bottom: 16px;
}

.manual-section h3 {
  font-size: 0.95rem;
  color: var(--accent-orange);
  margin: 0 0 6px;
}

.manual-section p {
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
}
.lyrics-box {
  height: 150px !important;
  overflow-y: scroll !important;
}
