:root {
  --bg-0: #f4f6f3;
  --bg-1: #dfebe1;
  --ink: #1f2b24;
  --muted: #54635a;
  --card: #ffffffcc;
  --accent: #286047;
  --accent-2: #e2a52b;
  --line: #c7d7cb;
  --shadow: 0 12px 32px rgba(31, 43, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: radial-gradient(circle at 20% 15%, var(--bg-1) 0%, var(--bg-0) 45%, #f9faf8 100%);
  padding-bottom: 112px;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(120deg, rgba(40, 96, 71, 0.05), rgba(226, 165, 43, 0.04));
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 24px;
  display: grid;
  gap: 16px;
}

.top-nav {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  width: min(900px, calc(100% - 24px));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid #ffffff;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.mode-btn,
.ctrl-btn,
button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.mode-btn.active,
button:hover,
.ctrl-btn:hover {
  border-color: var(--accent);
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
}

.player-card,
.panel {
  background: var(--card);
  border: 1px solid #ffffff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.player-card {
  padding: 20px;
  display: grid;
  gap: 14px;
  position: relative;
}

.favorite-corner {
  position: absolute;
  top: 14px;
  right: 14px;
  min-width: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.2rem;
  border-radius: 50%;
  z-index: 1;
}

.artwork-wrap {
  width: min(100%, 560px);
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.artwork-wrap img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.track-meta {
  text-align: center;
}

.track-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

.artist-name {
  margin: 6px 0 4px;
  color: var(--muted);
}

.status-text {
  margin: 0;
  font-size: 0.92rem;
  color: var(--accent);
}

.seekbar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.seekbar {
  flex: 1;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

.time-label {
  font-size: 0.78rem;
  color: var(--muted, #888);
  min-width: 2.8em;
  text-align: center;
  white-space: nowrap;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.ctrl-btn {
  min-width: 76px;
}

.ctrl-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ctrl-btn.primary {
  background: var(--accent);
  color: #fff;
}

.ctrl-btn.star.active {
  background: var(--accent-2);
  color: #2f2306;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  padding: 16px;
}

.panel h2 {
  margin-top: 0;
  font-size: 1rem;
}

.search-panel {
  grid-column: 1 / -1;
}

.favorite-panel {
  grid-column: 1 / -1;
}

.keyword-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

.memo-actions {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.count {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 4px 0 12px;
}

.favorite-list-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.order-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font-weight: 700;
}

.order-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.favorite-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.favorite-list li {
  margin: 0;
}

.favorite-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.favorite-item.active {
  border-color: var(--accent);
  background: rgba(40, 96, 71, 0.08);
}

.favorite-item-title {
  display: block;
  font-weight: 800;
}

.favorite-item-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.favorite-item-memo {
  display: block;
  margin-top: 6px;
  color: #8e9892;
  font-size: 0.83rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-empty {
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: #fff;
}

.memo-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 28, 23, 0.45);
}

.memo-modal.hidden {
  display: none;
}

.memo-modal-card {
  width: min(680px, 100%);
  background: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.memo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.memo-modal-header h2 {
  margin: 0;
  font-size: 1rem;
}

.memo-close-btn {
  min-width: 40px;
  padding: 6px 10px;
  line-height: 1;
}

.site-footer {
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #f7faf7;
  padding-bottom: calc(22px + 96px + env(safe-area-inset-bottom));
}

.site-footer nav {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

@media (max-width: 720px) {
  .search-panel {
    grid-column: auto;
  }

  .favorite-panel {
    grid-column: auto;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding: 16px 12px 16px;
  }

  body {
    padding-bottom: 126px;
  }
}

/* Cookie バナー */
.cookie-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(31, 43, 36, 0.96);
  color: #f4f6f3;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.cookie-banner.hidden {
  display: none;
}

.cookie-banner-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  flex: 1;
  min-width: 200px;
}

.cookie-banner-text a {
  color: var(--accent-2);
  text-decoration: underline;
}

.cookie-accept-btn {
  background: var(--accent-2);
  color: #2f2306;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.cookie-accept-btn:hover {
  opacity: 0.85;
}
