/* gui.css — buttons, panels, modals, toast, effects, portraits, day card, VN. 9-slice art via border-image. */
:root { --ol: 1.5px 0 #7a2f55, -1.5px 0 #7a2f55, 0 1.5px #7a2f55, 0 -1.5px #7a2f55, 1.2px 1.2px #7a2f55, -1.2px 1.2px #7a2f55, 1.2px -1.2px #7a2f55, -1.2px -1.2px #7a2f55, 0 2px 0 #7a2f55; }

/* ---- buttons ---- */
.gbtn { -webkit-appearance: none; appearance: none; box-sizing: border-box; min-height: 46px; min-width: 72px; margin: 0; padding: 0 2px; background: none;
  border-style: solid; border-width: 16px 22px; border-color: transparent;
  border-image: url(../assets/ui-button.webp) 30% 14% fill / 16px 22px stretch;
  font: 800 17px/1.2 var(--font); color: #fff6ee; text-shadow: var(--ol); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .12s ease, filter .15s ease; }
.gbtn img { width: 22px; height: 22px; object-fit: contain; }
.gbtn.small { font-size: 15px; min-height: 46px; border-width: 12px 18px; border-image-width: 12px 18px; }
.gbtn:not(.pri) { filter: saturate(.35) brightness(1.25); }
.gbtn:active, .gbtn.press { transform: scale(.94); }
.gbtn[disabled] { filter: grayscale(.8) brightness(.9); opacity: .6; cursor: default; }
.nav-on .gbtn.focus { transform: scale(1.05); filter: brightness(1.1) drop-shadow(0 0 6px #fff) drop-shadow(0 0 10px #ff8fb1); }
.nav-on .gbtn.focus:not(.pri) { filter: saturate(.35) brightness(1.35) drop-shadow(0 0 6px #fff) drop-shadow(0 0 10px #ff8fb1); }
.nav-on .gbtn.focus:active, .nav-on .gbtn.focus.press { transform: scale(.96); }
.nav-on [data-nav].focus:not(.gbtn) { filter: drop-shadow(0 0 5px #fff) drop-shadow(0 0 9px #ff8fb1); transform: scale(1.06); }

.gicon { -webkit-appearance: none; appearance: none; box-sizing: border-box; position: relative; width: 50px; height: 50px; min-width: 44px; padding: 0; margin: 0; border: 0;
  background: url(../assets/ui-pause.webp) center / 100% 100% no-repeat; display: inline-flex; align-items: center; justify-content: center;
  font: 800 20px/1 var(--font); color: #fff6ee; text-shadow: var(--ol); cursor: pointer; transition: transform .12s ease, filter .15s ease; }
.gicon img, .gicon svg { width: 58%; height: 58%; object-fit: contain; pointer-events: none; }
.gicon:active, .gicon.press { transform: scale(.92); }
.gicon.on { filter: brightness(1.15) drop-shadow(0 0 6px #ff8fb1); }
.gicon .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box; border-radius: 9px; background: #ff4f6d;
  border: 2px solid #fff6ee; color: #fff; font: 800 12px/14px var(--font); text-align: center; }

/* ---- panels & titles ---- */
.gpanel { box-sizing: border-box; border: 26px solid transparent; border-image: url(../assets/ui-panel.webp) 14% fill / 26px round; padding: 4px 6px; color: var(--ink); }
.gtitle { margin: 0; font: 900 24px/1.25 var(--font); color: #fff6ee; text-shadow: var(--ol), 0 3px 0 #7a2f55; text-align: center; letter-spacing: 1px; }
.gpanel .gtitle { color: #ff7aa6; text-shadow: 1.5px 0 #fff, -1.5px 0 #fff, 0 1.5px #fff, 0 -1.5px #fff, 1px 1px #fff, -1px 1px #fff, 1px -1px #fff, -1px -1px #fff, 0 3px 0 #e9b3c8; }

/* ---- modal ---- */
#modal.on { background: transparent; }
.gm-back { position: absolute; inset: 0; background: rgba(43, 31, 63, .55); display: flex; align-items: center; justify-content: center; animation: gfade .2s ease both; }
.gm-back.out { animation: gfadeout .15s ease both; }
.gm-back.full { background: transparent; display: block; }
.gm-sheet { position: relative; width: min(360px, 92%); max-height: 86%; display: flex; flex-direction: column; animation: gpop .22s ease both; }
.gm-back.out .gm-sheet { animation: gpopout .15s ease both; }
.gm-sheet .gtitle { padding: 0 34px 6px; flex: none; }
.gm-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; font-size: 16px; line-height: 1.55; padding: 2px 2px 4px; }
.gm-close { position: absolute; top: -14px; right: -14px; width: 48px; height: 48px; z-index: 2; }
.gm-full { position: absolute; inset: 0; animation: gpop .22s ease both; display: flex; flex-direction: column; }
.gm-full .gm-body { padding: 0; overflow: hidden; font-size: inherit; line-height: inherit; display: flex; flex-direction: column; }
.gm-full .gm-close { top: 10px; right: auto; left: 10px; }
.gm-confirm-text { font-size: 17px; font-weight: 700; text-align: center; padding: 8px 4px 14px; }
.gm-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 4px 0; }
.gui-help p { margin: 0 0 10px; }
@keyframes gpop { 0% { transform: scale(.85); opacity: 0; } 70% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes gpopout { to { transform: scale(.9); opacity: 0; } }
@keyframes gfade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gfadeout { to { opacity: 0; } }

/* ---- toast ---- */
#toast { display: flex; flex-direction: column; align-items: center; padding-top: 70px; gap: 6px; box-sizing: border-box; }
.gui-toast { max-width: 86%; box-sizing: border-box; padding: 8px 16px; border-radius: 22px; background: rgba(255, 246, 238, .96); border: 2px solid #ff8fb1; color: var(--ink);
  font: 800 15px/1.35 var(--font); display: flex; align-items: center; gap: 8px; box-shadow: 0 3px 10px rgba(90, 40, 80, .35); animation: gtoast .28s ease both; }
.gui-toast img { width: 22px; height: 22px; object-fit: contain; }
.gui-toast.out { animation: gtoastout .25s ease both; }
@keyframes gtoast { from { transform: translateY(-24px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes gtoastout { to { transform: translateY(-14px); opacity: 0; } }

/* ---- fx ---- */
.gui-float { position: absolute; z-index: 9; pointer-events: none; transform: translate(-50%, -50%); font: 900 18px/1 var(--font); white-space: nowrap; text-shadow: var(--ol); animation: gfloat 1.2s ease-out both; }
@keyframes gfloat { 0% { opacity: 0; translate: 0 8px; scale: .6; } 15% { opacity: 1; translate: 0 0; scale: 1.15; } 30% { scale: 1; } 100% { opacity: 0; translate: 0 -46px; } }
.gui-flash { position: absolute; inset: 0; z-index: 9; pointer-events: none; }

/* ---- tint & bg ---- */
#tint { transition: background-color 1s ease; }

/* ---- portraits ---- */
.gc { position: absolute; bottom: 0; height: 82%; transform: translateX(-50%); opacity: 0; translate: 0 18px; transition: left .4s ease, opacity .35s ease, translate .35s ease, filter .3s ease; }
.gc.in { opacity: 1; translate: 0 0; }
.gc.dim { filter: brightness(.7); }
.gc img { height: 100%; width: auto; max-width: none; display: block; transform-origin: 50% 100%; animation: gbreathe 3.5s ease-in-out infinite; }
@keyframes gbreathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.008); } }

/* ---- day card ---- */
.gui-day { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; animation: gdayin .3s ease both; pointer-events: auto; }
.gui-day.out { animation: gdayout .25s ease both; }
.gui-day.sun { background: linear-gradient(160deg, #ffe0b8, #ffb6c9 60%, #d9a8e8); }
.gui-day.cloud { background: linear-gradient(160deg, #e6dff2, #c3bcdc 60%, #a9a4c9); }
.gui-day.rain { background: linear-gradient(160deg, #b8c8e0, #8fa2c6 60%, #6f7ba8); }
.gui-day .dn { font: 900 52px/1.2 var(--font); color: #fff6ee; text-shadow: var(--ol), 0 4px 0 #7a2f55; animation: gpop .4s .15s ease both; }
.gui-day .dw { font: 800 24px/1.3 var(--font); color: #fff6ee; text-shadow: var(--ol); }
.gui-day .dc { font: 800 20px/1.3 var(--font); color: #fff6ee; text-shadow: var(--ol); display: flex; align-items: center; gap: 8px; }
.gui-day .di { font-size: 34px; }
.gui-day .dh { position: absolute; bottom: 60px; font: 700 15px var(--font); color: #fff6ee; text-shadow: var(--ol); opacity: .85; }
@keyframes gdayin { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes gdayout { to { transform: translateY(-40px); opacity: 0; } }

/* ---- VN ---- */
#vn { overflow: hidden; }
.vn-cg { position: absolute; inset: 0; background: #1b1226; opacity: 0; transition: opacity .4s ease; pointer-events: none; }
.vn-cg.on { opacity: 1; }
.vn-cg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vn-box { position: absolute; left: 10px; right: 10px; bottom: 14px; min-height: 150px; box-sizing: border-box; border: 26px solid transparent;
  border-image: url(../assets/ui-panel.webp) 14% fill / 26px round; padding: 4px 6px; color: var(--ink); transition: opacity .2s ease, transform .2s ease; }
.vn-box.hide { opacity: 0; transform: translateY(14px); pointer-events: none; }
.vn-box.over-cg { opacity: .88; }
.vn-box.over-cg.hide { opacity: 0; }
.vn-name { position: absolute; top: -46px; left: -8px; padding: 4px 18px; border-radius: 16px; border: 2px solid #fff6ee; color: #fff; font: 900 17px/1.3 var(--font);
  text-shadow: var(--ol); box-shadow: 0 2px 6px rgba(90, 40, 80, .35); max-width: 70%; box-sizing: border-box; }
.vn-text { font-size: 17px; line-height: 1.6; min-height: 78px; white-space: pre-wrap; word-break: break-word; }
.vn-box.narr .vn-text { text-align: center; font-style: italic; color: var(--ink-soft); }
.vn-next { position: absolute; right: -10px; bottom: -14px; color: #ff6f9c; font-size: 16px; opacity: 0; }
.vn-next.on { opacity: 1; animation: gbounce .8s ease-in-out infinite; }
@keyframes gbounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
.vn-choice { position: absolute; inset: 0; background: rgba(43, 31, 63, .5); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 0 24px 80px; box-sizing: border-box; animation: gfade .2s ease both; }
.vn-choice .gbtn { width: 100%; max-width: 340px; animation: gpop .25s ease both; }
.vn-choice .gbtn:nth-child(2) { animation-delay: .05s; }
.vn-choice .gbtn:nth-child(3) { animation-delay: .1s; }
.vn-choice .gbtn:nth-child(4) { animation-delay: .15s; }
.vn-skip { position: absolute; top: 10px; left: 10px; width: 48px; height: 48px; }
