:root {
  color-scheme: light;
  --bg: #f7f8fc;
  --card: #ffffff;
  --line: #dde2ef;
  --text: #1f2a44;
  --muted: #5b6580;
  --primary: #3e63dd;
  --danger: #cf3c3c;
}

* {
  box-sizing: border-box;
}

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

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.75rem;
}

.app-header p {
  margin-top: 8px;
  color: var(--muted);
}

.top-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.editor-list {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.editor-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

button {
  border: 1px solid #c7d1eb;
  background: #eef3ff;
  color: #1c377f;
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
  font-size: 0.92rem;
}

button:hover:enabled {
  filter: brightness(0.97);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.primary-button {
  background: var(--primary);
  color: #fff;
  border-color: #3754b5;
  font-weight: 700;
}

.danger-button {
  border-color: #dd9d9d;
  background: #fdecec;
  color: #8c1f1f;
  font-weight: 700;
}

.survey-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #9fc3a8;
  background: #eaf9ee;
  color: #1f6b32;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.survey-link:hover {
  filter: brightness(0.98);
}

.editor-label {
  display: grid;
  gap: 8px;
}

.editor-title {
  font-weight: 700;
  font-size: 0.95rem;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 140px;
  font: inherit;
  line-height: 1.6;
  border-radius: 8px;
  border: 1px solid #bdc7e2;
  padding: 10px;
}

textarea:focus,
.modal-panel input:focus {
  outline: 2px solid #9db1f8;
  border-color: #7d98ed;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  font-size: 0.9rem;
}

.warning {
  color: var(--danger);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.warning[hidden] {
  display: none;
}

.split-button {
  background: #ffe7e7;
  border-color: #f0adad;
  color: #8f2525;
}

.editor-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.copy-button {
  background: #eef4ff;
  border-color: #b9caee;
}

.copy-feedback {
  color: #2d5a2d;
  font-size: 0.86rem;
  min-height: 1em;
}

.global-actions {
  margin-top: 18px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 14px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 15, 30, 0.55);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

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

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

.modal-close {
  font-size: 1.1rem;
  min-width: 42px;
}

.modal-label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal-panel input {
  width: 100%;
  font: inherit;
  border: 1px solid #bdc7e2;
  border-radius: 8px;
  padding: 10px;
}

.modal-hint {
  margin: 8px 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 46vh;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.search-result-button {
  width: 100%;
  text-align: left;
  background: #f2f6ff;
}

.search-empty {
  color: var(--muted);
  padding: 10px;
  border: 1px dashed #c2cce4;
  border-radius: 8px;
}

@media (max-width: 640px) {
  .app {
    padding: 16px 12px 30px;
  }

  .app-header h1 {
    font-size: 1.4rem;
  }

  .status-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .toolbar button {
    width: 100%;
    padding: 6px 4px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .editor-actions button,
  .top-actions button,
  .top-actions .survey-link,
  .global-actions button {
    width: 100%;
  }

  .editor-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .modal-panel {
    padding: 12px;
  }
}
