:root {
  --accent: #e8622c;
  --accent-dark: #c94f1f;
  --border: #e2ddd6;
  --bg: #faf8f5;
  --text: #2f2a25;
  --text-muted: #7a736a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app-header {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: var(--accent);
  color: #fff;
}

.app-header h1 {
  font-size: 18px;
  margin: 0;
}

.layout {
  display: flex;
  height: calc(100vh - 56px);
}

.sidebar {
  width: 340px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: #fff;
  padding: 16px;
  overflow-y: auto;
}

.sidebar h2 {
  font-size: 15px;
  margin: 0 0 10px;
  color: var(--text);
}

#add-form label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

#add-form input[type="text"],
#add-form input[type="url"],
#add-form input[type="number"],
#add-form select,
#add-form textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
}

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

.row label {
  flex: 1;
  min-width: 0;
}

.row input {
  width: 100%;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
}

.level-fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0 0 12px;
  padding: 8px 10px 10px;
}

.level-fieldset legend {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 4px;
}

.level-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.level-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 0;
}

.level-option input {
  width: auto;
  margin: 0;
}

.tabelog-fields {
  border-left: 3px solid var(--border);
  padding-left: 10px;
  margin-bottom: 12px;
}

.row button {
  padding: 8px 12px;
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.row button:hover {
  background: #fdece3;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: -4px 0 12px;
}

.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #eef1fb;
  color: #3a4a9e;
  margin-bottom: 12px;
}

.edit-banner button {
  padding: 4px 10px;
  border: 1px solid #3a4a9e;
  background: #fff;
  color: #3a4a9e;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.pin-status {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f1ede7;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.pin-status.set {
  background: #fdece3;
  color: var(--accent-dark);
}

#btn-save {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

#btn-save:disabled {
  background: #d8d2c9;
  cursor: not-allowed;
}

.list-section {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

#restaurant-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#restaurant-list li {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}

#restaurant-list .item-name {
  font-weight: bold;
  font-size: 14px;
}

#restaurant-list .item-address {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0;
}

#restaurant-list .item-memo {
  font-size: 12px;
  color: var(--text);
  margin: 4px 0;
  white-space: pre-wrap;
}

.item-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1ede7;
  color: var(--text-muted);
  white-space: nowrap;
}

.badge-genre {
  background: #eef1fb;
  color: #3a4a9e;
}

.badge-level.level-3 {
  background: #fde3e0;
  color: #c62828;
}

.badge-level.level-2 {
  background: #fde9d4;
  color: #c9700b;
}

.badge-level.level-1 {
  background: #dfeafc;
  color: #1a5faa;
}

.item-image {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 6px;
  margin: 6px 0;
}

.rating-line {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0;
  line-height: 1.6;
}

.rating-line a {
  color: var(--accent-dark);
}

.popup-content {
  position: relative;
  max-width: 220px;
  padding-right: 18px;
}

.popup-close {
  position: absolute;
  top: -4px;
  right: -6px;
  border: none;
  background: none;
  font-size: 16px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.popup-close:hover {
  color: var(--text);
}

#restaurant-list .item-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

#restaurant-list .item-actions button {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}

#restaurant-list .item-actions .btn-delete {
  color: #b8321f;
  border-color: #f0c3ba;
}

.empty-message {
  font-size: 13px;
  color: var(--text-muted);
}

main {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

.popup-memo {
  white-space: pre-wrap;
  font-size: 13px;
  margin: 4px 0;
}

@media (max-width: 720px) {
  .app-header {
    height: 48px;
    padding: 0 12px;
  }

  .app-header h1 {
    font-size: 16px;
  }

  .layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 48px);
  }

  .sidebar {
    width: 100%;
    max-height: 60vh;
    padding: 12px;
  }

  main {
    flex: none;
    height: 40vh;
  }

  .row {
    flex-direction: column;
    gap: 0;
  }

  #btn-save {
    padding: 12px;
    font-size: 15px;
  }

  .row button,
  #restaurant-list .item-actions button {
    min-height: 36px;
  }
}
