:root {
  --ink: #172d42;
  --paper: #f7f3ea;
  --muted: #59656c;
  --line: #d9d3c7;
}

* { box-sizing: border-box; }
html { background: #d8d5cf; }
body { margin: 0; padding: 24px; background: #d8d5cf; color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "PingFang SC", "Hiragino Sans GB", "Microsoft JhengHei", Arial, sans-serif; }
button { font: inherit; }

.sheet { width: 100%; max-width: 1440px; min-height: calc(100vh - 48px); margin: 0 auto; padding: 44px 56px 30px; overflow: hidden; background: var(--paper); box-shadow: 0 18px 55px #26374624; }
.masthead { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; margin-bottom: 22px; }
.masthead h1 { margin: 0; font-size: clamp(30px, 2.5vw, 40px); font-weight: 800; line-height: 1.14; letter-spacing: .25px; }
.subtitle { margin: 12px 0 0; color: #d76b43; font-size: clamp(21px, 1.8vw, 27px); font-weight: 700; line-height: 1.2; letter-spacing: .8px; }

.language-switch { display: inline-flex; flex: 0 0 auto; overflow: hidden; border: 1px solid var(--line); background: #eee9df; }
.language-button { min-width: 42px; height: 32px; padding: 0 11px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; }
.language-button + .language-button { border-left: 1px solid var(--line); }
.language-button.active { background: #fffdf8; color: var(--ink); font-weight: 700; }

.guide-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; margin: 0 0 26px; overflow: hidden; border: 1px solid var(--line); background: #ebe6dc; }
.guide-tab { position: relative; display: inline-flex; min-width: 0; height: 50px; align-items: center; justify-content: center; gap: 8px; padding: 0 8px; border: 0; border-left: 1px solid #d9d3c7; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.guide-tab:first-child { border-left: 0; }
.guide-tab svg { display: none; width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.guide-tab.active { background: #fffdf8; color: var(--accent); box-shadow: inset 0 -3px 0 currentColor, 0 1px 5px #172d4212; font-weight: 600; }
.guide-tab.active svg { display: block; }
.guide-tab:active { background: color-mix(in srgb, var(--accent) 12%, #fffdf8); color: var(--accent); }

.guide-content { display: grid; grid-template-columns: minmax(0, 36fr) minmax(0, 64fr); align-items: stretch; gap: clamp(32px, 4vw, 62px); height: clamp(345px, calc((100vw - 160px) * .38), 500px); }
.directory { order: 1; }
.map-wrap { order: 2; }
.map-wrap { position: relative; width: 100%; height: 100%; overflow: hidden; border: 1px solid #cfc9bc; background: #dfe5df; }
.map-wrap picture, .map { display: block; width: 100%; height: 100%; }
.map { object-fit: fill; }
.map-wrap::after { content: ""; position: absolute; z-index: 4; inset: 0; box-shadow: inset 0 0 0 1px #fff5; pointer-events: none; }
.map-source { position: absolute; z-index: 7; right: 12px; bottom: 8px; padding: 2px 4px; background: #fff9; color: #555; font: 600 9px Arial; }
.map-pins { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.map-origins { position: absolute; z-index: 5; inset: 0; pointer-events: none; }
.origin-pin { --origin: #dc4540; position: absolute; left: var(--x); top: var(--y); display: grid; width: 27px; height: 27px; place-items: center; border: 2px solid #fff; border-radius: 50%; background: var(--origin); color: #fff; box-shadow: 0 2px 6px #172d4266; font-size: 16px; font-style: normal; font-weight: 800; line-height: 1; transform: translate(-50%, -50%); }
.map-origin-legend { position: absolute; z-index: 6; bottom: 12px; left: 50%; display: flex; align-items: center; justify-content: center; gap: 12px; max-width: calc(100% - 96px); padding: 5px 9px; border: 1px solid #fff; background: #fffd; color: var(--ink); font-size: 10px; font-weight: 600; line-height: 1.2; text-align: center; transform: translateX(-50%); white-space: nowrap; }
.map-origin-legend > span { display: inline-flex; align-items: center; gap: 3px; }
.map-origin-legend b { display: inline-grid; width: 15px; height: 15px; flex: 0 0 15px; place-items: center; border-radius: 50%; color: #fff !important; font-size: 9px; font-weight: 800; line-height: 1; }
.map-origin-legend .origin-label { display: block; line-height: 15px; }
.map-origin-legend .origin-label-mobile { display: none; }
.pin { --dx: 0px; --dy: 0px; --angle: 0deg; --pin: var(--ink); position: absolute; left: var(--x); top: var(--y); display: grid; width: 30px; height: 30px; place-items: center; color: #fff; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))); }
.pin::before { content: ""; position: absolute; z-index: -1; inset: 0; border: 2px solid #fff; border-radius: 50% 50% 50% 7px; background: var(--pin); box-shadow: 0 2px 6px #172d4266; transform: rotate(calc(var(--angle) + 45deg)); }
.pin.is-highlighted { --pin: #fff !important; z-index: 6; color: #dc4540; }
.pin.is-highlighted::before { border-color: #dc4540; animation: pin-highlight-breathe 2.2s ease-in-out infinite; }
@keyframes pin-highlight-breathe {
  0%, 100% { background-color: #fffdf8; }
  50% { background-color: #fff1e7; }
}
@media (prefers-reduced-motion: reduce) {
  .pin.is-highlighted::before { animation: none; }
}
.pin span { position: relative; z-index: 1; font-size: 11px; font-style: normal; font-weight: 800; line-height: 1; }
.pin.wide { width: 34px; height: 34px; }
.pin.wide span { font-size: 10px; }

.directory { position: relative; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.directory-scroll-area { min-height: 0; height: 100%; padding-right: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #c7c0b5 transparent; }
.directory-scroll-area::-webkit-scrollbar { width: 8px; }
.directory-scroll-area::-webkit-scrollbar-thumb { border: 2px solid var(--paper); border-radius: 8px; background: #c7c0b5; }
.directory-scroll-hint { position: absolute; z-index: 2; right: 0; bottom: 0; left: 0; display: flex; height: 54px; align-items: flex-end; justify-content: center; gap: 5px; padding: 0 0 9px; background: linear-gradient(to top, #ffffff 0%, rgba(255,255,255,.82) 48%, transparent 100%); color: var(--muted); font-size: 10px; line-height: 1; letter-spacing: .1px; pointer-events: none; }
.directory-scroll-hint i { display: inline-block; color: var(--accent); font-size: 14px; font-style: normal; line-height: .8; animation: scroll-hint 1.2s ease-in-out infinite; }
.directory-scroll-hint[hidden] { display: none; }
@keyframes scroll-hint { 50% { transform: translateY(2px); } }
.column { --accent: var(--ink); min-width: 0; }
.column-title { display: grid; grid-template-columns: minmax(0, 1fr); align-items: baseline; padding: 0 0 11px; border-bottom: 2px solid var(--accent); color: var(--accent); }
.column-title span { display: none; }
.column-title h2 { margin: 0; font-size: 27px; font-weight: 700; line-height: 1.1; }
ol { list-style: none; counter-reset: item; margin: 0; padding: 0; }
li { position: relative; min-width: 0; min-height: 0; margin: 0; padding: 11px 0 14px 38px; border-bottom: 1px solid #e2ddd2; counter-increment: item; }
li:last-child { border-bottom: 0; }
li::before { content: counter(item, decimal-leading-zero); position: absolute; top: 13px; left: 0; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .3px; }
li b { display: block; margin: 0; color: var(--ink); font-size: 16px; font-weight: 700; line-height: 1.28; letter-spacing: -.15px; }
li b a { color: inherit; text-decoration: none; text-underline-offset: 3px; }
li b a:hover { text-decoration: underline; }
li b small { display: inline; margin-left: 5px; color: var(--accent); font-size: 14px; font-weight: 400; letter-spacing: 0; white-space: nowrap; }
li p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: justify; }

footer { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--ink); color: var(--muted); font-size: 12px; text-align: center; letter-spacing: .15px; }

@media (min-width: 761px) {
  .column-title { display: none; }
}

@media (max-width: 1080px) {
  .sheet { max-width: 1180px; padding: 38px 40px 28px; }
  .guide-content { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 32px; }
  .guide-tab { font-size: 15px; }
  .column-title h2 { font-size: 24px; }
  li b { font-size: 16px; }
}

@media (max-width: 760px) {
  body { padding: 0; }
  .sheet { min-height: 100vh; padding: 30px 22px 24px; overflow: visible; box-shadow: none; }
  .masthead { align-items: flex-start; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 22px; }
  .masthead > div:first-child { width: 100%; }
  .masthead h1 { font-size: clamp(27px, 8vw, 34px); line-height: 1.18; letter-spacing: 0; }
  .subtitle { margin-top: 12px; font-size: 23px; }
  .language-switch { margin: 0 0 0 auto; }
  .language-button { min-width: 39px; height: 30px; padding: 0 9px; }
  .guide-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; margin-bottom: 18px; overflow: visible; }
  .guide-tab { min-width: 0; height: 48px; gap: 2px; padding: 0 3px; font-size: 13px; white-space: nowrap; }
  .guide-tab[data-view="cafeBites"] { gap: 3px; font-size: 12px; letter-spacing: -.4px; }
  .guide-tab svg { width: 14px; height: 14px; }
  .guide-content { display: block; height: auto; }
  .map-wrap { position: relative; order: initial; height: auto; aspect-ratio: 4 / 3; }
  .map-origin-legend { bottom: 10px; flex-direction: row; gap: 8px; max-width: calc(100% - 24px); padding: 5px 8px; white-space: nowrap; }
  .map-origin-legend .origin-label-desktop { display: none; }
  .map-origin-legend .origin-label-mobile { display: block; }
  .pin { width: 28px; height: 28px; }
  .pin span { font-size: 10px; }
  .pin.wide { width: 31px; height: 31px; }
  .pin.wide span { font-size: 9px; }
  .directory { order: initial; height: auto; margin-top: 24px; overflow: visible; }
  .directory-scroll-area { min-height: auto; height: auto; padding-right: 0; overflow: visible; }
  .directory-scroll-hint { display: none !important; }
  .column-title { grid-template-columns: minmax(0, 1fr); padding-bottom: 10px; }
  .column-title h2 { font-size: 25px; }
  ol { margin-top: 9px; }
  li { padding: 13px 0 15px 38px; }
  li:last-child { border-bottom: 0; }
  li::before { top: 15px; }
  li b { font-size: 18px; }
  li p { font-size: 13px; line-height: 1.55; }
  footer { margin-top: 20px; padding-top: 16px; }
}

@media (max-width: 380px) {
  .sheet { padding-right: 18px; padding-left: 18px; }
  .masthead h1 { font-size: 26px; }
  .guide-tab { font-size: 12px; }
}

/* AITEGA typography and colour integration */
:root { --ink: #151a22; --paper: #fff; --muted: #667085; --line: #e6e8ef; }
html, body { background: #fff; }
body { color: var(--ink); font-family: -apple-system, "PingFang TC", "PingFang SC", "Microsoft JhengHei", "Noto Sans CJK TC", sans-serif; }
.sheet { background: #fff; }
.guide-tabs { border-color: var(--line); background: #f3f4f8; }
.guide-tab { border-color: var(--line); color: var(--muted); }
.guide-tab.active { background: #fff; }
.map-wrap { border-color: var(--line); }
li { border-color: #f0f2f7; }
li { transition: background-color .2s; }
li:hover, li:focus-within, li.is-selected { background-color: rgba(43, 69, 232, .2); }
li b { color: var(--ink); }
li p, footer { color: var(--muted); }
footer { border-color: var(--line); }
.load-error { padding: 20px; color: #b42318; font-size: 13px; }

@media (min-width: 761px) {
  body { padding: 0; }
  .sheet { max-width: none; min-height: 0; padding: 0 0 20px; box-shadow: none; }
  .guide-tabs { margin-top: 0; }
  .directory { padding-left: 32px; }
  .guide-content { grid-template-columns: minmax(0, 40fr) minmax(0, 60fr); gap: clamp(16px, 2vw, 31px); }
}

@media (max-width: 760px) {
  html, body { height: 100%; overflow: hidden; }
  .sheet {
    display: flex; width: 100%; height: 100%; min-height: 0; flex-direction: column;
    padding: 0 14px 12px; overflow: hidden;
  }
  .guide-tabs { flex: 0 0 auto; margin: 0 0 12px; border-top: 0; }
  .guide-content { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; overflow: hidden; }
  .map-wrap { flex: 0 0 auto; width: 100%; height: auto; aspect-ratio: 4 / 3; }
  .directory { min-height: 0; height: auto; flex: 1 1 auto; margin-top: 16px; overflow: hidden; }
  .directory-scroll-area {
    min-height: 0; height: 100%; padding-right: 4px; overflow-x: hidden; overflow-y: auto;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  }
  footer { flex: 0 0 auto; margin-top: 8px; padding-top: 8px; }
}
