/* 分一株！漂流礁 — 水彩竖版界面 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #16303a; }
body {
  display: flex; align-items: center; justify-content: center;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif SC", "Source Han Serif SC", serif;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#stage { position: relative; width: 390px; height: 844px; transform-origin: center center; }
#cv { position: absolute; inset: 0; width: 390px; height: 844px; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

/* ---- 通用按钮（水彩纸签母图） ---- */
.btn {
  display: inline-block; border: none; cursor: pointer; position: relative;
  font-family: inherit; font-size: 21px; letter-spacing: 6px; text-indent: 6px;
  color: #35544a; padding: 12px 0; width: 218px; text-align: center;
  background: url(../assets/ui/btn_default.png) center/100% 100% no-repeat;
  text-shadow: 0 1px 0 rgba(255,255,255,.8);
}
.btn:active { background-image: url(../assets/ui/btn_pressed.png); transform: translateY(1px) scale(.99); }
.btn.small { width: auto; padding: 8px 20px; font-size: 17px; letter-spacing: 3px; text-indent: 3px; }
.btn.gray { background-image: url(../assets/ui/btn_disabled.png); color: #7a8a80; pointer-events: none; }
.btn.danger { color: #7c3b33; }

/* ---- HUD ---- */
#hud { position: absolute; top: 0; left: 0; width: 390px; height: 88px; pointer-events: none; }
#hud .hudrow { position: absolute; top: 8px; left: 10px; right: 56px; height: 40px; display: flex; align-items: center; gap: 6px; }
.hudchip {
  display: flex; align-items: center; gap: 3px; height: 34px; padding: 0 8px 0 4px;
  background: rgba(252,250,240,.6); border-radius: 17px 15px 16px 14px;
  font-size: 17px; color: #294a44; font-weight: bold;
}
.hudchip .chipicon { width: 27px; height: 27px; object-fit: contain; }
.hudchip.red { color: #a33b2e; animation: chipflash 0.8s infinite; }
@keyframes chipflash { 50% { box-shadow: 0 0 10px rgba(200,60,40,.8); } }
#pausebtn {
  position: absolute; top: 9px; right: 8px; width: 44px; height: 44px; border: none; cursor: pointer;
  font-size: 18px; color: #2d4a43;
}
#islandhint { position: absolute; top: 50px; left: 0; width: 100%; text-align: center; font-size: 13.5px; color: #f2fbf4; text-shadow: 0 1px 3px rgba(10,50,60,.65); letter-spacing: 1px; }

/* ---- 平潮/靠岛操作区 ---- */
#actionbar { position: absolute; left: 0; bottom: 8px; width: 390px; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
#actionbar > * { pointer-events: auto; }
#sailwarn { font-size: 14px; color: #ffd76a; text-shadow: 0 1px 3px rgba(60,20,10,.8); min-height: 18px; letter-spacing: 1px; }
#sailwarn.red { color: #ff9d7a; }
#draftinfo { font-size: 14px; color: #e8f6ee; text-shadow: 0 1px 3px rgba(10,50,60,.8); min-height: 18px; letter-spacing: 1px; }
#draftinfo.over { color: #ff8d76; font-weight: bold; }
#btnrow { display: flex; gap: 10px; align-items: center; }

/* ---- 幼体盆（母图托盘） ---- */
#tray {
  position: absolute; right: 4px; bottom: 96px; width: 232px; height: 162px;
  background: url(../assets/ui/tray.png) center/contain no-repeat;
  pointer-events: auto;
}
#tray .traytitle {
  position: absolute; right: 8px; top: 10px; width: 44px; height: 40px;
  font-size: 10px; color: #6a5a3a; text-align: center; line-height: 1.2;
  display: flex; align-items: center; justify-content: center; padding: 2px;
  pointer-events: none;
}
#trayslots { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.trayslot {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: grab;
}
.trayslot canvas { width: 42px; height: 42px; }
.trayslot.gift { filter: drop-shadow(0 0 4px rgba(255,215,120,.9)); }

/* ---- 订单卡 ---- */
#ordercard {
  position: absolute; left: 8px; top: 96px; width: 232px; padding: 8px 8px 6px;
  background: linear-gradient(165deg, rgba(253,250,238,.94), rgba(240,244,228,.92));
  border-radius: 12px 16px 13px 15px;
  box-shadow: 0 4px 12px rgba(20,50,60,.3), inset 0 0 12px rgba(150,200,190,.3);
  pointer-events: auto;
}
#ordercard .octitle { font-size: 14px; color: #3c5a4c; letter-spacing: 2px; margin-bottom: 4px; font-weight: bold; }
.orderrow {
  display: flex; align-items: center; gap: 5px; min-height: 40px; padding: 3px 5px; margin-bottom: 4px;
  border-radius: 9px; background: rgba(214,236,220,.5); font-size: 13px; color: #2d4a43;
  border: 1.5px dashed rgba(90,140,110,.35); transition: background .2s;
}
.orderrow.done { background: rgba(190,235,190,.6); border-style: solid; border-color: rgba(80,160,90,.6); }
.orderrow.shake { animation: orshake .35s; }
@keyframes orshake { 25% { transform: translateX(-4px);} 50% { transform: translateX(4px);} 75% { transform: translateX(-3px);} }
.orderrow .oreq { flex: 1; line-height: 1.25; }
.orderrow .oreq b { font-size: 13.5px; }
.orderrow .oreward { font-size: 12.5px; color: #7a5a20; white-space: nowrap; }
.orderrow .tick { width: 20px; text-align: center; font-size: 16px; color: #3d9a4e; }
.orderrow canvas { width: 30px; height: 30px; flex: none; }
#ordercard.preview { pointer-events: none; width: 210px; }
#ordercard.preview .orderrow { border-style: dotted; opacity: .92; }

/* ---- 提示气泡（水彩纸签横幅母图） ---- */
#hintbox {
  position: absolute; left: 50%; bottom: 190px; transform: translateX(-50%); max-width: 330px; width: 300px;
  background: url(../assets/ui/banner.png) center/100% 100% no-repeat;
  color: #4a3f28; font-size: 15.5px; line-height: 1.45; letter-spacing: 1px;
  padding: 18px 22px; text-align: center;
  pointer-events: auto; cursor: pointer; z-index: 60;
}
#hintbox .hintstep { font-size: 12px; color: #7a9a88; display: block; margin-bottom: 2px; letter-spacing: 2px; }
#loadingtip {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 22px; letter-spacing: 6px; color: #fdfef8; text-shadow: 0 2px 6px rgba(20,80,90,.7);
  pointer-events: none; z-index: 95;
}

/* ---- 标题界面 ---- */
#titleui { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; pointer-events: auto; }
#gametitle {
  margin-top: 64px; font-size: 44px; letter-spacing: 8px; text-indent: 8px; color: #fdfef8;
  text-shadow: 0 2px 0 rgba(70,130,140,.55), 0 6px 18px rgba(20,80,90,.55); font-weight: bold;
}
#titlesub { margin-top: 6px; font-size: 14.5px; letter-spacing: 4px; color: rgba(250,255,250,.95); text-shadow: 0 1px 4px rgba(20,80,90,.65); }
#titlebtns {
  position: absolute; left: 63px; top: 434px; width: 232px;
  display: flex; flex-direction: column; gap: 14px; align-items: stretch;
}
#titlebtns .btn { width: 100%; padding: 13px 0; font-size: 20px; }
#setbtn {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: none; cursor: pointer;
}
#relstrip {
  position: absolute; top: -54px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: linear-gradient(170deg, #fdf8e8, #f3ecd4); color: #5a4a2a; font-size: 15px; letter-spacing: 1px;
  padding: 10px 22px; border-radius: 4px; box-shadow: 0 3px 10px rgba(40,50,30,.3);
  transition: top .45s ease; z-index: 65; pointer-events: none;
}
#relstrip.show { top: 96px; }

/* ---- 全屏卡（结算/失败/结局/菜单） ---- */
.cardwrap {
  position: absolute; inset: 0; background: rgba(20,45,55,.45); display: flex;
  align-items: center; justify-content: center; z-index: 80; pointer-events: auto;
}
.card {
  width: 330px; max-height: 780px; overflow-y: auto; padding: 20px 18px;
  background: linear-gradient(168deg, rgba(253,251,240,.97), rgba(238,244,230,.96));
  border-radius: 18px 22px 19px 21px; text-align: center; color: #2d4a43;
  box-shadow: 0 8px 30px rgba(10,40,50,.5), inset 0 0 18px rgba(150,200,175,.3);
}
.card h2 { font-size: 24px; letter-spacing: 5px; text-indent: 5px; margin-bottom: 8px; color: #2a4a3e; }
.card h3 { font-size: 17px; margin: 8px 0 4px; color: #3c5a4c; letter-spacing: 2px; }
.card p { font-size: 15px; line-height: 1.55; margin: 4px 0; }
.card .ledger { text-align: left; font-size: 13.5px; line-height: 1.7; background: rgba(255,252,240,.7); border-radius: 10px; padding: 8px 12px; margin: 6px 0; color: #3a5548; }
.card .ledger .hl { color: #b0452e; font-weight: bold; }
.card .btn { margin-top: 10px; }
.card .btncol { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 10px; }
.card .stars { font-size: 30px; letter-spacing: 8px; color: #d8a020; text-shadow: 0 1px 2px rgba(120,80,0,.4); min-height: 38px; }
.card .graystar { color: #b8c4b4; }
.card .advise { color: #8a5a20; background: rgba(255,240,200,.55); border-radius: 10px; padding: 8px 10px; font-size: 14.5px; margin: 6px 0; }
.card .miniraft { display: flex; justify-content: space-around; margin: 4px 0; }
.card .miniraft canvas { width: 120px; height: 150px; }
.card .rellist { text-align: left; font-size: 13px; line-height: 1.7; color: #4a6a58; }

/* ---- 暂停菜单 ---- */
.menucard .btn { margin-bottom: 10px; }

/* ---- 航海图 ---- */
#mapcard { width: 358px; }
.searow {
  display: flex; align-items: center; gap: 8px; margin: 8px 0; padding: 9px 10px; text-align: left;
  background: rgba(214,236,224,.5); border-radius: 12px; border: 1.5px solid rgba(90,140,110,.3);
  cursor: pointer; position: relative;
}
.searow.locked { filter: grayscale(.8); opacity: .55; cursor: default; }
.searow.current { border-color: rgba(220,150,40,.8); box-shadow: 0 0 8px rgba(220,150,40,.4); }
.searow .seaname { font-size: 18px; font-weight: bold; color: #2a4a3e; letter-spacing: 2px; }
.searow .seadesc { font-size: 12.5px; color: #5a7a68; margin-top: 2px; }
.searow .seastars { position: absolute; right: 10px; top: 8px; font-size: 17px; color: #d8a020; letter-spacing: 2px; }
.searow .seastars .graystar { color: #b8c4b4; }
.searow .isledots { display: flex; gap: 4px; margin-top: 4px; }
.isledot { width: 14px; height: 10px; border-radius: 6px 8px 7px 6px; background: #c9a86a; }
.isledot.green { background: #6abf6e; }

/* ---- 关系簿 ---- */
#relbook { width: 340px; }
.relpage { display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px; margin: 8px 0; border-radius: 12px; background: rgba(255,250,232,.75); }
.relpage.locked { filter: grayscale(1); opacity: .5; }
.relpage canvas { width: 56px; height: 56px; flex: none; }
.relpage .relname { font-size: 15.5px; font-weight: bold; color: #3a5548; }
.relpage .reldesc { font-size: 13px; color: #5a7a68; line-height: 1.45; margin-top: 2px; }
.relpage .relcount { font-size: 12.5px; color: #a08340; margin-top: 2px; }

/* ---- 设置 ---- */
.setrow { display: flex; align-items: center; justify-content: space-between; padding: 9px 6px; font-size: 17px; }
.toggle { width: 52px; height: 28px; border-radius: 14px; background: #b8c8bc; border: none; cursor: pointer; position: relative; transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fdfcf4; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.toggle.on { background: #6ab08a; }
.toggle.on::after { left: 27px; }

/* ---- 拖动幽灵 ---- */
#dragghost { position: absolute; width: 78px; height: 60px; margin: -30px 0 0 -39px; pointer-events: none; z-index: 90; display: none; filter: drop-shadow(0 4px 6px rgba(20,50,60,.4)); }
#dragghost canvas { width: 78px; height: 60px; }

/* ---- 放生确认 ---- */
#releasepop {
  position: absolute; width: 240px; padding: 12px 14px; z-index: 70;
  background: rgba(255,252,238,.97); border-radius: 14px 18px 14px 18px; text-align: center;
  box-shadow: 0 5px 16px rgba(20,50,60,.4); font-size: 15px; color: #3a5548;
}
#releasepop .popbtns { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }

/* ---- 飘字 ---- */
.floattext {
  position: absolute; font-size: 17px; font-weight: bold; letter-spacing: 1px; pointer-events: none; z-index: 50;
  text-shadow: 0 1px 3px rgba(20,60,60,.5); animation: floatup 1.3s ease-out forwards; white-space: nowrap;
}
@keyframes floatup { 0% { opacity: 0; transform: translateY(6px);} 15% { opacity: 1;} 100% { opacity: 0; transform: translateY(-34px);} }

/* ---- 见面礼弹窗 ---- */
.giftpop { display: flex; align-items: center; gap: 6px; justify-content: center; margin: 4px 0; }
.giftpop canvas { width: 44px; height: 44px; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: rgba(100,150,120,.4); border-radius: 2px; }
