:root {
  --paper: #cdbb91;
  --paper2: #e0cfaa;
  --ink: #241f19;
  --dark: #25231e;
  --line: #5b4a32;
  --gold: #d4a83f;
  --red: #b84f3d;
  --green: #768b55;
  --muted: #877b64;
}


/* =========================================================
   基本
========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: #161612;
  color: var(--ink);
  font-family: Georgia, "Hiragino Mincho ProN", serif;
}

body {
  min-height: 100vh;
}


/* =========================================================
   ゲーム画面
========================================================= */

.game-view {
  display: block;
}

.game-view[hidden] {
  display: none !important;
}


/* =========================================================
   上部バー
========================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;

  display: grid;
  grid-template-columns: 90px 1fr 48px;
  gap: 8px;

  padding: 10px;

  background: #211f1a;
  border-bottom: 3px solid #5e4e37;
}

.day-card {
  background: var(--paper2);

  border: 2px solid #5b4a32;
  border-radius: 7px;

  text-align: center;

  padding: 5px;

  box-shadow:
    inset 0 0 0 2px #b7a477;
}

.day-card #day {
  font-weight: bold;
  font-size: 19px;
}

.day-card small {
  font-size: 12px;
}


/* =========================================================
   資源
========================================================= */

.resources {
  display: flex;

  align-items: center;
  justify-content: space-around;

  color: #eee;

  font-size: 16px;

  gap: 5px;
}

.res {
  white-space: nowrap;
}


/* =========================================================
   メニューボタン
========================================================= */

.menu-btn {
  width: 42px;
  height: 42px;

  padding: 0;
  border: none;

  background: transparent;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
}

.menu-btn img {
  width: 100%;
  height: 100%;

  object-fit: contain;
  display: block;

  pointer-events: none;
}


/* =========================================================
   キャラクター・ステータス
========================================================= */

.status-row {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 8px;

  padding: 8px;

  background: #292720;
}

.status-card {
  border: 2px solid #574936;

  border-radius: 6px;

  padding: 8px;

  background: #302e28;

  color: #eee;
}

.status-title {
  display: flex;
  align-items: center;
  justify-content: space-between;

  font-size: 14px;
  margin-bottom: 5px;
}

.status-title b {
  float: right;
}

.status-card small {
  color: #bcae8d;

  font-size: 10px;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-icon {
  width: 30px;
  height: 30px;

  object-fit: contain;
  display: block;

  flex-shrink: 0;
}


/* =========================================================
   ステータスバー
========================================================= */

.bar {
  height: 13px;

  background: #171613;

  border: 1px solid #0e0e0d;

  border-radius: 3px;

  overflow: hidden;
}

.bar i {
  display: block;

  height: 100%;
  width: 100%;

  background: #d49f37;

  transition: 0.25s;
}

.bar.life i {
  background: #b44c3b;
}


/* =========================================================
   共通パネル
========================================================= */

.map-panel,
.log-panel,
.base-panel {
  margin: 8px;

  border: 2px solid #4f402d;

  background: var(--paper);

  box-shadow:
    0 2px 0 #171510;
}

.section-head {
  display: flex;

  justify-content: space-between;
  align-items: center;

  padding: 7px 10px;

  border-bottom: 2px solid #796647;

  background:
    rgba(255, 255, 255, 0.08);
}

h2 {
  font-size: 17px;
  margin: 0;
}

.section-head span,
.section-head button {
  font-size: 11px;

  color: #62553e;
}

.section-head button {
  background: none;
  border: 0;

  cursor: pointer;
}


/* =========================================================
   拠点施設
========================================================= */

.base-panel {
  padding-bottom: 10px;
}

.facility-grid {
  padding: 9px;

  display: grid;

  grid-template-columns:
    repeat(3, 1fr);

  gap: 7px;
}

.facility {
  min-height: 145px;

  background: #d3c09a;

  border: 2px solid #786545;

  padding: 6px;

  text-align: center;

  position: relative;
}

.facility.locked {
  background: #77715f;

  color: #29261f;
}

.facility .icon {
  font-size: 42px;
}

.facility h3 {
  font-size: 14px;

  margin: 2px 0;
}

.facility p {
  font-size: 10px;

  margin: 3px 0 7px;

  min-height: 25px;
}

.facility button {
  width: 100%;

  background: #5b482c;

  color: #f2e4c4;

  border: 1px solid #332717;

  padding: 6px;

  font-family: inherit;

  font-weight: bold;
}

.facility button:disabled {
  opacity: 0.45;
}


/* =========================================================
   探索開始ボタン
========================================================= */

.explore-start-btn:active {
  transform: translateY(1px);
}

.explore-start-text strong {
  font-size: 19px;
}

.explore-start-text small {
  font-size: 11px;

  color: #5c4a32;
}


/* =========================================================
   探索ヘルプ
========================================================= */

.explore-help {
  padding: 7px 10px;

  background: #bca77d;

  border-bottom: 1px solid #756143;

  font-size: 11px;

  color: #5e5039;
}


/* =========================================================
   戻るボタン
========================================================= */

#backToBase {
  background: #b5a37e;

  border: 1px solid #6b5839;

  padding: 5px 8px;

  border-radius: 4px;

  cursor: pointer;
}


/* =========================================================
   六角形マップ
========================================================= */

.hex-map {
  position: relative;

  height: 440px;

  overflow: auto;

  background:
    radial-gradient(
      circle at center,
      #786f59 0,
      #4a4639 45%,
      #302f29 100%
    );

  -webkit-overflow-scrolling: touch;

  touch-action: pan-x pan-y;
}

.hex-world {
  position: relative;
  background:
    radial-gradient(
      circle at center,
      #2b332d 0%,
      #1b211d 45%,
      #0d100f 100%
    );
}


/* =========================================================
   六角形
========================================================= */

.hex {
  position: absolute;

  width: 112px;
  height: 129px;

  clip-path: polygon(
    25% 3%,
    75% 3%,
    100% 50%,
    75% 97%,
    25% 97%,
    0 50%
  );

  background: #57564c;

  filter:
    drop-shadow(
      0 2px 1px #201f1a
    );

  cursor: default;
}

.hex::before {
  content: "";
  position: absolute;
  inset: 4px;
  clip-path: inherit;
  border: none;
  background:
    var(
      --tile,
      #5f674e
    );
  z-index: 0;
}

.hex .inside {
  position: absolute;

  inset: 8px;

  display: flex;

  align-items: center;

  justify-content: center;

  flex-direction: column;

  font-size: 13px;

  font-weight: bold;

  text-shadow:
    0 1px #eee8d5;

  color: #252218;

  z-index: 2;

  pointer-events: none;
}


/* =========================================================
   未探索
========================================================= */

.hex.unexplored {
  --tile: #393832;

  cursor: default;
}

.hex.unexplored .inside {
  font-size: 12px;

  color: #c5c0ad;

  text-shadow:
    0 1px 2px #1c1b18;
}


/* =========================================================
   探索可能
========================================================= */

.hex.available {
  cursor: pointer;

  animation:
    pulse 1.6s infinite;
}


/* =========================================================
   地形カラー
========================================================= */

.hex.base {
  --tile: #88745a !important;
}

.hex.forest {
  --tile: #566345;
}

.hex.rock {
  --tile: #76715e;
}

.hex.pond {
  --tile: #54727a;
}

.hex.grass {
  --tile: #817d52;
}

.hex.cave {
  --tile: #4e4b45;
}

.hex.waste {
  --tile: #75684a;
}


/* =========================================================
   拠点
========================================================= */

.hex.base .inside {
  color: #fff1c4;

  text-shadow:
    0 1px 2px #2b2115,
    0 0 4px #2b2115;
}

.hex.base .terrain-icon {
  font-size: 40px;
}


/* =========================================================
   秘宝
========================================================= */

.hex[data-treasure="true"] {
  --tile: #6c5b36 !important;
}

.hex[data-treasure="true"] .inside {
  color: #ffe9a0;
}

.hex[data-treasure="true"] .terrain-icon {
  font-size: 40px;
}


/* =========================================================
   アニメーション
========================================================= */

@keyframes pulse {
  50% {
    transform: scale(1.025);
  }
}

.terrain-icon {
  font-size: 35px;

  line-height: 1;
}


/* =========================================================
   探索ログ
========================================================= */

.log-panel {
  max-height: 180px;
}

.log-panel #log {
  padding: 8px 12px;

  min-height: 90px;

  font-size: 13px;

  line-height: 1.7;
}

.log-item {
  border-bottom:
    1px dashed #887554;
}


/* =========================================================
   モーダル
========================================================= */

.modal-backdrop {
  position: fixed;

  inset: 0;

  z-index: 100;

  background:
    rgba(10, 9, 7, 0.72);

  display: flex;

  align-items: flex-end;

  justify-content: center;

  padding: 18px;

  opacity: 0;

  transition:
    opacity 0.16s ease;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop.show {
  opacity: 1;
}

.explore-modal {
  width: min(430px, 100%);

  max-height: 90vh;

  overflow: auto;

  background: var(--paper2);

  border: 3px solid #4d3e2a;

  box-shadow:
    0 10px 40px #000,
    inset 0 0 0 2px #a88f61;

  color: var(--ink);

  transform:
    translateY(12px)
    scale(0.98);

  transition:
    transform 0.16s ease;
}

.modal-backdrop.show
.explore-modal {
  transform:
    translateY(0)
    scale(1);
}

.modal-head {
  display: flex;

  align-items: center;

  justify-content: space-between;

  padding: 13px 15px 10px;

  background: #28251f;

  color: #ead9ae;

  border-bottom:
    2px solid #715a38;
}

.modal-head small {
  font-size: 11px;

  color: #bbaa86;
}

.modal-head h2 {
  font-size: 22px;

  margin: 2px 0 0;

  color: #f0ddb0;
}

.modal-close {
  width: 34px;
  height: 34px;

  border: 1px solid #8e754b;

  background: #40392d;

  color: #e8d7ae;

  border-radius: 4px;

  font-size: 25px;

  line-height: 1;

  cursor: pointer;
}

.explore-preview {
  display: flex;

  align-items: center;

  gap: 16px;

  padding: 18px 16px;

  border-bottom:
    1px solid #9c8358;

  background:
    rgba(255, 255, 255, 0.12);
}

.target-icon {
  width: 82px;
  height: 82px;

  display: flex;

  align-items: center;
  justify-content: center;

  font-size: 52px;

  background: #7c765f;

  border:
    3px solid #5d4c32;

  clip-path: polygon(
    25% 3%,
    75% 3%,
    100% 50%,
    75% 97%,
    25% 97%,
    0 50%
  );
}


/* =========================================================
   探索モーダルのアイコン
========================================================= */

.target-icon img {
  width: 100%;
  height: 100%;

  object-fit: contain;
  display: block;
}

.target-cost-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.target-cost-item img {
  width: 30px;
  height: 30px;

  object-fit: contain;
  display: block;

  flex-shrink: 0;
}

.target-info {
  display: flex;

  flex-direction: column;

  gap: 6px;
}

.target-info strong {
  font-size: 18px;
}

.target-info span {
  font-size: 12px;

  color: #685a43;
}

.preview-section {
  padding: 12px 15px 0;
}

.preview-section h3 {
  font-size: 14px;

  margin:
    0 0 8px;

  border-bottom:
    1px dashed #927951;

  padding-bottom: 5px;
}

.preview-row {
  display: flex;

  gap: 7px;

  flex-wrap: wrap;
}

.cost-pill {
  display: inline-flex;

  align-items: center;

  gap: 5px;

  padding: 8px 10px;

  border:
    1px solid #806746;

  background: #c8b487;

  font-size: 12px;
}

.cost-pill b {
  font-size: 14px;
}

.damage-cost {
  background: #caa08f;
}

.safe-cost {
  background: #b7bd93;
}

.resource-preview {
  display: block;
}

.resource-preview-normal,
.resource-preview-rare {
  display: flex;
  align-items: center;
  flex-wrap: wrap;

  gap: 14px;
}

.resource-preview-rare {
  margin-top: 10px;
}

.resource-inline {
  display: flex;
  align-items: center;

  gap: 4px;
}

.resource-inline img {
  width: 30px;
  height: 30px;

  object-fit: contain;
  display: block;
}

.resource-inline span {
  font-size: 14px;
  font-weight: bold;

  white-space: nowrap;
}

.rare-resource span {
  font-size: 18px;
}

.preview-note {
  font-size: 10px;

  color: #6d604b;

  margin: 8px 0 0;

  line-height: 1.5;
}

.empty-preview {
  font-size: 12px;

  color: #6c604e;

  padding: 10px;

  background: #c4b083;
}

.modal-actions {
  display: grid;

  grid-template-columns:
    1fr 1.6fr;

  gap: 8px;

  padding: 16px;
}

.modal-actions button {
  font-family: inherit;

  font-weight: bold;

  font-size: 14px;

  padding: 11px;

  border-radius: 4px;

  cursor: pointer;
}

.secondary-btn {
  background: #b5a37e;

  border:
    2px solid #6b5839;

  color: #3a3023;
}

.primary-btn {
  background: #5a472d;

  border:
    2px solid #342718;

  color: #f1dfb5;

  box-shadow:
    inset 0 0 0 1px #967b4e;
}

.primary-btn:active,
.secondary-btn:active {
  transform:
    translateY(1px);
}


/* =========================================================
   スタート画面
========================================================= */

.start-screen {
  position: fixed;

  inset: 0;

  background: #151811;

  display: flex;

  align-items: center;

  justify-content: center;

  z-index: 99;
}

.start-screen[hidden] {
  display: none !important;
}

.start-card {
  width: min(430px, 88%);

  padding: 48px 28px;

  text-align: center;

  background: #292e23;

  border:
    1px solid #73795d;

  border-radius: 18px;
}

.start-card h1 {
  font-size: 38px;

  margin:
    0 0 12px;

  letter-spacing: 2px;
}

.start-card p {
  color: #bbb5a2;

  margin-bottom: 28px;
}

/* =========================================================
   タイトル画面
========================================================= */
.title-card {
  width: min(960px, 96vw);
  padding: 16px 16px 24px;

  background: rgba(18, 16, 13, 0.78);

  border: 1px solid #6b5a3d;
  border-radius: 18px;

  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45);

  display: flex;
  flex-direction: column;
  align-items: center;
}

.title-main-visual {
  width: 100%;
  max-width: 920px;
  height: auto;

  display: block;
  object-fit: contain;

  border-radius: 12px;

  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.35);
}

.title-start-btn {
  font-family: "Yomogi", cursive;
  font-size: 28px;
  letter-spacing: 0.12em;
  font-weight: normal;
}

.title-about-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  margin-top: 18px;
  padding: 6px 14px;

  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;

  font-family: "Yomogi", cursive;
  font-size: 18px;
  letter-spacing: 0.08em;

  border-bottom: 1px solid rgba(255, 255, 255, 0.35);

  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.title-about-link span {
  font-size: 12px;
  opacity: 0.55;
  letter-spacing: 0.04em;
}

.title-about-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.8);
  transform: translateY(-1px);
}

/* =========================================================
   ボタン
========================================================= */

.primary-btn {
  background: #b88946;

  color: #20170d;

  font-weight: bold;

  border-radius: 8px;

  padding: 11px 25px;

  cursor: pointer;
}


/* =========================================================
   図鑑
========================================================= */

.wide {
  max-width: 680px;
}


/* =========================================================
   食材図鑑
========================================================= */

#book {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 12px;

  padding: 6px;
}


/* 図鑑カード */
.book-card {
  position: relative;

  padding: 8px;

  border: 2px solid rgba(71, 55, 38, 0.75);
  border-radius: 10px;

  background:
    linear-gradient(
      180deg,
      #efe1bc 0%,
      #dbc58f 100%
    );

  box-shadow:
    inset 0 0 12px rgba(70, 45, 20, 0.2),
    0 2px 5px rgba(0, 0, 0, 0.25);

  overflow: hidden;
}


/* =========================================================
   食材画像部分
========================================================= */

.food-art {
  width: calc(100% + 16px);

  margin:
    -8px
    -8px
    0;

  display: flex;
  justify-content: center;
  align-items: center;
}

.food-book-image {
  position: relative;

  width: 100%;

  overflow: hidden;

  border-radius: 7px;
}

.food-book-image::before {
  content: "";

  display: block;

  padding-top: 100%;
}

/* 背景画像 */
.food-book-background {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;

  display: block;
}


/* 食材本体 */
.food-book-main {
  position: absolute;

  left: 50%;
  top: 47%;

  width: 50%;
  height: 50%;

  transform:
    translate(-50%, -50%);

  object-fit: contain;

  display: block;

  z-index: 2;
}


/* =========================================================
   食材名
========================================================= */

.food-book-name {
  margin-top: 7px;

  text-align: center;

  font-size: 14px;
  font-weight: bold;

  color: #34261b;
}

.food-book-location {
  margin-top: 3px;

  text-align: center;

  font-size: 12px;
  font-weight: bold;

  color: #6a5844;
}

/* =========================================================
   フレーバーテキスト
========================================================= */

.food-flavor {
  margin:
    7px 3px
    2px;

  padding-top: 6px;

  border-top:
    1px dashed
    rgba(80, 57, 35, 0.4);

  font-family: "Yomogi", cursive;

  font-size: 10px;
  line-height: 1.5;

  color: #51402f;

  transform:
    rotate(-0.3deg);
}


/* =========================================================
   未発見
========================================================= */

.book-card.locked {
  background:
    linear-gradient(
      180deg,
      #777168,
      #4f4b46
    );

  opacity: 1;
}

/* 未発見食材をシルエット化 */
.book-card.locked .food-book-main {
  filter: brightness(0);
  opacity: 0.82;
}

.food-book-unknown {
  width: 100%;
  aspect-ratio: 1 / 1;

  display: flex;
  justify-content: center;
  align-items: center;

  font-size: 46px;
  font-weight: bold;

  color: rgba(255, 255, 255, 0.4);

  background:
    rgba(20, 20, 20, 0.25);

  border-radius: 7px;
}

.book-card.locked .food-book-name {
  color:
    rgba(255, 255, 255, 0.55);
}


/* =========================================================
   建設
========================================================= */

.build-row {
  background: #1c2118;

  border-radius: 9px;

  padding: 11px;

  margin: 7px 0;

  display: flex;

  justify-content: space-between;

  gap: 10px;

  align-items: center;
}

.build-row h3 {
  margin:
    0 0 4px;
}

.build-row p {
  margin: 0;

  color: #bbb5a2;

  font-size: 12px;
}

.build-row button {
  background: #98703b;

  border-radius: 7px;

  padding: 8px;

  cursor: pointer;
}

.build-row button:disabled {
  opacity: 0.35;

  cursor: default;
}


/* =========================================================
   トースト
========================================================= */

.toast {
  position: fixed;

  left: 50%;

  bottom: 85px;

  transform:
    translateX(-50%)
    translateY(20px);

  background: #211f1a;

  color: #f0e1bd;

  border:
    1px solid #9e8251;

  padding: 10px 14px;

  border-radius: 5px;

  opacity: 0;

  pointer-events: none;

  transition: 0.25s;

  z-index: 30;

  max-width: 90%;

  text-align: center;
}

.toast.show {
  opacity: 1;

  transform:
    translateX(-50%)
    translateY(0);
}


/* =========================================================
   PC
========================================================= */

@media (min-width: 700px) {
  #app {
    max-width: 480px;

    margin: auto;

    box-shadow:
      0 0 40px #000;
  }

  .topbar {
    position: relative;
  }
}


/* =========================================================
   スマホ
========================================================= */

@media (max-width: 699px) {

  .explore-start-btn {
    min-height: 80px;
  }

  .explore-start-icon {
    font-size: 40px;
  }

}


/* =========================================================
   探索可能だが未探索のマス
========================================================= */

.hex.available.unexplored {
  opacity: 0.62;
}

.hex.available.unexplored .inside {
  color: #c5c0ad;
  text-shadow: 0 1px 2px #1c1b18;
}

.hex.available.unexplored .terrain-icon {
  opacity: 0.8;
}


/* =========================================================
   施設カード・施設確認UI
========================================================= */

.section-note {
  font-size: 11px;
  color: #62553e;
}

.facility-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.facility {
  width: 100%;
  min-width: 0;
  min-height: 150px;
  border: 2px solid #786545;
  background: #d3c09a;
  color: var(--ink);
  padding: 7px;
  text-align: center;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
}

.facility:active {
  transform: translateY(1px);
}

.facility-art-wrap {
  height: 98px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.facility-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.facility-fallback {
  font-size: 48px;
  line-height: 1;
}

.facility-name {
  margin-top: 5px;
  font-size: 14px;
  font-weight: bold;
}

.facility-level {
  margin-top: 2px;
  font-size: 11px;
  color: #66553d;
}

.facility-detail {
  padding: 16px;
}

.facility-upgrade-preview {
  display: grid;
  grid-template-columns: 1fr 34px 1fr;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.facility-upgrade-preview > div:not(.facility-arrow) {
  min-width: 0;
}

.facility-upgrade-preview small,
.facility-upgrade-preview strong {
  display: block;
}

.facility-upgrade-preview .facility-art-wrap {
  height: 150px;
  margin: 6px 0;
  border: 1px solid #927951;
  background: rgba(255, 255, 255, 0.12);
}

.facility-arrow {
  font-size: 28px;
  font-weight: bold;
}

.facility-modal-copy {
  margin-top: 14px;
  padding: 12px;
  background: #d7c59e;
  border: 1px solid #8c754d;
  line-height: 1.6;
}

.facility-modal-copy p {
  margin: 7px 0;
}

.facility-warning {
  color: #8a3027;
  font-weight: bold;
}

.special-facility-preview {
  text-align: center;
  font-size: 72px;
  padding: 12px;
}

#facilityUpgradeBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.special-silhouette .facility-image {
  filter: brightness(0);
  opacity: 0.85;
}

.special-hidden .facility-image-wrap {
  min-height: 72px;
}


/* =========================================================
   2026-08 探索演出・ステータス配置 調整
========================================================= */

.status-area {
  background: #292720;
  padding-bottom: 8px;
}

.status-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  background: transparent;
}

.status-card small {
  display: none;
}

.character-area {
  position: relative;
  height: 170px;
  margin: 0 8px 8px;
  overflow: hidden;
  border-radius: 10px;
  background:
    #1b2018
    url("images/bg/base_idle.png")
    center / cover
    no-repeat;
}


/* =========================================================
   食べる操作
========================================================= */

.eat-control {
  position: absolute;

  left: 8px;
  top: 30%;

  transform: translateY(-50%);

  width: 78px;

  z-index: 10;

  display: flex;
  flex-direction: column;
  align-items: center;

  gap: 0;
}


/* 食べるボタン */
.eat-button {
  width: 70px;
  height: 70px;

  border: none;
  padding: 0;
  margin: 0;

  appearance: none;
  -webkit-appearance: none;

  background: transparent;

  cursor: pointer;
}

.eat-button img {
  width: 110%;
  height: 110%;

  object-fit: contain;
  display: block;

  pointer-events: none;
}


/* 押した時 */
.eat-button:active {
  transform: translateY(2px);
}


/* 食料数 */
.eat-food-count {
  margin-top: -2px;
  min-width: 60px;
  padding: 3px 7px;
  border-radius: 12px;
  background: rgba(20, 18, 14, 0.78);
  color: #f3e6c7;
  font-size: 14px;
  font-weight: bold;

  line-height: 1.2;

  text-align: center;
  white-space: nowrap;

  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;

  text-shadow:
    0 1px 2px #000;
}

.eat-food-count img {
  width: 26px;
  height: 26px;

  object-fit: contain;
  display: block;
}

.eat-food-count span {
  display: block;
  flex-shrink: 0;
}


/* キャラクター表示領域 */
.character-display {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}


/* キャラクター本体 */
.character-display #char {
  position: absolute;
  width: 42%;
  height: 145px;
  left: 18%;
  bottom: 18px;
  object-fit: contain;
  display: block;
  transition: left 3s linear;
}


/* 探索時の移動先 */
.character-area.walking #char {
  left: 45%;
}

.discovery-mark {
  position: absolute;
  left: 68%;
  top: 12px;
  font-size: 42px;
  font-weight: bold;
  color: #f3d66b;
  text-shadow: 0 2px 2px #21190d;
  z-index: 5;
  animation: discovery-pop 0.45s ease;
}

.discovery-mark[hidden] {
  display: none;
}

@keyframes discovery-pop {
  0% {
    transform: translateY(8px) scale(0.4);
    opacity: 0;
  }

  60% {
    transform: translateY(-4px) scale(1.2);
    opacity: 1;
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}


/* 施設カードを少し圧縮 */
.facility-grid {
  padding: 6px;
  gap: 5px;
}

.facility {
  min-height: 132px;
  padding: 5px;
}

.facility-image-wrap,
.facility-art-wrap {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.facility-name {
  margin-top: 3px;
  font-size: 13px;
}

.facility-level {
  margin-top: 1px;
  font-size: 10px;
}

.facility-card-flavor {
  margin: 7px 3px 2px;
  padding-top: 6px;

  border-top:
    1px dashed rgba(80, 57, 35, 0.4);

  font-family: "Yomogi", cursive;
  font-size: 10px;
  line-height: 1.5;

  color: #51402f;

  text-align: left;
}

.facility-cost-section {
  margin-top: 7px;
}

.facility-cost-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;

  gap: 10px;

  margin-top: 6px;
}

.facility-cost-item {
  display: flex;
  align-items: center;

  gap: 4px;
}

.facility-cost-item img {
  width: 28px;
  height: 28px;

  object-fit: contain;
  display: block;
}

.facility-cost-item span {
  font-size: 14px;
  font-weight: bold;
}

/* =========================================================
   探索結果
========================================================= */

.explore-result-detail {
  padding: 18px 16px;
}

.explore-result-list {
  display: grid;
  gap: 8px;
}

.explore-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 10px 12px;

  background: #d7c59e;
  border: 1px solid #8c754d;

  font-size: 14px;
}

.explore-result-item strong {
  font-size: 17px;
}

.explore-result-item.rare {
  font-weight: bold;
  border-width: 2px;
}

.explore-result-empty {
  padding: 18px;
  text-align: center;
  color: #685a43;
}

.result-resource {
  display: flex;
  align-items: center;
  gap: 7px;
}

.result-resource img {
  width: 30px;
  height: 30px;

  object-fit: contain;
  display: block;

  flex-shrink: 0;
}

.result-book-icon {
  width: 30px;
  height: 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 22px;

  flex-shrink: 0;
}

.result-actions {
  grid-template-columns: 1fr;
}


/* =========================================================
   マップ地形画像
========================================================= */

.terrain-layer {
  position: absolute;

  inset: 0;

  overflow: hidden;

  clip-path: polygon(
    25% 3%,
    75% 3%,
    100% 50%,
    75% 97%,
    25% 97%,
    0 50%
  );

  z-index: 1;

  pointer-events: none;
}

.terrain-layer img {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: contain;

  object-position: center;

  display: block;

  z-index: 1;
}


/*
 * 地形名
 */

.terrain-label {
  justify-content: flex-end !important;

  padding-bottom: 10px;

  font-size: 12px !important;

  color: #f0e6cc !important;

  text-shadow:
    0 1px 2px #111,
    0 0 3px #111 !important;
}


/*
 * 探索可能な未探索マス
 */

.hex.available .terrain-layer {
  filter:
    brightness(0.48)
    saturate(0.75);
}


/* =========================================================
   探索可能マス：半透明の霧
========================================================= */

.hex.available::after {
  content: "";
  position: absolute;
  inset: 0;

  clip-path: polygon(
    25% 0%,
    75% 0%,
    100% 50%,
    75% 100%,
    25% 100%,
    0% 50%
  );

  background:
    linear-gradient(
      rgba(20, 24, 22, 0.18),
      rgba(10, 12, 11, 0.30)
    ),
    url("images/map/fog_unexplored.png")
      center / cover no-repeat;

  opacity: 0.55;

  z-index: 3;
  pointer-events: none;
}


/* =========================================================
   未解放マス：濃霧
========================================================= */

.hex.blocked {
  cursor: default;
}

.hex.blocked .fog-layer {
  position: absolute;
  inset: 0;

  clip-path: polygon(
    25% 0%,
    75% 0%,
    100% 50%,
    75% 100%,
    25% 100%,
    0% 50%
  );

  z-index: 4;
  pointer-events: none;

  background:
    linear-gradient(
      rgba(20, 24, 22, 0.35),
      rgba(10, 12, 11, 0.55)
    ),
    url("images/map/fog_unexplored.png")
      center / cover no-repeat;
}


/* =========================================================
   ゲート
========================================================= */

.gate-layer img {
  width: 100%;
  height: 100%;

  object-fit: contain;
  object-position: center;

  display: block;
}

.gate-label {
  font-size: 12px !important;

  color: #f0e6cc !important;

  text-shadow:
    0 1px 2px #111,
    0 0 3px #111 !important;
}


/* =========================================================
   暗闇マス
========================================================= */

.hex.dark {
  background: transparent;
  filter: none;
  cursor: default;
  pointer-events: none;
}

.hex.dark::before,
.hex.dark::after {
  display: none;
}

.hex.dark .fog-layer,
.hex.dark .terrain-layer,
.hex.dark .inside {
  display: none;
}


/* =========================================================
   探検看板ボタン
========================================================= */

.explore-sign-button {
  position: absolute;
  right: 3px;
  bottom: 5px;

  width: 145px;
  height: 95px;

  border: none;
  padding: 0;
  margin: 0;

  appearance: none;
  -webkit-appearance: none;

  background: transparent;

  cursor: pointer;
  z-index: 10;
}

.explore-sign-button img {
  width: 120%;
  height: 120%;

  object-fit: contain;

  display: block;

  pointer-events: none;
}

.explore-sign-button:active {
  transform: translateY(2px);
}


/* =========================================================
   上部のアイコン
========================================================= */

.resources {
  display: flex;
  align-items: center;
  justify-content: center;

  gap: 3px;

  color: #eee;
  font-size: 12px;
}

.resource-item {
  display: flex;
  align-items: center;

  gap: 1px;

  white-space: nowrap;
}

.resource-item img {
  width: 22px;
  height: 22px;

  object-fit: contain;
  display: block;
}

.resource-item span {
  min-width: 10px;

  text-align: center;
  font-weight: bold;
}

.gate-direction-arrow {
  width: 68px;
  height: 68px;

  object-fit: contain;
  display: block;

  transform-origin: center;
}
/* =========================================================
   スクラップブックイベント
========================================================= */

.story-cutscene-overlay {
  position: fixed;
  inset: 0;

  z-index: 500;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 14px;

  background:
    rgba(8, 7, 6, 0.82);

  touch-action: manipulation;
}

.story-cutscene-overlay[hidden] {
  display: none;
}


/* =========================================================
   台紙
========================================================= */
.story-scrapbook {
  position: relative;

  width: min(94vw, 460px);

  overflow: hidden;

  background:
    url("images/events/scrapbook_base.png")
    center / 100% 100%
    no-repeat;

  box-shadow:
    0 12px 35px
    rgba(0, 0, 0, 0.45);
}

/*
 * 3:4の高さを確実に作る
 */
.story-scrapbook::before {
  content: "";

  display: block;

  padding-top: 133.333%;
}

/* =========================================================
   カット配置領域
========================================================= */
.story-cut-layer {
  position: absolute;
  inset: 0;

  z-index: 1;
}


/* =========================================================
   タップ案内
========================================================= */
.story-cut-guide {
  position: absolute;

  left: 50%;
  bottom: 9px;

  transform:
    translateX(-50%);

  z-index: 50;

  padding: 3px 8px;

  font-size: 10px;

  color: rgba(65, 48, 31, 0.72);

  background:
    rgba(232, 215, 177, 0.72);

  pointer-events: none;

  white-space: nowrap;
}

/* =========================================================
   スクラップブック：イベントカット共通
========================================================= */

.story-cut {
  position: absolute;

  display: block;

  object-fit: contain;

  background: #f4ead2;

  border: 5px solid #f4ead2;

  border-radius: 2px;

  box-shadow:
    0 3px 7px
    rgba(43, 31, 18, 0.22);

  opacity: 0;

  animation:
    story-cut-appear
    0.25s
    ease
    forwards;

  transform-origin: center;
}


/* =========================================================
   カット1：未起動ゲート全景
========================================================= */

.story-cut-1 {
  width: 75%;

  left: 50%;
  top: 7%;

  z-index: 1;

  transform:
    translateX(-50%)
    rotate(-0.5deg);
}

/* 追加：主人公カット */
.story-cut-2 {
  width: 20%;
  left: 10%;
  top: 37%;
  z-index: 2;

  background: transparent;
  border: none;
  box-shadow: none;
  
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.18));

  transform: rotate(-8deg);
}


/* =========================================================
   カット2：くぼみアップ
========================================================= */

.story-cut-3 {
  width: 34%;

  right: 8%;
  top: 42%;

  z-index: 3;

  transform:
    rotate(5deg);
}


/* =========================================================
   カット3：コンパスセット
========================================================= */

.story-cut-4 {
  width: 36%;

  right: 11%;
  top: 42%;

  z-index: 4;

  transform:
    rotate(-3deg);
}


/* =========================================================
   カット4：コンパス発光
========================================================= */

.story-cut-5 {
  width: 38%;

  right: 7%;
  top: 44%;

  z-index: 5;

  transform:
    rotate(2deg);
}


/* =========================================================
   カット5：起動ゲート全景
========================================================= */

.story-cut-6 {
  width: 83%;

  left: 50%;
  top: 10%;

  z-index: 6;

  transform:
    translateX(-50%)
    rotate(1.5deg);
}


/* =========================================================
   カット6：主人公がゲートへ入る
========================================================= */

.story-cut-7 {
  width: 87%;

  left: 50%;
  top: 12%;

  z-index: 7;

  transform:
    translateX(-50%)
    rotate(-2.0deg);
}

.story-cut-text {
  position: absolute;

  left: 20%;
  right: 8%;
  bottom: 18%;

  z-index: 30;

  min-height: 2em;

  font-family: "Yomogi", cursive;
  font-size: 15px;
  line-height: 1.6;

  color: #4b3928;

  letter-spacing: 0.03em;

  transform: rotate(-0.7deg);

  white-space: pre-line;

  pointer-events: none;
}

/* =========================================================
   カット出現アニメーション
========================================================= */

@keyframes story-cut-appear {

  from {
    opacity: 0;
    scale: 0.97;
  }

  to {
    opacity: 1;
    scale: 1;
  }

}

@media (max-width: 360px) {

  .story-cut {
    border-width: 4px;
  }

  .story-cut-1 {
    width: 77%;
  }

  .story-cut-5 {
    width: 84%;
  }

  .story-cut-6 {
    width: 86%;
  }

}
/* =========================================================
   ゲートイベント：ホワイトアウト
========================================================= */
.gate-ending-fade {
  position: absolute;
  inset: 0;

  z-index: 100;

  background: #fffdf7;

  opacity: 0;

  pointer-events: none;

  transition:
    opacity 1.8s ease,
    background-color 0.8s ease;
}

.gate-ending-fade.active {
  opacity: 1;
}

/* ブラックアウト */
.gate-ending-fade.black {
  background: #000;
}

/* =========================================================
   エンディング
========================================================= */

.ending-overlay {
  position: fixed;
  inset: 0;

  z-index: 600;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 14px;

  background: #050505;
}

.ending-overlay[hidden] {
  display: none;
}


/* =========================================================
   最後のページ
========================================================= */

.ending-page {
  position: relative;

  width: min(94vw, 460px);

  overflow: hidden;

  background:
    url("images/events/scrapbook_base.png")
    center / 100% 100%
    no-repeat;

  box-shadow:
    0 12px 35px
    rgba(0, 0, 0, 0.5);
}


/* 3:4 */
.ending-page::before {
  content: "";
  display: block;
  padding-top: 133.333%;
}


.ending-cut-layer {
  position: absolute;
  inset: 0;

  z-index: 1;
}


/* =========================================================
   エンディング各カット共通
========================================================= */

.ending-cut {
  position: absolute;

  display: block;

  object-fit: contain;

  border: 4px solid #f1e6cf;

  box-shadow:
    0 3px 7px
    rgba(40, 28, 17, 0.18);

  opacity: 0;

  animation:
    ending-cut-appear
    0.35s
    ease
    forwards;
}


@keyframes ending-cut-appear {

  from {
    opacity: 0;
    scale: 0.97;
  }

  to {
    opacity: 1;
    scale: 1;
  }
}
/* 1：眠っている */
.ending-cut-1 {
  width: 72%;

  left: 50%;
  top: 6%;

  transform:
    translateX(-50%)
    rotate(-1deg);

  z-index: 1;
}


/* 2：目が覚める */
.ending-cut-2 {
  width: 70%;

  left: 47%;
  top: 28%;

  transform:
    translateX(-50%)
    rotate(1.5deg);

  z-index: 2;
}


/* 3：ほっとする */
.ending-cut-3 {
  width: 68%;

  left: 52%;
  top: 45%;

  transform:
    translateX(-50%)
    rotate(-1.5deg);

  z-index: 3;
}


/* 4：コンパス */
.ending-cut-4 {
  width: 35%;

  right: 16%;
  bottom: 12%;

  border: none;
  box-shadow: none;

  transform:
    rotate(4deg);

  z-index: 4;

  animation:
  ending-compass-appear
  2.5s
  ease
  forwards;

}
@keyframes ending-compass-appear {

  from {
    opacity: 0;
    scale: 0.96;
  }

  to {
    opacity: 1;
    scale: 1;
  }
}
/* =========================================================
   閉じる表紙
========================================================= */

.ending-book-cover {
  position: absolute;
  inset: 0;

  z-index: 20;

  opacity: 0;

  pointer-events: none;

  transform-origin: left center;

  transform:
    perspective(900px)
    rotateY(-92deg);

  transition:
  transform 2.8s cubic-bezier(0.45, 0, 0.2, 1),
  opacity 0.2s ease;
}


.ending-book-cover img {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: fill;
}


.ending-book-cover.closing {
  opacity: 1;

  transform:
    perspective(900px)
    rotateY(0deg);
}

.ending-title {
  position: absolute;
  right: 13%;
  bottom: 9%;
  z-index: 30;

  font-family: "Yomogi", cursive;
  font-size: clamp(30px, 6vw, 40px);

  letter-spacing: 0.12em;
  color: #eadfc5;

  opacity: 0;

  pointer-events: none;

  transition: opacity 1.5s ease;
}

.ending-title.show {
  opacity: 1;
}

.ending-page {
  transition:
    opacity 0.35s ease,
    filter 0.35s ease;
}
