:root {
  --bg: #f4f1ea;
  --panel: #ffffff;
  --text: #2a2420;
  --muted: #7a6f63;
  --accent: #b5651d;
  --border: #e0d8cc;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px;
}

header h1 {
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-align: center;
  margin: 8px 0 20px;
}

section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.start-screen { text-align: center; }

.status-line { margin-bottom: 2px; }
.muted { color: var(--muted); font-size: 0.9rem; }
.actions-counter { font-weight: 600; margin-top: 6px; }

.outcome { font-style: italic; }

.transition {
  text-align: center;
  border-color: var(--accent);
  background: #fbf0e2;
}
.transition h2 { margin: 0 0 10px; font-size: 1.1rem; letter-spacing: 0.04em; color: var(--accent); }
.transition p { margin: 4px 0; }
.transition form { margin-top: 14px; }

.warning-one-action {
  text-align: center;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  margin: -4px 0 14px;
}

.epilogue {
  text-align: center;
  background: #2a2420;
  color: #f4f1ea;
  border-color: #2a2420;
}
.epilogue h2 { margin: 0 0 10px; letter-spacing: 0.08em; }
.epilogue p { text-align: left; white-space: pre-line; line-height: 1.5; }

.situation h2 { margin: 0 0 8px; font-size: 1.05rem; }
.situation p { margin: 0; line-height: 1.5; }

.choices { display: flex; flex-direction: column; gap: 8px; background: none; border: none; padding: 0; }
.choices form { margin: 0; }

button {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
  cursor: pointer;
  background: var(--panel);
}

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.btn-choice { text-align: left; }
.btn-choice:active { background: #f0e8da; }
.btn-secondary { background: none; color: var(--accent); }

.actions-remaining { text-align: center; color: var(--muted); font-size: 0.85rem; margin: -4px 0 14px; }

.life-log ul, .relationships ul, .tricks ul { margin: 6px 0 0; padding-left: 18px; }
.life-log li, .relationships li, .tricks li { margin-bottom: 4px; }
.life-log h3, .relationships h3, .tricks h3 { margin: 0; font-size: 0.9rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.restart { margin-top: 24px; }

.save-tools h3 { margin: 0 0 8px; font-size: 0.9rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.save-tools p { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.save-tools a.btn-secondary { display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; text-align: center; text-decoration: none; margin-bottom: 14px; }
.save-tools form { display: flex; flex-direction: column; gap: 8px; }
.save-tools label { font-size: 0.9rem; font-weight: 600; }
.save-tools input[type="file"] { width: 100%; font-size: 0.85rem; }


/* Full-screen title menu: artwork is the actual Dog Days key visual. */
html:has(.title-screen), body:has(.title-screen) {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: #24150f;
}
.title-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: 100svh;
  padding: 0 22px max(28px, env(safe-area-inset-bottom));
  overflow: hidden;
  isolation: isolate;
  background: #24150f;
}
.title-art {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}
.title-screen::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 48% 0 0;
  background: linear-gradient(180deg, transparent 0%, rgba(26, 13, 8, .24) 30%, rgba(26, 13, 8, .82) 100%);
}
.title-menu {
  width: min(100%, 430px);
  margin: 0 auto 8vh;
  text-align: center;
}
.title-menu form { margin: 0; }
.title-menu-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 62px;
  padding: 14px 26px;
  border: 2px solid #d89b48;
  border-radius: 5px;
  background: linear-gradient(180deg, #6b3517, #32190e);
  box-shadow: 0 4px 0 rgba(20, 10, 5, .7), inset 0 0 0 2px rgba(255, 211, 128, .13);
  color: #fff0ce;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-shadow: 0 2px 3px #1c0c06;
}
.title-menu-button:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(20, 10, 5, .7); }
.title-menu-note { margin: 16px 0 0; color: #fff0ce; font-size: .9rem; text-shadow: 0 2px 4px #160a05; }
.title-footer { color: #f8dfb0; font: 1rem Georgia, serif; letter-spacing: .04em; text-shadow: 0 2px 4px #160a05; }
@media (min-aspect-ratio: 5/4) {
  .title-screen { justify-content: flex-end; padding-bottom: 34px; }
  .title-art { object-position: center 44%; }
  .title-menu { margin-bottom: 20px; }
}
@media (max-width: 380px) {
  .title-menu { margin-bottom: 5vh; }
  .title-menu-button { min-height: 56px; font-size: 1.15rem; }
}

/* Phone layout: never crop the square key art into a narrow portrait viewport. */
@media (max-width: 700px) {
  .title-screen {
    justify-content: center;
    gap: 14px;
    min-height: 100svh;
    padding: max(12px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
    background: #24150f;
  }
  .title-art {
    position: relative;
    inset: auto;
    z-index: 0;
    display: block;
    flex: 0 1 auto;
    width: min(100%, 560px);
    height: auto;
    max-height: 62svh;
    margin: 0 auto;
    object-fit: contain;
    object-position: center;
  }
  .title-screen::after { display: none; }
  .title-menu {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: min(100%, 430px);
    margin: 0 auto;
  }
  .title-menu-button {
    min-height: 58px;
    padding: 12px 22px;
    font-size: 1.2rem;
  }
  .title-menu-note { margin-top: 10px; font-size: .85rem; }
  .title-footer { margin-top: 2px; font-size: .85rem; }
}

.character-roster { margin: 8px 0 0; padding-left: 20px; }
.character-sheet { margin: 5px 0 9px 0; font-size: 0.88rem; color: var(--muted); }
.character-sheet summary { cursor: pointer; font-weight: 600; }
.character-traits { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.character-traits span { border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px; font-size: 0.78rem; }


/* Compact settings drawer keeps backup and navigation tools out of gameplay. */
.game-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 0;
  margin: 0 0 18px;
  padding-right: 42px;
}
.game-header .game-logo {
  display: block;
  width: 100%;
  max-width: 680px;
  max-height: 180px;
  height: auto;
  object-fit: contain;
  object-position: center;
  margin: 0 auto;
}
.settings-menu { position: absolute; z-index: 20; top: 0; right: 0; }
.settings-menu > summary {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-size: 1.35rem;
  cursor: pointer;
  user-select: none;
}
.settings-menu > summary::-webkit-details-marker { display: none; }
.settings-menu[open] > summary { color: var(--accent); border-color: var(--accent); }
.settings-panel {
  position: absolute;
  top: 50px;
  right: 0;
  width: min( calc(100vw - 32px), 390px );
  max-height: min(78vh, 680px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 12px 32px rgba(30, 22, 15, .22);
}
.settings-panel h2 { margin: 0 0 12px; font-size: 1.1rem; }
.settings-panel .save-tools { margin: 0; }
.settings-panel .settings-action { margin-top: 10px; }
.settings-panel .settings-action button { width: 100%; }


/* Relationships and the life log are compact, collapsible game panels. */
.info-dropdown {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.info-dropdown > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}
.info-dropdown > summary::-webkit-details-marker { display: none; }
.info-dropdown > summary::before {
  content: "›";
  display: inline-block;
  color: var(--accent);
  font-size: 1.35rem;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform .15s ease;
}
.info-dropdown[open] > summary::before { transform: rotate(90deg); }
.info-dropdown ul { margin: 8px 0 0; padding-left: 20px; }
.info-dropdown li { margin-bottom: 6px; }

@media (max-width: 520px) {
  .game-header { padding-right: 38px; margin-bottom: 14px; }
  .game-header .game-logo { max-height: 150px; }
}

/* Keep the illustrated masthead compact and fully visible on narrow screens. */
.game-header { overflow: visible; }
.game-header .game-logo { flex: 0 1 auto; min-width: 0; }
