:root {
  --bg-soft: #fff9fa;
  --bg-card: #ffffff;
  --bg-secondary: #ffeff2;
  --bg-accent: #fce4e9;
  --text-main: #5d4a4a;
  --text-muted: #a08a8a;
  --primary: #ff9fb3;
  --primary-hover: #ff859d;
  --accent-pink: #ffd1dc;
  --border-color: #f7e1e5;
  --shadow-soft: 0 8px 20px rgba(255, 159, 179, 0.15);
  --shadow-modal: 0 30px 60px rgba(93, 74, 74, 0.12);
}
body {
  font-family: 'Zen Maru Gothic', sans-serif;
  background-color: var(--bg-soft);
  color: var(--text-main);
  line-height: 1.6;
  margin: 0;
  padding: 0px 20px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-soft);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-pink);
  border-radius: 10px;
  border: 2px solid var(--bg-soft);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

button, input, select, textarea {
  font-family: inherit;
}

h1, h2, h3 {
  font-family: inherit;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: var(--text-main);
}

.main-header {
  padding: 30px 0 20px;
}

.main-header h1 {
  text-align: center;
  font-size: 4rem;
  color: var(--primary);
  text-shadow: 4px 4px 0 var(--bg-accent), 8px 8px 20px rgba(255, 159, 179, 0.2);
  margin: 0;
  letter-spacing: 0.15em;
}

.header-subtitle {
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 10px 0 30px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.header-nav {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 40px;
  min-height: 48px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.header-nav.loaded {
  opacity: 1;
}

.nav-item {
  background: var(--bg-accent);
  border: none;
  padding: 10px 24px;
  border-radius: 50px;
  color: var(--text-main);
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 0 var(--border-color);
}

.nav-item:hover {
  background: var(--accent-pink);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--border-color);
}

select.nav-item:hover {
  background: var(--bg-accent);
  transform: none;
  box-shadow: 0 4px 0 var(--border-color);
}

#app {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 32px;
}

.model-card {
  background: var(--bg-card);
  border: none;
  padding: 32px;
  margin-bottom: 0;
  border-radius: 32px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.model-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(74, 69, 64, 0.08);
}

.model-card h3 {
  margin-top: 0;
  font-size: 1.4rem;
  border-bottom: 1px solid var(--bg-secondary);
  padding-bottom: 12px;
}

.btn {
  padding: 14px 28px;
  cursor: pointer;
  border: none;
  border-radius: 50px;
  background-color: var(--primary);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  letter-spacing: 0.05em;
  box-shadow: 0 4px 0 var(--btn-shadow, #ff859d);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--btn-shadow, #ff859d);
  opacity: 1;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.btn-primary {
  --btn-shadow: #ff859d;
}

.btn-get {
  background-color: white !important;
  color: var(--primary) !important;
  border: 2px solid var(--primary) !important;
  box-sizing: border-box;
  --btn-shadow: var(--bg-accent);
}

.btn-row-action {
  width: 90px;
  height: 38px;
  padding: 0 !important;
  font-size: 0.85rem !important;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.btn-secondary {
  background-color: var(--bg-accent);
  color: var(--text-main);
  --btn-shadow: #eec2ca;
}

.btn-success {
  background-color: #55d690;
  color: white;
  --btn-shadow: #3fb176;
}

.stats {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 15px;
  text-align: right;
  font-weight: 800;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(243, 241, 237, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.modal-content {
  background: var(--bg-card);
  width: 95%;
  max-width: 850px;
  max-height: 90vh;
  border-radius: 40px;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-body {
  padding: 40px;
  overflow-y: auto;
}

.modal-footer {
  padding: 30px 40px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.btn-large {
  width: 100%;
  padding: 18px !important;
  font-size: 1.1rem !important;
}

.metadata-editor-container {
  color: var(--text-main);
}

.speaker-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.speaker-tab-btn {
  padding: 8px 20px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s;
}

.speaker-tab-btn.active {
  color: var(--text-main);
  background: var(--bg-secondary);
  font-weight: 600;
}

.editor-section {
  background: var(--bg-secondary);
  padding: 24px;
  border-radius: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.section-title {
  font-family: "Georgia", serif;
  font-size: 1.1rem;
  font-weight: normal;
  margin-bottom: 1.5rem;
  color: var(--text-main);
  border-left: 4px solid var(--primary);
  padding-left: 12px;
}

.style-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.icon-preview-box {
  width: 50px;
  height: 50px;
  background: var(--bg-accent);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-preview-box::before {
  content: "なし";
  position: absolute;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 800;
}

input[type="text"], input[type="number"], textarea {
  border: 2px solid var(--border-color);
  padding: 10px 15px;
  border-radius: 16px;
  background: var(--bg-card);
  color: var(--text-main);
  transition: all 0.2s;
  font-weight: 700;
}

input:focus {
  outline: none;
  border-color: var(--primary);
}

::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  opacity: 0.8;
}

.strength-number-input {
  width: 60px;
}

input[type="range"] {
  accent-color: var(--primary);
}

input[type="file"]::file-selector-button {
  background-color: var(--bg-accent);
  color: var(--text-main);
  border: none;
  border-radius: 50px;
  padding: 6px 14px;
  font-weight: 800;
  margin-right: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 0 var(--border-color);
  font-family: inherit;
}

input[type="file"]::file-selector-button:hover {
  background-color: var(--accent-pink);
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--border-color);
}

input[type="file"] {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.local-editor-card {
  opacity: 0;
  animation: fadeIn 0.5s ease 0.6s forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-content.modal-sm {
  max-width: 500px;
}

.remote-status-box {
  background: var(--bg-secondary);
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.asset-row {
  margin-bottom: 20px;
}

.asset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.asset-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-lamp {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e0d8d8;
}

.status-lamp.active {
  background: #ff859d;
  box-shadow: 0 0 10px rgba(255, 133, 157, 0.5);
}

.asset-name {
  font-weight: 800;
  font-size: 1.1rem;
}

.status-text-active {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary-hover);
}

.p-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-accent);
  border-radius: 10px;
  overflow: hidden;
}

.p-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.p-text {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
  font-weight: 800;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.form-group input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

.speaker-panels {
  flex-grow: 1;
  overflow-y: auto;
}

.speaker-form-panel {
  display: none;
}

.speaker-form-panel.active {
  display: block;
}

.basic-info-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.basic-label {
  width: 100px;
  font-weight: 800;
  color: var(--text-main);
}

.basic-input-group {
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.style-list-header {
  display: flex;
  padding: 12px;
  background: var(--bg-accent);
  border-radius: 16px 16px 0 0;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
  gap: 12px;
}

.style-list-body {
  background: var(--bg-card);
  border-radius: 0 0 16px 16px;
}

.style-row {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.col-enable { flex: 0 0 40px; text-align: center; }
.col-id { flex: 0 0 40px; text-align: center; font-weight: 800; }
.col-name { flex: 1; }
.col-strength { flex: 0 0 200px; }
.col-icon { flex: 0 0 60px; display: none; justify-content: center; }

.show-style-icons .col-icon {
  display: flex;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.preview-img[src=""], .preview-img:not([src]) {
  display: none;
}

.icon-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-accent);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s;
}

.icon-mode-toggle:hover {
  background: var(--accent-pink);
}

.btn-primary.btn-large {
  box-shadow: 0 6px 0 #ff859d;
}

.modal-footer .btn-large {
  margin-bottom: 10px;
}

.form-label {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 15px;
  border-radius: 16px;
  border: 2px solid var(--bg-accent);
  background: white;
  font-family: inherit;
  font-size: 1rem;
  box-sizing: border-box;
  margin-bottom: 20px;
  transition: all 0.2s;
  box-shadow: inset 0 2px 4px rgba(255, 209, 220, 0.2);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.amount-btn {
  background: var(--bg-accent);
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-main);
}

.amount-btn.active {
  background: var(--primary);
  color: white;
}

.don-details-toggle {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  border: 1px dashed var(--primary);
}

.don-details-content {
  display: none;
  padding: 15px;
  background: var(--bg-soft);
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.don-details-content.open {
  display: block;
}

.local-editor-card {
  opacity: 0;
  animation: fadeIn 0.5s ease 0.5s forwards;
}

.normal-samples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.focus-samples { display: none; margin-top: 15px; }

.view-mode-samples .normal-samples, .view-mode-samples .model-card > .btn, .view-mode-samples .stats { display: none !important; }
.view-mode-samples .focus-samples { display: block !important; }

@media (max-width: 768px) {
  .normal-samples, .model-card .btn, .model-card .stats { display: none !important; }
  .focus-samples { display: block !important; }
  #view-mode-select { display: none; }
}

.focus-sample-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 15px;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
}

.focus-sample-row:hover {
  background: var(--bg-accent);
}

.focus-sample-text {
  font-size: 0.85rem;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.play-btn-small {
  color: var(--primary);
  font-weight: 800;
  flex-shrink: 0;
  background: var(--bg-accent);
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
}
.view-mode-samples .focus-sample-row {
  padding: 6px 12px;
  gap: 8px;
}
.view-mode-samples .focus-sample-text {
  font-size: 0.75rem;
}
.view-mode-samples .play-btn-small {
  padding: 2px 8px;
  font-size: 0.7rem;
}
.view-mode-samples .focus-sample-list {
  height: 220px !important;
}
.modal-content.modal-compact {
  max-width: 440px !important;
}
.modal-compact .modal-body {
  padding: 25px;
}
.modal-compact .modal-body h2 {
  font-size: 1.2rem;
  margin-bottom: 15px;
}
.modal-compact .modal-body .nav-item {
  padding: 4px 10px;
  font-size: 0.75rem;
}
.modal-compact .modal-body div {
  font-size: 0.8rem !important;
  gap: 8px !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}