:root {
  --ink: #4a2f4f;
  --pink: #ff6f9f;
  --pink-d: #d84a7c;
  --cream: #fff8ec;
  --cream-d: #e8d6bc;
  --red: #ff6464;
  --red-d: #c83c3c;
  --sky: #9fdcff;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--ink);
  font-family: 'DotGothic16', 'M PLUS Rounded 1c', monospace;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
#wrap { position: fixed; inset: 0; overflow: hidden; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; image-rendering: pixelated; }
[hidden] { display: none !important; }

/* pixel buttons: stepped border and a hard shadow underneath (leave room for it between rows) */
.btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 14px; margin: 14px 0 20px; }
.pb {
  font: inherit; font-size: 17px; color: var(--ink); border: 0; cursor: pointer; padding: 10px 20px; min-width: 110px;
  background: var(--cream);
  box-shadow: 0 0 0 3px var(--ink), 0 6px 0 3px var(--ink);
  transition: transform .06s steps(2);
}
.pb:active { transform: translateY(4px); box-shadow: 0 0 0 3px var(--ink), 0 2px 0 3px var(--ink); }
.pb.big { font-size: 22px; padding: 12px 34px; }
.pb.pink { background: var(--pink); color: #fff; text-shadow: 2px 2px 0 var(--pink-d); }
.pb.cream { background: var(--cream); }
.pb.red { background: var(--red); color: #fff; text-shadow: 2px 2px 0 var(--red-d); }
.pb.on { background: #b6f0a0; }

.gear {
  position: absolute; z-index: 6; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
  width: 52px; height: 52px; border: 0; cursor: pointer; background: var(--cream) center / 39px 39px no-repeat;
  image-rendering: pixelated; box-shadow: 0 0 0 3px var(--ink);
}
.gear:active { background-color: #ffe9c4; }

.screen { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.title .logo { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 8px; }
.logo-main {
  font-size: clamp(44px, 9vw, 92px); color: #fff; letter-spacing: .06em;
  text-shadow: 0 5px 0 var(--pink-d), 4px 0 0 var(--ink), -4px 0 0 var(--ink), 0 -4px 0 var(--ink), 0 9px 0 var(--ink);
  animation: bob 2.4s steps(6) infinite;
}
.logo-sub { font-size: clamp(14px, 2.4vw, 20px); background: var(--cream); padding: 4px 14px; box-shadow: 0 0 0 3px var(--ink); }
.title-chars { display: flex; gap: 22px; margin: 10px 0 4px; }
.title-chars img { width: 90px; height: 100px; image-rendering: pixelated; animation: bob 1.2s steps(2) infinite; }
.title-chars img:nth-child(2) { animation-delay: .3s; }
.title-chars img:nth-child(3) { animation-delay: .6s; }
.proto { margin: 0; font-size: 13px; background: rgba(255, 255, 255, .7); padding: 2px 10px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.map { justify-content: center; }
.map-path { position: relative; width: min(96vw, 1000px); height: min(86vh, 560px); }
.node {
  position: absolute; width: 74px; height: 74px; margin: -37px 0 0 -37px; border: 0; cursor: pointer; font: inherit;
  font-size: 26px; color: #fff; background: var(--pink); border-radius: 0;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  text-shadow: 2px 2px 0 var(--pink-d);
  box-shadow: inset 0 -6px 0 var(--pink-d);
}
.node.locked { background: #b8b0bc; box-shadow: inset 0 -6px 0 #8a8090; text-shadow: none; cursor: default; }
.node.cur { animation: bob 1s steps(3) infinite; }
.node-stars { position: absolute; width: 90px; margin-left: -45px; text-align: center; font-size: 18px; color: #ffd93b; text-shadow: 2px 2px 0 var(--ink); pointer-events: none; }
.map-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; background: #fff; box-shadow: 0 0 0 2px var(--ink); }

.panel {
  position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(92vw, 620px); max-height: 92vh; overflow: auto; text-align: center; padding: 18px 24px 2px;
  background: var(--cream); box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--ink), 8px 10px 0 8px rgba(74, 47, 79, .35);
  animation: pop .22s steps(4);
}
@keyframes pop { from { transform: translate(-50%, -50%) scale(.8); } to { transform: translate(-50%, -50%) scale(1); } }
.panel h2 { margin: 0 0 8px; font-size: clamp(24px, 4vw, 34px); color: var(--pink); font-weight: 400; text-shadow: 3px 3px 0 #ffd0de; }
.goals { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; font-size: 18px; margin: 6px 0; }
.goals span { display: inline-flex; align-items: center; gap: 6px; }
.goals img, .res-card img { image-rendering: pixelated; }
.res-card { display: flex; gap: 14px; align-items: center; text-align: left; background: #fff; padding: 10px 14px; margin: 10px 0; box-shadow: 0 0 0 3px var(--ink); }
.res-card img { width: 72px; height: 80px; flex: none; }
.res-card b { font-size: 20px; color: var(--pink); font-weight: 400; }
.res-card p { margin: 4px 0 0; font-size: 15px; line-height: 1.5; }
.tutor { font-size: 16px; line-height: 1.6; text-align: left; }
.tutor p { margin: 8px 0; padding: 8px 12px; background: #fff3c4; box-shadow: 0 0 0 2px var(--ink); }
.stars { font-size: 56px; letter-spacing: 8px; min-height: 70px; }
.stars span { display: inline-block; color: #d8ccd8; text-shadow: 3px 3px 0 var(--ink); }
.stars span.got { color: #ffd93b; animation: starpop .35s steps(4); }
@keyframes starpop { 0% { transform: scale(2.2) rotate(-30deg); } 100% { transform: scale(1); } }
.score-line { font-size: 26px; margin: 4px 0; }
.best-line { font-size: 15px; margin: 0; opacity: .8; }
.paused { margin: 0; color: var(--pink-d); }
.langs { display: flex; flex-direction: column; align-items: center; margin-top: 6px; }
.langs .btns { margin: 8px 0 6px; }
.langs .pb { min-width: 0; padding: 8px 14px; font-size: 15px; }
.ask { background: #fff; padding: 6px 12px; box-shadow: 0 0 0 3px var(--red); margin: 10px 0; }
@media (max-height: 460px) {
  .panel { padding-top: 10px; }
  .btns { margin: 10px 0 14px; }
  .pb.big { font-size: 19px; padding: 9px 26px; }
  .title-chars img { width: 63px; height: 70px; }
  .stars { font-size: 42px; min-height: 52px; }
}

/* item bar: square pixel buttons with a count badge */
.items { position: absolute; z-index: 4; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 10px; }
.items.row { display: flex; justify-content: center; gap: 12px; }
.item {
  position: relative; border: 0; padding: 4px; cursor: pointer; background: var(--cream); aspect-ratio: 1; min-width: 44px; max-width: 60px;
  box-shadow: 0 0 0 3px var(--ink), 0 4px 0 3px var(--ink);
}
.item img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.item i { position: absolute; right: -6px; bottom: -6px; font-style: normal; font-size: 13px; color: #fff; background: var(--pink); padding: 0 5px; box-shadow: 0 0 0 2px var(--ink); }
.item.on { background: #ffe45c; animation: bob .6s steps(2) infinite; }
.item.empty { opacity: .45; }
.item-tip { position: absolute; z-index: 5; left: 50%; top: 8px; transform: translateX(-50%); margin: 0; padding: 6px 14px; background: #ffe45c; box-shadow: 0 0 0 3px var(--ink); font-size: 16px; white-space: nowrap; }
#hub-btn { position: relative; }
/* unread / something to collect: a red dot inside the top-right corner */
#hub-btn b { position: absolute; right: 4px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #ff3b4a; box-shadow: 0 0 0 2px #fff; }
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 10px; margin: 4px 0 12px; }
.tabs .pb { min-width: 0; padding: 7px 12px; font-size: 15px; }
.hub-body { text-align: left; font-size: 15px; min-height: 160px; }
.hub-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 10px 0; background: #fff; box-shadow: 0 0 0 2px var(--ink); }
.hub-row .grow { flex: 1; }
.hub-row .pb { min-width: 0; padding: 6px 12px; font-size: 14px; }
.hub-row.done { opacity: .55; }
.bar { height: 8px; background: #eee; box-shadow: 0 0 0 2px var(--ink); margin-top: 4px; }
.bar i { display: block; height: 100%; background: #ffcf3a; }
.rw { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; white-space: nowrap; }
.rw img { width: 22px; height: 22px; image-rendering: pixelated; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 8px 0; }
.cal div { background: #fff; box-shadow: 0 0 0 2px var(--ink); text-align: center; padding: 4px 2px; font-size: 13px; }
.cal div.got { background: #b6f0a0; }
.cal div.today { background: #ffe45c; animation: bob 1s steps(2) infinite; }
.note { font-size: 12px; opacity: .7; }
.ad-box { background: #222; color: #fff; padding: 30px 10px; margin: 10px 0 20px; }
.ad-count { font-size: 40px; margin: 6px 0 0; }
.pb.locked { opacity: .5; }

/* the world map: a long landscape that scrolls sideways */
.map { justify-content: stretch; align-items: stretch; }
.map-scroll { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-x; }
.map-scroll::-webkit-scrollbar { display: none; }
.map-world { position: relative; height: 100%; }
.map-world .area-bg { position: absolute; top: 0; height: 100%; image-rendering: pixelated; pointer-events: none; }
.area-name { position: absolute; top: 14%; transform: translateX(-50%); font-size: clamp(18px, 3.2vh, 28px); color: #fff; background: var(--pink); padding: 4px 14px; box-shadow: 0 0 0 3px var(--ink), 0 5px 0 3px var(--ink); white-space: nowrap; }
.map-road { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: #fff8ec; box-shadow: 0 0 0 2px var(--ink); }
.map-me { position: absolute; width: 56px; height: 56px; margin: -100px 0 0 -28px; image-rendering: pixelated; pointer-events: none; animation: bob .8s steps(2) infinite; }
.map-bar { position: absolute; z-index: 4; left: max(12px, env(safe-area-inset-left)); bottom: 14px; display: flex; gap: 14px; align-items: center; }
/* 家づくり */
.home { position: absolute; inset: 0; z-index: 3; }
#home-cv { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.home-top { position: absolute; left: 12px; top: 12px; display: flex; gap: 10px; align-items: center; z-index: 2; }
.home-top .pb { min-width: 0; padding: 8px 14px; }
.home-top .arrow { padding: 8px 10px; }
.home-room { font-size: 22px; color: #fff; text-shadow: 2px 2px 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); min-width: 6em; text-align: center; }
.home-stars { font-size: 22px; color: #ffe45c; background: var(--ink); padding: 4px 12px; }
.home-list { position: absolute; right: 12px; top: 78px; bottom: 96px; width: min(280px, 30vw); overflow: auto; background: rgba(255, 248, 236, .95); box-shadow: 0 0 0 3px var(--ink); padding: 8px 12px; z-index: 2; }
.home-list h3 { margin: 4px 0 8px; color: var(--pink); font-weight: 400; font-size: 20px; }
.task { display: flex; align-items: center; gap: 6px; background: #fff; padding: 8px; margin: 10px 0 14px; box-shadow: 0 0 0 2px var(--ink); }
.task b { flex: 1; font-weight: 400; font-size: 17px; }
.task .want { width: 30px; height: 30px; image-rendering: pixelated; animation: bob .8s steps(2) infinite; }
.task .pb { min-width: 0; padding: 6px 10px; font-size: 15px; }
.home-mates { position: absolute; right: 12px; bottom: 12px; width: min(280px, 30vw); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; background: rgba(255, 248, 236, .95); box-shadow: 0 0 0 3px var(--ink); padding: 6px 10px; z-index: 2; }
.mate { display: flex; align-items: center; gap: 2px; font-size: 14px; color: var(--pink-d); }
.mate img { width: 28px; height: 28px; image-rendering: pixelated; }
.pick-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.pick { position: relative; border: 0; background: #fff; padding: 6px; cursor: pointer; box-shadow: 0 0 0 3px var(--ink), 0 5px 0 3px var(--ink); display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; font-size: 16px; color: var(--ink); }
.pick img { width: min(240px, 26vw); image-rendering: pixelated; }
.pick .fan { position: absolute; right: -8px; top: -10px; width: 36px; height: 36px; }
@media (orientation: portrait) {
  .home-list { top: auto; bottom: 70px; left: 12px; right: 12px; width: auto; height: 34vh; }
  .home-mates { left: 12px; right: 12px; width: auto; }
}
.node.boss { width: 88px; height: 88px; margin: -44px 0 0 -44px; background: #b264ff; box-shadow: inset 0 -6px 0 #7a35c9; }
.node.boss.locked { background: #b8b0bc; box-shadow: inset 0 -6px 0 #8a8090; }

/* notice board: tabs down the left, cards on the right */
#hub { width: min(94vw, 900px); padding: 14px 18px 0; }
.hub-wrap { display: flex; gap: 16px; text-align: left; }
.hub-tabs { display: flex; flex-direction: column; gap: 12px; flex: none; width: 150px; }
.hub-tabs .tab { position: relative; display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; padding: 8px 10px; box-shadow: 0 0 0 3px var(--ink), 0 4px 0 3px var(--ink); }
.hub-tabs .tab img { width: 30px; height: 30px; image-rendering: pixelated; }
.hub-tabs .tab.on { background: var(--pink); color: #fff; text-shadow: 2px 2px 0 var(--pink-d); }
.hub-tabs .dot { position: absolute; right: 5px; top: 50%; margin-top: -6px; width: 12px; height: 12px; border-radius: 50%; background: #ff3b4a; box-shadow: 0 0 0 2px #fff; }
.hub-body { flex: 1; max-height: min(64vh, 520px); overflow: auto; padding: 4px 8px 8px 4px; }
.have { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 10px; background: var(--ink); color: #fff; margin-bottom: 6px; }
.have .rw img { width: 24px; height: 24px; }
.hub-row { gap: 12px; padding: 10px 12px; margin: 12px 0 14px; box-shadow: 0 0 0 3px var(--ink), 0 4px 0 3px rgba(74, 47, 79, .25); }
.hub-row .lead { position: relative; width: 52px; height: 52px; flex: none; background: #fff3c4; box-shadow: 0 0 0 2px var(--ink); display: grid; place-items: center; }
.hub-row .lead img { width: 40px; height: 40px; image-rendering: pixelated; }
.hub-row .stamp { position: absolute; right: -8px; bottom: -8px; width: 24px; height: 24px; display: grid; place-items: center; background: #7be05a; color: #fff; box-shadow: 0 0 0 2px var(--ink); font-size: 16px; }
.hub-row b { font-weight: 400; font-size: 17px; }
.hub-row .pb { padding: 9px 14px; font-size: 15px; }
.hub-row.done { opacity: .6; }
.bar { position: relative; height: 16px; margin: 6px 0; background: #f0e6f4; box-shadow: 0 0 0 2px var(--ink); }
.bar i { display: block; height: 100%; background: linear-gradient(#ffe48a, #ffcf3a); }
.bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--ink); }
.cal { gap: 10px; }
.cal div { padding: 6px 2px 8px; font-size: 14px; box-shadow: 0 0 0 3px var(--ink); }
.cal div .rw { display: block; margin: 2px 0 0; }
.cal div .rw img { width: 30px; height: 30px; }
@media (max-width: 760px), (max-height: 460px) {
  .hub-tabs { width: 116px; gap: 10px; }
  .hub-tabs .tab { font-size: 13px; padding: 6px; }
  .hub-tabs .tab img { width: 22px; height: 22px; }
  .hub-body { max-height: 58vh; }
}
.test-box { margin: 8px 0; padding: 4px 10px; box-shadow: 0 0 0 2px #c8b0d0; background: #f6f0fa; }
.test-box .note { margin: 6px 0 0; }

/* floors of the map */
.floor-bar { position: absolute; z-index: 4; left: 50%; top: 12px; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; }
.floor-bar .pb { min-width: 0; padding: 6px 12px; }
.floor-bar .pb:disabled { opacity: .4; }
.floor-name { font-size: 20px; color: #fff; background: var(--ink); padding: 4px 14px; }
.map-fog { position: absolute; top: 0; bottom: 0; right: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(250,246,255,.92) 80px, rgba(244,238,252,.97)); }
/* stage stones: round candy buttons with a light rim */
.node { border-radius: 50%; clip-path: none; box-shadow: 0 0 0 3px var(--ink), inset 0 -6px 0 var(--pink-d), inset 0 4px 0 rgba(255,255,255,.45); }
.node.locked { box-shadow: 0 0 0 3px var(--ink), inset 0 -6px 0 #8a8090; }
.node.boss { box-shadow: 0 0 0 3px var(--ink), 0 0 0 7px #ffe45c, 0 0 0 10px var(--ink), inset 0 -6px 0 #7a35c9; }

/* rewards flying into the item bar */
.flyer { position: fixed; left: 0; top: 0; width: 48px; height: 48px; z-index: 50; pointer-events: none; image-rendering: pixelated; filter: drop-shadow(0 0 6px #fff6a0); }
.spark { position: fixed; z-index: 51; width: 6px; height: 6px; margin: -3px 0 0 -3px; pointer-events: none; box-shadow: 0 0 0 1px var(--ink); }
.have .rw i { font-style: normal; }
.have .rw.bump { animation: bump .45s steps(5); }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.7); color: #ffe45c; } 100% { transform: scale(1); } }

/* ---- PIKZEA: the account row in settings and the rankings (DECISIONS K2–K4) ---- */
.account-box { margin: 10px 0 4px; padding: 8px 12px 10px; background: #fff; box-shadow: 0 0 0 3px var(--ink); text-align: left; }
.acct-head { margin: 0; font-size: 16px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.acct-head b { color: var(--pink); font-weight: 400; }
.acct-note { margin: 4px 0 8px; font-size: 14px; line-height: 1.5; }
.account-box .pb { display: block; text-align: center; text-decoration: none; font-size: 16px; padding: 8px 14px; }
.ranking { width: min(94vw, 680px); }
.rank-tabs { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.rank-tabs .pb { min-width: 0; padding: 8px 16px; font-size: 17px; }
.rank-tabs.small .pb { padding: 6px 12px; font-size: 15px; }
.rank-note { margin: 2px 0 6px; font-size: 13px; line-height: 1.5; opacity: .85; }
.rank-mine { min-height: 34px; margin: 8px 0; padding: 6px 10px; background: #fff3c4; box-shadow: 0 0 0 3px var(--ink); font-size: 16px; display: flex; flex-direction: column; justify-content: center; }
.rank-mine p { margin: 0; }
.rank-me { color: var(--pink-d); }
.rank-sub { font-size: 14px; }
.rank-list { list-style: none; margin: 6px 0; padding: 0; text-align: left; }
.rank-list li { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: center; padding: 5px 10px; font-size: 16px; background: #fff; margin: 4px 0; box-shadow: 0 0 0 2px var(--ink); }
.rank-list li .rk { text-align: center; font-size: 18px; }
.rank-list li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list li .sc { font-size: 15px; white-space: nowrap; }
.rank-list li.top1 { background: #ffe680; }
.rank-list li.top2 { background: #eef1f6; }
.rank-list li.top3 { background: #ffd8b0; }
.rank-list li.rank-empty { display: block; text-align: center; opacity: .8; }
@media (max-height: 460px) {
  .rank-list li { padding: 3px 8px; font-size: 14px; }
  .rank-tabs .pb { padding: 5px 12px; font-size: 14px; }
}
