/* 網頁版遊戲頁的外框（Ren'Py SDK 的 index.html）改成遊戲的綠銀風格：左上角的選單、更新提示。
   tools/build_web.py 把這個檔案連結在 play/index.html 的 </head> 前，蓋過 SDK 內建的灰色樣式；行為在 mafen-shell.js。
   配色和 tools/make_gui.py 一致：INK #09100E、INK2 #050A09、GREEN #174F3A、GREEN_HI #227656、SILVER #C4CCD2、SILVER_HI #ECF0F4。 */

:root {
  --mm-width: 260px;           /* 選單打開時左邊側欄的寬度；遊戲畫面縮到剩下的寬度，不會被蓋到 */
  --mm-font: "Noto Serif TC", "Noto Serif JP", "Source Han Serif TC", "Yu Mincho", "PMingLiU", serif;
}

@media (max-width: 760px), (max-height: 460px) {
  :root {
    --mm-width: 200px;
  }
}

/* ---- 左上角的選單 ---- */

#ContextContainer {
  left: 0;
  top: 0;
  z-index: 10;
  box-sizing: border-box;
  padding: 10px;
  font-family: var(--mm-font);
}

/* SDK 打開選單時會加 shown（半透明黑底）；改由 body.mm-open 畫成側欄 */
#ContextContainer.shown {
  background: none;
  border-radius: 0;
}

body.mm-open #ContextContainer {
  bottom: 0;
  width: var(--mm-width);
  background: linear-gradient(180deg, #0E1F19, #050A09);
  border-right: 1px solid rgba(196, 204, 210, .45);
  box-shadow: 4px 0 18px rgba(0, 0, 0, .55);
}

/* 遊戲畫面讓出側欄的寬度（Ren'Py 依畫布大小重新縮放、置中） */
body.mm-open #canvas {
  left: var(--mm-width);
  width: calc(100% - var(--mm-width));
}

#ContextButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 38px;
  height: 38px;
  padding: 0 0 3px;
  border-radius: 50%;
  border: 1px solid rgba(196, 204, 210, .55);
  background: radial-gradient(circle at 50% 40%, rgba(23, 79, 58, .9), rgba(9, 16, 14, .9));
  color: #C4CCD2;
  font-size: 22px;
  line-height: 1;
  opacity: .55;
  transition: opacity .2s ease, border-color .2s ease, box-shadow .2s ease;
}

#ContextButton:hover,
#ContextButton:focus,
body.mm-open #ContextButton {
  outline: none;
  opacity: 1;
  color: #ECF0F4;
  border-color: rgba(236, 240, 244, .85);
  box-shadow: 0 0 10px rgba(34, 118, 86, .7);
}

#ContextMenu {
  margin-top: 8px;
}

#ContextMenu a {
  justify-content: flex-start;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  height: 42px;
  margin: 6px 0 0;
  padding: 0 14px;
  background: rgba(23, 79, 58, .28);
  border: 1px solid rgba(196, 204, 210, .35);
  border-radius: 4px;
  color: #D5DBDF;
  font-size: 16px;
  letter-spacing: .06em;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

/* 每一項前面一顆綠寶石（和選項框的寶石同色系） */
#ContextMenu a::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #8FE0B8, #227656);
  box-shadow: 0 0 4px rgba(111, 194, 154, .8);
}

#ContextMenu a:hover,
#ContextMenu a:focus {
  outline: none;
  background: rgba(34, 118, 86, .55);
  border-color: rgba(236, 240, 244, .8);
  color: #FFFFFF;
}

/* 「Powered by Ren'Py」是引擎的署名：做成小字，放在側欄最下面 */
#ContextMenu a.mm-credit {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  width: auto;
  justify-content: center;
  height: 30px;
  background: none;
  border: none;
  border-top: 1px solid rgba(196, 204, 210, .2);
  border-radius: 0;
  color: rgba(196, 204, 210, .6);
  font-size: 12px;
  letter-spacing: .04em;
}

#ContextMenu a.mm-credit::before {
  display: none;
}

#ContextMenu a.mm-credit:hover,
#ContextMenu a.mm-credit:focus {
  background: none;
  color: #ECF0F4;
}

/* ---- 有新版本時，畫面上方中央的提示（mafen-shell.js） ---- */

#mm-update {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  max-width: calc(100% - 120px);
  padding: 7px 8px 7px 18px;
  background: linear-gradient(180deg, rgba(23, 79, 58, .97), rgba(9, 16, 14, .97));
  border: 1px solid rgba(196, 204, 210, .7);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .6), 0 0 10px rgba(34, 118, 86, .5);
  color: #ECF0F4;
  font: 15px/1.4 var(--mm-font);
  letter-spacing: .04em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

#mm-update .mm-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

#mm-update:hover {
  border-color: #ECF0F4;
}

#mm-update .mm-close {
  flex: none;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(196, 204, 210, .45);
  border-radius: 50%;
  background: rgba(5, 10, 9, .6);
  color: #C4CCD2;
  font: 16px/1 sans-serif;
  cursor: pointer;
}

#mm-update .mm-close:hover {
  color: #FFFFFF;
  border-color: #ECF0F4;
}
