* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: #f4efe4;
  color: #2b241d;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 20px; }
.header { margin-bottom: 18px; }
.header h1 { margin-bottom: 4px; }
.header p { margin-top: 0; color: #6f6255; }
.card {
  background: #fffaf0;
  border: 2px solid #d9c7a7;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 4px 0 #cbb894;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.save {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
code {
  display: inline-block;
  background: #2b241d;
  color: #fff3c4;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 18px;
}
button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: #5d8f56;
  color: white;
  font-weight: 700;
  cursor: pointer;
}
button.secondary { background: #8a7b6a; }
input, select {
  width: 100%;
  padding: 10px;
  border: 2px solid #d9c7a7;
  border-radius: 10px;
  margin: 6px 0 12px;
  background: white;
}
.messages { margin-bottom: 12px; }
.message {
  background: #fff3c4;
  border: 2px solid #dfc467;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
}
.listitem {
  border-top: 1px dashed #d9c7a7;
  padding-top: 12px;
  margin-top: 12px;
}
.monster {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-top: 1px dashed #d9c7a7;
  padding-top: 12px;
  margin-top: 12px;
}
.sprite {
  width: 56px;
  height: 56px;
  border: 2px solid #2b241d;
  background: #e7dcc9;
  display: grid;
  place-items: center;
  font-weight: 900;
  image-rendering: pixelated;
  overflow: hidden;
}
.sprite img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  object-fit: contain;
}
.inventory {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.inventory span {
  background: #efe2ca;
  border-radius: 999px;
  padding: 8px 10px;
}
.mini { color: #6f6255; font-size: 13px; }
@media (max-width: 700px) {
  .grid { grid-template-columns: 1fr; }
  .save { display: block; }
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.nav a {
  display: inline-block;
  color: #2b241d;
  background: #efe2ca;
  border: 1px solid #d9c7a7;
  border-radius: 999px;
  padding: 6px 10px;
  text-decoration: none;
  font-weight: 700;
}
.searchbar {
  display: grid;
  grid-template-columns: 1fr 140px auto;
  gap: 8px;
  align-items: end;
}
.sourcebox {
  background: #fff5dc;
  border: 1px solid #d9c7a7;
  border-radius: 12px;
  padding: 10px;
  margin: 8px 0;
}
@media (max-width: 700px) {
  .searchbar { grid-template-columns: 1fr; }
}

button:disabled {
  background: #b9afa2;
  cursor: not-allowed;
  opacity: 0.7;
}

.inventory-list {
  display: grid;
  gap: 10px;
}
.sellrow {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px;
  align-items: center;
  background: #fff5dc;
  border: 1px solid #d9c7a7;
  border-radius: 12px;
  padding: 10px;
}
.sellform {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  align-items: center;
}
.sellform input {
  margin: 0;
}
@media (max-width: 700px) {
  .sellrow { grid-template-columns: 1fr; }
  .sellform { grid-template-columns: 1fr; }
}

.result-area {
  border-color: #b8945f;
}
.result-grid {
  display: grid;
  gap: 12px;
}
.result-card {
  background: #fff5dc;
  border: 2px solid #d9c7a7;
  border-radius: 14px;
  padding: 14px;
}
.result-card.success {
  box-shadow: inset 6px 0 0 #5d8f56;
}
.result-card.failure {
  box-shadow: inset 6px 0 0 #9b5d4f;
}
.result-card h3 {
  margin-top: 0;
}
.result-card form {
  margin-top: 10px;
}

.guide-card {
  background: #fff7df;
  border-color: #caa45f;
}
.hint-list {
  padding-left: 20px;
}
.hint-list li {
  margin: 6px 0;
}

.food-attrs {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.result-head {
  display: flex;
  gap: 12px;
  align-items: center;
}
.result-sprite {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  object-fit: contain;
  flex: 0 0 auto;
}
.mini-monster-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.mini-sprite {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  object-fit: contain;
  flex: 0 0 auto;
}
.mini-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}
.mini-roster-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff5dc;
  border: 1px solid #d9c7a7;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 13px;
}

.start-lock {
  background: #fff7df;
  border-color: #caa45f;
}

.rename-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.rename-form input {
  max-width: 160px;
  margin: 0;
}
.rename-form button {
  padding: 8px 10px;
}

.busy-note {
  color: #7a6045;
  font-weight: 700;
}


.guide-accordion {
  width: 100%;
}

.guide-accordion summary {
  list-style: none;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  padding: 0;
  color: #2f2a25;
}

.guide-accordion summary::-webkit-details-marker {
  display: none;
}

.guide-accordion summary::after {
  content: "＋";
  float: right;
  font-weight: 700;
}

.guide-accordion[open] summary::after {
  content: "－";
}

.guide-accordion > *:not(summary) {
  margin-top: 14px;
}


.contact-card {
  margin-bottom: 32px;
}

.contact-placeholder {
  font-weight: 700;
  color: #5f7f4f;
}


/* v0.1.77: readability adjustment */
.card p,
.card li,
.card label,
.card select,
.card input,
.card textarea {
  font-size: 16px;
  line-height: 1.75;
}

.card .mini,
.mini {
  font-size: 15px;
  line-height: 1.65;
}

.card h2 {
  margin-bottom: 18px;
}

.listitem p,
.monster p,
.sellrow p {
  font-size: 16px;
  line-height: 1.7;
}


/* v0.1.79: monster sprite layout fix */
.monster {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.sprite {
  width: 64px;
  height: 64px;
  min-width: 64px;
  display: grid;
  place-items: center;
  overflow: visible;
}

.sprite img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  object-position: center;
  image-rendering: pixelated;
}

@media (max-width: 520px) {
  .monster {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 14px;
  }

  .sprite {
    width: 58px;
    height: 58px;
    min-width: 58px;
  }

  .sprite img {
    width: 52px;
    height: 52px;
  }

  .rename-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .rename-form input {
    max-width: none;
    width: 100%;
  }
}


.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 800;
  vertical-align: middle;
}

.badge.craftable {
  background: #5c9a5c;
  color: #fff;
}


.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.checkbox-line input[type="checkbox"] {
  width: auto;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

button.danger {
  background: #b85b5b;
  color: #fff;
}


.helpbox {
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px dashed #d2bc93;
  border-radius: 14px;
  background: rgba(255, 248, 224, 0.7);
}

.helpbox p {
  margin-top: 0;
}

.helpbox ol {
  margin: 8px 0 0 1.3em;
  padding: 0;
}

.helpbox li {
  margin: 4px 0;
}


.discord-card details {
  width: 100%;
}

.discord-card summary {
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 800;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.discord-card summary::-webkit-details-marker {
  display: none;
}

.discord-card summary::after {
  content: "＋";
  font-weight: 900;
}

.discord-card details[open] summary::after {
  content: "－";
}

.discord-card .details-body {
  margin-top: 14px;
}


.inline-form {
  display: inline-block;
  margin-top: 8px;
}

.site-footer {
  max-width: 980px;
  margin: 18px auto 32px;
  padding: 12px 16px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.92rem;
}

.site-footer a {
  text-decoration: none;
  font-weight: 700;
}

.legal-page h1 {
  margin-top: 0;
}

.legal-page h2 {
  margin-top: 1.4em;
}

.legal-page ul {
  padding-left: 1.3em;
}

.contact-box {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 248, 224, 0.8);
  margin: 14px 0;
}


.inventory-card details {
  width: 100%;
}

.inventory-card summary {
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 800;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inventory-card summary::-webkit-details-marker {
  display: none;
}

.inventory-card summary::after {
  content: "＋";
  font-weight: 900;
}

.inventory-card details[open] summary::after {
  content: "－";
}

.inventory-card .details-body {
  margin-top: 14px;
}

.inventory-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.inventory-filter-button {
  border: 1px solid #d2bc93;
  background: rgba(255, 248, 224, 0.85);
  color: #2b2520;
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}

.inventory-filter-button.active {
  background: #5c9a5c;
  color: #fff;
  border-color: #5c9a5c;
}


.save-code-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.save-code-row code {
  word-break: break-all;
}

.copy-save-code-button {
  padding: 6px 10px;
  font-size: 0.9rem;
}


.compact-idle-list {
  margin: 12px 0 14px;
  border-top: 1px solid rgba(120, 96, 64, 0.22);
}

.compact-idle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(120, 96, 64, 0.18);
}

.compact-idle-text {
  flex: 1;
  min-width: 0;
  line-height: 1.5;
}

.compact-idle-row form {
  margin: 0;
}

.compact-call-button {
  padding: 6px 10px;
  white-space: nowrap;
}


.all-idle-return-form {
  margin-top: 12px;
}

.all-idle-return-button {
  width: 100%;
  padding: 8px 12px;
}


.guide-entry {
  margin-bottom: 12px;
}

.guide-entry h3 {
  margin-top: 0;
}


.unknown-monster-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 1.6rem;
  font-weight: 900;
  background: rgba(80, 72, 65, 0.18);
  color: rgba(45, 38, 32, 0.72);
}

.nav-card p {
  margin: 0;
}


.monster-dex-entry {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.monster-dex-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.monster-dex-title-sprite {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: auto;
}
