:root {
  --bg: #f4f6f4;
  --panel: #ffffff;
  --panel-soft: #eef3ef;
  --ink: #23302c;
  --muted: #65716d;
  --line: #d9e1dc;
  --accent: #376658;
  --accent-deep: #264d42;
  --mark: #a75257;
  --used: #f0f2f1;
  --shadow: 0 12px 34px rgba(35, 48, 44, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  line-height: 1.75;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(100%, 520px);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-visual {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.35;
}

.auth-card h1 {
  margin-bottom: 24px;
  font-size: 1.7rem;
}

.auth-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

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

.password-row input {
  min-width: 0;
  flex: 1;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.password-row button,
.primary-button,
.ghost-button {
  border: 0;
  border-radius: 8px;
  font-weight: 700;
}

.password-row button,
.primary-button {
  padding: 11px 18px;
  color: #fff;
  background: var(--accent);
}

.password-row button:hover,
.primary-button:hover {
  background: var(--accent-deep);
}

.auth-error {
  min-height: 1.6em;
  margin: 8px 0 0;
  color: var(--mark);
  font-weight: 700;
}

.auth-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.app {
  width: min(1440px, 100%);
  height: 100vh;
  margin: 0 auto;
  padding: 24px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h1 {
  font-size: 1.8rem;
}

.ghost-button {
  padding: 9px 14px;
  color: var(--accent-deep);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 25%) 1fr;
  gap: 22px;
  align-items: start;
  height: calc(100vh - 112px);
  min-height: 0;
}

.sidebar {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 112px);
  padding: 18px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sidebar h2 {
  margin-bottom: 14px;
  font-size: 1rem;
}

.category-list {
  display: grid;
  gap: 6px;
}

.category-button {
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  border-radius: 8px;
}

.category-button:hover {
  background: var(--panel-soft);
}

.category-button.is-active {
  font-weight: 700;
  background: var(--panel-soft);
  border-color: var(--line);
  border-left-color: var(--accent);
}

.content {
  min-width: 0;
  min-height: 0;
}

.view {
  height: calc(100vh - 112px);
  overflow-y: auto;
  padding-right: 4px;
}

.list-header,
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.list-header h2,
.detail-header h2 {
  font-size: 1.55rem;
}

.count {
  margin: 4px 0 0;
  color: var(--muted);
}

.topic-list {
  display: grid;
  gap: 12px;
}

.topic-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  width: 100%;
  padding: 18px;
  color: inherit;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(35, 48, 44, 0.04);
  cursor: pointer;
}

.topic-card:hover {
  border-color: #b8c8c0;
}

.topic-card:focus-visible {
  outline: 3px solid rgba(55, 102, 88, 0.3);
  outline-offset: 2px;
}

.topic-card.is-used {
  background: var(--used);
  color: #74807b;
}

.topic-card h3 {
  margin-bottom: 6px;
  font-size: 1.08rem;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.used-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.used-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.used-label {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 8px;
  color: var(--accent-deep);
  background: var(--panel-soft);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.empty {
  padding: 28px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-shell {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.section-block {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.section-block h3 {
  color: var(--accent-deep);
  font-size: 1rem;
}

.copy-button {
  flex: 0 0 auto;
  padding: 5px 10px;
  color: var(--accent-deep);
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
}

.copy-button:hover {
  background: var(--panel-soft);
}

.blueprint {
  padding: 18px;
  margin-bottom: 4px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  white-space: pre-wrap;
}

.talk-main {
  font-size: 1.08rem;
  line-height: 1.95;
}

.small-blocks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mini-block {
  padding: 16px;
  background: #fafbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.keywords li {
  padding: 4px 9px;
  background: var(--panel-soft);
  border-radius: 8px;
  color: var(--accent-deep);
  font-weight: 700;
}

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

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    padding: 16px;
    overflow: visible;
  }

  .topbar,
  .list-header,
  .detail-header {
    flex-direction: column;
    align-items: stretch;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .view {
    height: auto;
    overflow: visible;
    padding-right: 0;
  }

  .category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-button {
    min-height: 48px;
  }

  .topic-card {
    grid-template-columns: 1fr;
  }

  .small-blocks {
    grid-template-columns: 1fr;
  }

  .section-title-row {
    align-items: flex-start;
  }

  .password-row {
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .category-list {
    grid-template-columns: 1fr;
  }

  .auth-card,
  .detail-shell {
    padding: 18px;
  }
}
