:root {
  --bg-1: #f7f3e8;
  --bg-2: #d9e7f5;
  --bg-3: #fef6e8;
  --ink: #14213d;
  --muted: #4d5b73;
  --card: rgba(255, 255, 255, 0.9);
  --line: #c2d2e2;
  --folder: #d97706;
  --file: #0369a1;
  --accent: #0f766e;
  --danger: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, #fff9ef 0%, transparent 40%),
    radial-gradient(circle at 90% 5%, #d7f4ef 0%, transparent 35%),
    radial-gradient(circle at 50% 110%, #ffe9ca 0%, transparent 45%),
    linear-gradient(120deg, var(--bg-1), var(--bg-2) 58%, var(--bg-3));
}

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

.hero {
  animation: fadeUp 420ms ease-out both;
}

.hero-logo {
  width: auto;
  height: 8rem;
  object-fit: contain;
  /* border-radius: 16px;
  box-shadow: 0 10px 20px rgba(20, 33, 61, 0.16); */
  margin-bottom: 12px;
}

h1 {
  margin: 0;
  font-size: 1.9rem;
}

.meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  margin-top: 14px;
  border-radius: 18px;
  padding: 16px;
  background: var(--card);
  box-shadow: 0 20px 40px rgba(20, 33, 61, 0.12);
  backdrop-filter: blur(6px);
  animation: fadeUp 640ms ease-out both;
}

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

.editor-actions {
  display: flex;
  gap: 8px;
}

#editorFavoriteButton.active {
  color: #d97706;
  border-color: #e7b85e;
  background: #ffe9b5;
}

.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 1.05rem;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: #8cb4d3;
  background: #f4fbff;
}

.icon-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.breadcrumb {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fcff;
  padding: 8px 10px;
  font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.item {
  margin: 0;
}

.item-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  padding: 11px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.item-button:hover {
  border-color: #8cb4d3;
  transform: translateY(-1px);
}

.item-button.folder {
  border-left: 5px solid color-mix(in srgb, var(--folder) 75%, white);
}

.item-button.file {
  border-left: 5px solid color-mix(in srgb, var(--file) 75%, white);
}

.item-name {
  font-weight: 700;
}

.favorite-btn {
  border: 1px solid #f2d28d;
  background: #fff8e1;
  color: #9a6700;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.favorite-btn:hover {
  background: #ffefc7;
}

.favorite-btn.active {
  color: #d97706;
  border-color: #e7b85e;
  background: #ffe9b5;
}

.favorite-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.order-btn {
  border: 1px solid var(--line);
  background: #f7fbff;
  color: var(--ink);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  line-height: 1;
  cursor: pointer;
}

.order-btn:hover:not(:disabled) {
  background: #eaf6ff;
}

.order-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.item-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.editor-view .toolbar {
  margin-bottom: 12px;
}

.file-content {
  width: 100%;
  min-height: 52vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  color: #122238;
  font-size: 0.97rem;
  font-family: "BIZ UDゴシック", "Noto Sans Mono CJK JP", monospace;
  line-height: 1.62;
  resize: vertical;
}

.file-content:read-only {
  background: #f7fbff;
}

.hidden {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(14px);
  border-radius: 10px;
  padding: 10px 14px;
  background: #1e293b;
  color: #fff;
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--danger);
}

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

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

  h1 {
    font-size: 1.6rem;
  }

  .card {
    border-radius: 14px;
    padding: 12px;
  }

  .item-button {
    flex-direction: column;
    align-items: flex-start;
  }

  .file-content {
    min-height: 46vh;
  }
}
