:root {
  color-scheme: light;
  --ink: #3b2230; --paper: #fffaf0; --paper2: #f6ebd5; --gold: #f2b23e; --gold2: #c9852a; --rose: #d9576b; --green: #6fae4c; --sub: #7d6470;
  --bw: 2px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #bfe6ef; color: var(--ink); font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif; font-weight: 700; overscroll-behavior: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; image-rendering: pixelated; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { image-rendering: pixelated; display: block; }
h1, h2, h3, p, ol, dl, dd { margin: 0; padding: 0; }

/* ドット風の枠：角を欠いた二重線 */
.frame, .plate, .clockbox, .news, .herebar, .tabs, .panel, .sheet, .mini {
  background: var(--paper);
  box-shadow: 0 calc(var(--bw) * -1) 0 var(--ink), 0 var(--bw) 0 var(--ink), calc(var(--bw) * -1) 0 0 var(--ink), var(--bw) 0 0 var(--ink), 0 4px 0 2px rgba(59, 34, 48, .24);
}

.top { position: fixed; z-index: 3; top: calc(env(safe-area-inset-top) + 10px); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none; }
.plate { position: relative; padding: 8px 16px 8px; background: linear-gradient(var(--paper), var(--paper2)); min-width: 0; }
.plate h1 { font-size: 20px; font-weight: 900; letter-spacing: .04em; line-height: 1.2; white-space: nowrap; }
.plate p { font-size: 11px; color: var(--sub); margin-top: 2px; white-space: nowrap; }
.corner { position: absolute; width: 6px; height: 6px; background: var(--gold); box-shadow: 0 0 0 2px var(--ink); }
.corner.tl { left: -3px; top: -3px; } .corner.tr { right: -3px; top: -3px; } .corner.bl { left: -3px; bottom: -3px; } .corner.br { right: -3px; bottom: -3px; }
.clockbox { padding: 6px 8px; font-size: 11px; text-align: right; pointer-events: auto; flex: none; }
.clockpart { display: inline-block; background: var(--ink); color: #fff0c8; padding: 0 6px; margin-right: 4px; }
.clockbtns { display: flex; gap: 6px; margin-top: 6px; justify-content: flex-end; }
.mini { padding: 3px 7px; font-size: 11px; background: var(--paper2); white-space: nowrap; --bw: 1.5px; box-shadow: 0 calc(var(--bw) * -1) 0 var(--ink), 0 var(--bw) 0 var(--ink), calc(var(--bw) * -1) 0 0 var(--ink), var(--bw) 0 0 var(--ink); }
.mini.is-on { background: var(--gold); }
.soundrow { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.soundrow .mini { flex: none; }
#volume { flex: 1; min-width: 0; width: 72px; height: 24px; margin: 0; accent-color: var(--ink); cursor: pointer; }

.bottom { position: fixed; z-index: 3; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); display: flex; flex-direction: column; gap: 9px; max-width: 620px; margin: 0 auto; }
.news { display: flex; align-items: center; gap: 8px; padding: 6px 10px; text-align: left; font-size: 12.5px; min-height: 32px; }
.news-tag { flex: none; background: var(--rose); color: #fff; font-size: 10.5px; padding: 1px 6px; }
#newsline { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.herebar { display: flex; align-items: center; gap: 8px; padding: 5px 8px; min-height: 52px; }
.here-label { font-size: 10.5px; color: var(--sub); line-height: 1.2; width: 3.1em; flex: none; }
.here { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; align-items: center; min-width: 0; }
.here::-webkit-scrollbar, .tabs::-webkit-scrollbar, .tabs-in::-webkit-scrollbar { display: none; }
.here-empty { font-size: 12px; color: var(--sub); }
.face { flex: none; width: 40px; height: 40px; display: grid; place-items: center; background: #dff0e0; box-shadow: 0 0 0 1.5px var(--ink); overflow: hidden; }
.face img { width: 39px; height: auto; }
.all { flex: none; }

.tabs { display: flex; gap: 6px; padding: 6px; align-items: stretch; background: var(--paper2); }
.tabs-in { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; scroll-padding: 8px; }
.tab { flex: none; width: 58px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; padding: 3px 0 4px; background: var(--paper); box-shadow: 0 0 0 1.5px rgba(59, 34, 48, .3); }
.tab.is-on { background: var(--gold); box-shadow: 0 0 0 2px var(--ink); }
.tab-pic { width: 44px; height: 34px; display: grid; place-items: center; overflow: hidden; }
.tab-pic img { max-width: 44px; max-height: 34px; width: auto; height: auto; object-fit: contain; }
.tab-name { white-space: nowrap; }
.map-pic { background:
  linear-gradient(135deg, transparent 46%, #6fb6d3 46% 56%, transparent 56%),
  linear-gradient(#a6d27a, #a6d27a); width: 34px; height: 30px; margin: 2px; box-shadow: 0 0 0 1.5px var(--ink); }

.panel { position: fixed; z-index: 4; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); max-width: 620px; margin: 0 auto; max-height: 62vh; display: flex; flex-direction: column; padding: 10px 12px; }
.panel[hidden], .sheet[hidden] { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel-head h2 { font-size: 15px; font-weight: 900; }
.panel-close { width: 28px; height: 28px; font-size: 17px; line-height: 1; background: var(--paper2); box-shadow: 0 0 0 1.5px var(--ink); }
#feed { list-style: none; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
#feed li { display: flex; gap: 8px; padding: 5px 2px; border-bottom: 1px dashed rgba(59, 34, 48, .2); cursor: pointer; }
#feed time { color: var(--sub); font-size: 11px; flex: none; padding-top: 1px; font-variant-numeric: tabular-nums; }
.alllist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; overflow-y: auto; padding: 2px; }
.row { display: flex; gap: 8px; align-items: center; text-align: left; padding: 5px; background: var(--paper2); box-shadow: 0 0 0 1.5px rgba(59, 34, 48, .3); }
.row img { width: 39px; flex: none; }
.row b { display: block; font-size: 13px; }
.row small { display: block; font-size: 10.5px; color: var(--sub); line-height: 1.25; font-weight: 500; }
.homesearch { width: 100%; font: inherit; font-size: 16px; padding: 7px 9px; margin-bottom: 8px; background: #fff; border: 0; box-shadow: 0 0 0 1.5px var(--ink); border-radius: 0; flex: none; }
.homelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; overflow-y: auto; padding: 2px; min-height: 0; }
.homecard { position: relative; }
.homecard[hidden] { display: none; }
.homecard .homepic { width: 46px; height: 38px; flex: none; display: grid; place-items: center; }
.homecard .homepic img { width: auto; max-width: 46px; max-height: 38px; }
.homecard .homeface { position: absolute; left: 34px; top: 26px; width: 20px; height: 20px; background: var(--paper); box-shadow: 0 0 0 1.5px var(--ink); image-rendering: pixelated; }
.homecard > span:last-child { padding-left: 4px; min-width: 0; word-break: keep-all; overflow-wrap: anywhere; }
.homecard b { font-size: 12.5px; }
.homecard.is-home small { color: #3f7d3a; }
.home-empty { font-size: 13px; color: var(--sub); padding: 14px 4px; text-align: center; }
.home-streets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; flex: none; }

.sheet { position: fixed; z-index: 4; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); max-width: 620px; margin: 0 auto; padding: 12px; }
.sheet .panel-close { position: absolute; right: 10px; top: 10px; }
.sheet-head { display: flex; gap: 12px; align-items: center; padding-right: 32px; }
.sheet-pic { flex: none; width: 66px; height: 66px; display: grid; place-items: center; background: #dff0e0; box-shadow: 0 0 0 2px var(--ink); }
.sheet-pic img { width: 52px; }
.sheet-head h3 { font-size: 18px; font-weight: 900; }
.sheet-head p { font-size: 12.5px; color: var(--sub); margin-top: 2px; }
#sheetneeds { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 10px; font-size: 11px; }
#sheetneeds > div { display: flex; align-items: center; gap: 6px; }
#sheetneeds dt { width: 5.2em; flex: none; white-space: nowrap; }
.bar { flex: 1; height: 9px; background: #eadfca; box-shadow: 0 0 0 1.5px var(--ink); }
.bar i { display: block; height: 100%; background: var(--green); }
.sheet-friends { font-size: 12px; margin-top: 9px; color: var(--sub); }

/* 全景では人の列と文字を減らして、地図を広く */
.is-map .news { display: none; }
body.has-sheet .bottom { visibility: hidden; }

@media (min-width: 900px) {
  .plate h1 { font-size: 24px; }
  .tab { width: 66px; }
}

#loading { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; background: var(--ink); color: #fff0c8; font-size: 16px; transition: opacity .4s; }

/* 外に出るボタンとさがす列 */
.exitroom { position: fixed; left: 12px; top: 84px; z-index: 5; padding: 8px 14px; font-size: 13px; }
.seek { flex: none; display: grid; justify-items: center; gap: 2px; width: 46px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--ink); }
.seek .face { width: 36px; height: 36px; }
.seek .face img { width: 35px; }
.seek small { font-size: 9.5px; line-height: 1.1; max-width: 46px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--sub); font-weight: 700; }
.place-head { grid-column: 1 / -1; margin: 6px 2px 0; font-size: 12px; font-weight: 700; color: var(--sub); }
.place-head.is-here { color: var(--ink); }
