:root {
  color-scheme: light;
  font-family: "Yu Gothic", Meiryo, system-ui, sans-serif;
  color: #203e35;
  background: #f4f5ee;
  --green: #214f42;
  --line: #d1dbd0;
  --paper: #fffef9;
}
* { box-sizing: border-box }
body, h1, h2, p { margin: 0 }
button, input { font: inherit }
button, a { touch-action: manipulation }
button { cursor: pointer; color: inherit }
button:disabled { opacity: .45; cursor: default }
:focus-visible { outline: 3px solid #cd6227; outline-offset: 3px }
[hidden] { display: none !important }
.mast { background: var(--green); color: #fffdf3; border-bottom: 3px solid #b5ca9f }
.mast-inner, main { max-width: 1360px; margin: auto; padding-inline: clamp(14px, 3.5vw, 52px) }
.mast-inner { min-height: 62px; display: flex; align-items: center; gap: 13px }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: 1.04rem }
.brand img { border-radius: 10px }
.edition { border-left: 1px solid #839f8e; padding-left: 13px; font-size: .87rem }
.language { margin-left: auto; color: inherit; text-underline-offset: 4px; font-size: .88rem }
main { padding-bottom: 24px }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: clamp(16px, 3vh, 32px) 0 15px }
h1 { font: 700 clamp(1.45rem, 2.4vw, 2.15rem)/1.3 "Yu Mincho", Georgia, serif }
.switcher { display: flex; padding: 4px; background: #e6eae0; border-radius: 9px; gap: 2px }
.switcher button, .viewer-head button, #pdf-controls button { border: 0; border-radius: 6px; background: transparent; padding: 7px 13px; font-size: .88rem; font-weight: 650 }
.switcher button[aria-pressed="true"] { background: var(--green); color: white }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 27vw, 385px); gap: 16px; align-items: stretch }
.map-card, .chat { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--paper) }
.map-card { display: flex; flex-direction: column; min-width: 0 }
.map-surround { flex: 1; display: grid; place-items: center; background-color: #dce3d8; background-image: radial-gradient(#bcc9b9 .85px, transparent .85px); background-size: 8px 8px; padding: clamp(5px, 1vw, 14px) }
.map-frame { position: relative; isolation: isolate; width: 100%; min-width: 0; max-width: max(490px, 89vh) }
#movement-notice { position: absolute; z-index: 3; pointer-events: none; width: max-content; max-width: calc(100% - 8px) }
#movement-notice:not(:empty) { padding: 6px 10px; border-radius: 6px; background: #1e293b; color: #fff; font-size: .875rem; line-height: 1.4 }
#map-viewport { width: 100%; aspect-ratio: 4/3; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; --zoom: 100% }
#map-viewport.camp { aspect-ratio: 10/7 }
#map-plane { display: grid; place-items: center; width: max(100%, var(--zoom)); min-height: 100% }
#map { position: relative; width: min(100%, var(--zoom)); aspect-ratio: 4/3; container-type: inline-size; cursor: crosshair; touch-action: manipulation; user-select: none; border-radius: 5px; box-shadow: 0 2px 10px #22372939 }
.camp #map { aspect-ratio: 10/7 }
.zoomed #map { cursor: grab; touch-action: pinch-zoom }
.zoomed #map.panning { cursor: grabbing }
.terrain, #zones, #actors { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; border-radius: inherit }
#zones polygon { fill: #cee8ff16; stroke: #206ba8; stroke-width: 1.5; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke }
#voice-radius { fill: #619fd91a; stroke: #286a99; stroke-width: 1.5; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke }
#zones .current { fill: #87d0ff38; stroke: #07578e; stroke-width: 2.5; stroke-dasharray: none }
#zones .announcement { stroke: #a95804; fill: #ffb53324 }
#zones .announcement.current { stroke: #98510c; fill: #ffb53352 }
#zone-labels { position: absolute; inset: 0; pointer-events: none }
.zone-label { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; padding: 1px 4px; font-size: clamp(9px, 1.4cqw, 12px); font-weight: bold; border-radius: 3px; background: #fffffff0; color: #075985 }
.zone-label.announcement { color: #884800 }
.map-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; padding: 5px 12px 8px; font-size: .8rem }
.zoom { position: absolute; right: 10px; bottom: 10px; z-index: 2; display: flex; gap: 4px }
.zoom button { padding: 5px 10px; min-height: 32px; border: 1px solid #aebac4; border-radius: 5px; background: #fff; color: #203142 }
#zoom-reset { min-width: 4em; font-variant-numeric: tabular-nums }
.actor { position: absolute; width: clamp(22px, 4.8cqw, 43px); height: clamp(22px, 4.8cqw, 43px); transform: translate(-50%, -50%); text-align: center }
.camp .actor { width: clamp(15px, 3.4cqw, 36px); height: clamp(15px, 3.4cqw, 36px) }
@container (max-width: 540px) {
  .camp .actor:not(.you):not(.audible) .name { display: none }
  .camp .actor .name { padding-inline: 3px }
}
.map-surround { overflow: hidden }
.actor.you { z-index: 1 }
.actor img { width: 100%; height: 100%; object-fit: cover; border: 2px solid #fffef5; background: #fbfaf5; border-radius: 50%; box-shadow: 0 2px 4px #15242288 }
.actor.you img { border: 3px solid #156d56; outline: 2px solid white }
.name { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; border-radius: 5px; font-weight: 700 }
.name { top: 95%; background: #253a31ee; color: white; font-size: clamp(.62rem, 1.5cqw, .77rem); padding: 1px 6px }
.you .name { background: #075642 }
.bubble { position: absolute; left: 72%; bottom: 76%; width: 22px; height: 22px; background: url("media/activity.svg") left center / 200% 100% no-repeat }
.bubble.sharing { background-position: right center }
.speech {
  position: absolute; top: 0; left: 0; pointer-events: none;
  width: max-content; max-width: min(220px, 42cqw); padding: 5px 9px;
  border: 1px solid #23608a; border-radius: 10px 10px 10px 2px;
  background: #f3faff; color: #143a54; box-shadow: 0 2px 5px #17374d29;
  text-align: start; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere;
}
.speech span { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3 }

#destination { position: absolute; width: 14px; height: 14px; transform: translate(-50%,-50%); border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 2px #216d55; pointer-events: none }
.map-foot, .movement, .viewer-head, #pdf-controls { display: flex; align-items: center }
.map-foot { justify-content: space-between; padding: 12px 16px; gap: 12px; border-top: 1px solid var(--line) }
.movement { gap: 9px; min-width: 0 }
.map-foot { flex-wrap: wrap }
.actor-reaction {
  position: absolute; bottom: 90%; left: 80%; padding: 2px 7px; font: 22px/1.35 system-ui;
  border: 1px solid #23608a; border-radius: 12px 12px 12px 2px; background: #f3faff;
}
.movement img { border: 2px solid #23765b; border-radius: 50% }
.movement strong { font-size: .88rem }
.movement p, #compose p, .chat-head p { color: #52695c; line-height: 1.5; font-size: .8rem }
.mute { color: #425c4b; background: #eef2e8; border: 1px solid var(--line); border-radius: 20px; white-space: nowrap; padding: 4px 10px; font-weight: 650; font-size: .76rem }
.chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; min-height: 0; position: relative }
#compose { grid-row: 4 }
#shares { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px 12px; border-top: 1px solid var(--line) }
#shares button { margin: 0; padding: 5px 8px }
.chat-head { padding: 14px 16px; border-bottom: 1px solid var(--line) }
h2 { font-size: 1.14rem }
.chat-head p { margin-top: 3px }
.viewer-head button, #pdf-controls button { background: #edf2e9; border: 1px solid var(--line); padding: 6px 9px }
#feed { overflow-y: auto; height: 0; min-height: 100%; overscroll-behavior: contain; padding: 14px 14px 10px; scrollbar-width: thin }
.message { display: grid; grid-template-columns: 31px minmax(0, 1fr); gap: 8px; margin-bottom: 14px; align-items: start }
.portrait { width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 50%; background: #f1f2e9 }
.byline { display: flex; gap: 8px; align-items: baseline }
.byline b { font-size: .85rem }
.byline time { color: #5e6e63; font-size: .73rem }
.message p { font-size: .91rem; line-height: 1.55; overflow-wrap: anywhere; margin-top: 2px }
.attachment { display: block; margin-top: 6px; overflow: hidden; border: 1px solid #c5d2c4; border-radius: 8px; padding: 0; text-align: start; color: #234e3e; background: #f5f7ef; max-width: 100%; font-size: .81rem; font-weight: 650 }
.inline-image { width: calc(100% - 39px); margin: -7px 0 14px 39px }
.inline-image:first-child { margin-top: 0 }
.inline-image img { display: block; width: 100%; max-height: 40vh; object-fit: contain }
.attachment span { display: block; padding: 7px 10px }
.attachment:hover, .viewer-head button:hover, #pdf-controls button:hover:enabled { background: #dfeade }
#compose { background: #f8f9f2; border-top: 1px solid var(--line); padding: 12px 15px }
#compose label { font-size: .83rem; font-weight: 700 }
.input-row { display: flex; gap: 6px; margin: 5px 0 }
.input-row input { min-width: 0; width: 100%; border: 1px solid #a7b9ac; background: white; color: inherit; padding: 8px; border-radius: 6px }
.input-row button { flex: none; background: var(--green); color: white; border: 0; border-radius: 6px; padding-inline: 14px; font-weight: 700 }
dialog { color: inherit; background: var(--paper); padding: 0; border: 1px solid var(--line); border-radius: 12px; max-width: min(760px,94vw); max-height: 94dvh }
dialog::backdrop { background: #10241ed9 }
.viewer-head, #pdf-controls { justify-content: space-between; padding: 10px 16px; gap: 10px }
#preview { display: block; width: 100%; object-fit: contain; max-height: 68dvh; background: #f6f6ed }
#pdf-controls { flex-wrap: wrap; justify-content: center; font-size: .88rem }
#pdf-controls a { color: var(--green); padding: 6px }
@media (max-width: 800px) {
  .workspace { grid-template-columns: 1fr }
  .map-frame { max-width: 74vh }
  .chat { height: clamp(320px, 54vh, 450px) }
}
@media (max-width: 520px) {
  main, .mast-inner { padding-inline: 10px }
  .mast-inner { min-height: 50px }
  .toolbar { align-items: flex-start; flex-direction: column; gap: 9px; margin: 14px 0 10px }
  .switcher { width: 100% }
  .switcher button { flex: 1 }
  .map-foot { padding: 8px; gap: 5px }
  .movement { gap: 6px }
  .movement p { font-size: .74rem }
  .workspace { gap: 10px }
}
