:root {
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color: #242b33;
  background: #f6f7f8;
  font-synthesis: none;
  color-scheme: light;
}

* { box-sizing: border-box; }

body { margin: 0; }

button, input, textarea { font: inherit; }

[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.page {
  width: min(1120px, calc(100% - 80px));
  margin: 48px auto 32px;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  margin: 0;
  color: #48515c;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.screen-tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  margin-bottom: 24px;
  padding: 4px;
  border: 1px solid #dfe3e7;
  border-radius: 10px;
  background: #e9edf0;
}

.screen-tab {
  min-width: 120px;
  min-height: 44px;
  padding: 10px 24px;
  border: 0;
  border-radius: 7px;
  color: #626d79;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.screen-tab[aria-selected="true"] {
  color: #2d485c;
  background: #fff;
  box-shadow: 0 1px 4px rgb(32 43 56 / 8%);
}

.screen-tab:hover:not(:disabled) { color: #213b4f; }

.profile {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  overflow: hidden;
  background: #fff;
  border: 1px solid #dfe3e7;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgb(32 43 56 / 3%);
}

.image-region {
  min-height: 360px;
  background: #fff;
}

.profile-details {
  min-width: 0;
  padding: 36px 40px 24px;
  border-left: 1px solid #edf0f2;
}

.name-section {
  padding-bottom: 26px;
}

.field-label {
  margin: 0 0 8px;
  color: #626d79;
  font-size: 13px;
}

h1 {
  margin: 0 0 20px;
  font-size: 28px;
  line-height: 1.5;
  font-weight: 600;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.button {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}

.button-secondary {
  color: #384553;
  background: #fff;
  border-color: #cbd2d9;
}

.button-secondary:hover { background: #f4f6f8; }

.button-primary {
  min-width: 88px;
  color: #fff;
  background: #2d485c;
}

.button-primary:hover { background: #213b4f; }

.button-danger { color: #fff; background: #923c39; }
.button-danger:hover { background: #7a302d; }

button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #8eb9d5;
  outline-offset: 3px;
}

.name-editor label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.name-editor input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #aab5c0;
  border-radius: 7px;
  color: #242b33;
  background: #fff;
  font-size: 16px;
}

.name-editor input[aria-invalid="true"] { border-color: #b12c35; }

.input-hint {
  margin: 8px 0 0;
  color: #626d79;
  font-size: 12px;
  line-height: 1.6;
}

.input-error {
  margin: 8px 0 0;
  color: #a5232d;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.input-error:empty { display: none; }

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

.stats { margin: 0; }

.reset-actions { margin-top: 20px; padding-top: 20px; border-top: 1px solid #edf0f2; text-align: right; }

.stat-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  column-gap: 20px;
  min-height: 51px;
  padding: 14px 0;
  border-top: 1px solid #edf0f2;
}

.stat-row dt {
  color: #626d79;
  font-size: 14px;
  line-height: 1.6;
}

.stat-row dd {
  min-width: 0;
  margin: 0;
  text-align: right;
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.species-row dd { font-size: 15px; }

.unit {
  color: #626d79;
  font-size: 13px;
  font-weight: 400;
}

.save-status {
  margin: 0 0 14px;
  color: #48515c;
  text-align: right;
  font-size: 13px;
}

.noscript-message { font-size: 14px; }

button:disabled { cursor: not-allowed; opacity: 0.5; }
input:disabled, textarea:disabled { background: #f4f6f8; }
#load-status:empty, .storage-message:empty, .save-status:empty { display: none; }
.storage-message { padding: 14px 18px; border: 1px solid #ead8d6; border-radius: 8px; background: #fff8f6; color: #8c2e29; font-size: 14px; line-height: 1.8; }
.content-card { padding: 32px 40px; background: #fff; border: 1px solid #dfe3e7; border-radius: 16px; }
h2 { margin: 0; font-size: 21px; font-weight: 600; line-height: 1.6; }
.section-heading { margin-bottom: 28px; }
.section-heading p { margin: 8px 0 0; color: #626d79; font-size: 14px; }
.manuscript-label { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
textarea { display: block; width: 100%; min-height: 240px; padding: 16px; resize: vertical; border: 1px solid #aab5c0; border-radius: 8px; color: #242b33; background: #fff; font-size: 16px; line-height: 1.9; }
textarea[aria-invalid="true"] { border-color: #b12c35; }
.character-counts { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 12px; font-size: 13px; color: #48515c; font-variant-numeric: tabular-nums; }
.manuscript-hint { max-width: 820px; margin: 18px 0 0; font-size: 13px; line-height: 1.9; color: #626d79; }
.deliver-button { margin-top: 24px; padding: 12px 24px; min-height: 48px; }
.result-card {
  width: min(960px, calc(100% - 48px));
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 32px 40px;
  overflow: auto;
  overscroll-behavior: contain;
  color: #242b33;
  background: #fff;
  border: 1px solid #cfdadf;
  border-radius: 16px;
  box-shadow: 0 16px 64px rgb(16 28 40 / 20%);
}
.result-card::backdrop { background: rgb(24 36 48 / 45%); }
body:has(.result-card[open]) { overflow: hidden; }
.result-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; }
.result-actions .input-hint { margin: 0; }
.reset-card { width: min(560px, calc(100% - 48px)); }
.reset-target { margin: 20px 0 12px; font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; white-space: pre-wrap; }
.reset-description { margin: 0; font-size: 14px; line-height: 1.9; }
.reset-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 28px; }
.result-thanks { margin: 16px 0 12px; line-height: 1.9; font-size: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
.result-list { margin: 24px 0 16px; }
.result-row { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 8px; margin: 0; padding: 15px 0; border-top: 1px solid #edf0f2; font-size: 16px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.result-label { min-width: 7em; color: #626d79; font-size: 14px; }
.result-after { font-weight: 600; }
.result-delta { color: #315e50; }
.limit-note { font-size: 12px; color: #755931; }
.limit-note:empty { display: none; }

.acquired-skills { margin-top: 24px; }
.save-transfer { margin-top: 24px; }
.transfer-description { margin: 14px 0 0; color: #48515c; font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }
.dictionary-transfer { margin-bottom: 32px; padding-bottom: 28px; border-bottom: 1px solid #edf0f2; }
.dictionary-transfer h3 { margin: 0; font-size: 18px; line-height: 1.6; }
.restore-card { width: min(680px, calc(100% - 48px)); }
.restore-summary { margin: 24px 0 0; }
.restore-notice { margin: 20px 0 0; padding: 12px 16px; border-radius: 8px; background: #fffaf0; color: #755931; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; white-space: pre-line; }
#save-restore-file, #save-restore-date { overflow-wrap: anywhere; }
#save-transfer-status:empty, #dictionary-transfer-status:empty { display: none; }
.skills-list { list-style: none; margin: 20px 0 0; padding: 0; }
.skills-list li { min-width: 0; padding: 18px 0; border-top: 1px solid #edf0f2; }
.skills-list li:last-child { padding-bottom: 0; }
.skill-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.skill-level { margin-left: 0.35em; }
.skill-flavor { margin: 6px 0 0; color: #48515c; font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; white-space: pre-wrap; }
.skills-empty { margin: 16px 0 0; color: #626d79; font-size: 14px; line-height: 1.8; }
.result-skills { margin-top: 28px; padding-top: 24px; border-top: 1px solid #dfe3e7; }
.result-skills h3 { margin: 0; font-size: 18px; line-height: 1.6; }

.food-section + .food-section { margin-top: 36px; padding-top: 30px; border-top: 1px solid #edf0f2; }
.food-section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.food-section-heading h3 { margin: 0; font-size: 18px; line-height: 1.6; }
.food-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.food-field { min-width: 0; }
.food-field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.food-input { min-width: 0; min-height: 132px; padding: 12px; overflow-wrap: anywhere; white-space: pre-wrap; }
.food-skills-input { min-height: 300px; }
.food-skills-hint { margin: 0 0 12px; }
.food-field-count { margin: 6px 0 0; color: #626d79; font-size: 12px; font-variant-numeric: tabular-nums; }
.food-warning { margin: 8px 0 0; color: #755931; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.food-field .input-error, .food-warning { white-space: pre-line; }
.food-warning:empty, #food-status:empty { display: none; }
.food-conflict { margin-top: 28px; padding: 16px; border: 1px solid #dbc8a5; border-radius: 8px; background: #fffaf0; }
.food-conflict p { margin: 0; font-size: 14px; line-height: 1.8; }
.food-actions { margin-top: 24px; }
.food-confirm-description { margin-top: 20px; }
#food-editor { scroll-margin-top: 16px; }

@media (max-width: 1100px) {
  .profile { grid-template-columns: minmax(0, 0.65fr) minmax(0, 1.35fr); }
  .profile-details { padding-right: 32px; padding-left: 32px; }
}

@media (max-width: 700px) {
  .page { width: calc(100% - 32px); margin-top: 28px; }
  .screen-tabs { width: 100%; }
  .screen-tab { flex: 1 1 0; min-width: 0; padding-right: 8px; padding-left: 8px; }
  .profile { grid-template-columns: minmax(0, 1fr); }
  .image-region { min-height: 180px; }
  .profile-details { border-left: 0; border-top: 1px solid #edf0f2; padding: 28px 24px 16px; }
  h1 { font-size: 25px; }
  .stat-row { column-gap: 12px; }
  .stat-row dd { font-size: 16px; }
  .content-card { padding: 24px; }
  .result-card { width: calc(100% - 32px); max-height: calc(100dvh - 32px); padding: 24px; }
  .result-row { font-size: 14px; }
  .result-label { flex-basis: 100%; }
  .food-fields { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .food-section-heading { align-items: flex-start; }
  .food-section-heading .button { max-width: 100%; }
  .food-actions .button { flex: 1 1 auto; }
}
