/* Town photo gallery (v1.7) */
.tp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tp-head h2 { margin: 0 !important; }
.tp-add { white-space: nowrap; }
.tp-actions { margin: 10px 0 4px; }
.tp-grid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
@media (max-width: 520px) { .tp-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }
.tp-item { margin: 0; min-width: 0; }
.tp-frame { display: block; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--soft, #eef1f6); }
.tp-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tp-cap { font-size: 13px; color: var(--ink, #1b2433); margin: 6px 0 0; line-height: 1.35; overflow-wrap: anywhere; }
.tp-cap:empty { display: none; }
.tp-townlink { font-weight: 700; color: var(--navy, #0f2340); }
.tp-credit { font-size: 11.5px; color: var(--muted, #51607a); margin: 3px 0 0; line-height: 1.35; }
.tp-credit a, .tp-license-note a { color: var(--navy, #0f2340); font-weight: 600; }
.tp-more { font-size: 14px; margin-top: 10px; }
.tp-more a { color: var(--navy, #0f2340); font-weight: 600; }
.tp-empty { font-size: 14px; color: var(--muted, #51607a); background: var(--soft, #eef1f6); border-radius: 10px; padding: 12px 14px; margin: 6px 0; }
.tp-license-note { font-size: 12px; color: var(--muted, #51607a); margin-top: 10px; line-height: 1.45; }
.tp-towns { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tp-towns a { display: flex; flex-direction: column; text-decoration: none; color: var(--navy, #0f2340); }
.tp-towns img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--soft, #eef1f6); }
.tp-towns span { font-weight: 700; font-size: 14px; margin-top: 4px; }
.tp-towns small { font-size: 12px; color: var(--muted, #51607a); }

/* upload form */
.tp-modal { position: fixed; inset: 0; z-index: 4100; background: rgba(15, 35, 64, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.tp-modal[hidden] { display: none; }
@media (min-width: 761px) { .tp-modal { align-items: center; } }
.tp-form { position: relative; background: #fff; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.25); box-sizing: border-box; color: #1b2433; }
@media (min-width: 761px) { .tp-form { border-radius: 16px; padding: 24px; } }
.tp-form h2 { margin: 0 44px 4px 0; font-size: 20px; color: #0f2340; }
.tp-sub { margin: 0 0 12px; color: #51607a; font-size: 14px; }
.tp-x { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #eef1f6; color: #0f2340; font-size: 26px; line-height: 40px; cursor: pointer; }
.tp-step { margin: 0 0 12px; }
.tp-label { display: block; font-weight: 700; font-size: 14px; margin: 0 0 6px; color: #0f2340; }
.tp-muted { font-weight: 400; color: #6b7891; }
.tp-hint { display: block; font-size: 12.5px; color: #51607a; margin-top: 4px; line-height: 1.4; }
.tp-pick { display: flex; width: 100%; justify-content: center; cursor: pointer; box-sizing: border-box; }
.tp-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tp-previews:empty { display: none; }
.tp-prev { position: relative; width: 72px; height: 72px; }
.tp-prev img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
.tp-prev button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: #0f2340; color: #fff; font-size: 16px; line-height: 24px; cursor: pointer; }
.tp-town { font-size: 15px; }
.tp-town .linkbtn, .tp-gps .linkbtn { background: none; border: 0; padding: 0 0 0 6px; color: #0f2340; text-decoration: underline; font: inherit; font-size: 14px; cursor: pointer; }
.tp-gps { font-size: 13px; color: #1d5b2a; margin: 4px 0 0; }
.tp-gps:empty { display: none; }
.tp-find { display: grid; gap: 8px; margin-top: 8px; }
.tp-find[hidden] { display: none; }
.tp-or { font-size: 13px; color: #51607a; display: grid; gap: 4px; }
.tp-form input[type=text] { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 9px 10px; border: 1px solid #c9d1de; border-radius: 8px; color: #1b2433; }
.tp-agree { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; background: #f4f6fa; border-radius: 10px; padding: 10px 12px; margin: 4px 0 10px; cursor: pointer; }
.tp-agree input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.tp-agree a { color: #0f2340; font-weight: 600; white-space: nowrap; }
.tp-msg { font-size: 14px; margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #eef6ee; color: #1d5b2a; }
.tp-msg:empty { display: none; }
.tp-msg.err { background: #fdeeee; color: #8a1c1c; }
.tp-send { width: 100%; }
.tp-send:disabled { opacity: .55; cursor: not-allowed; }
.tp-fine { font-size: 12px; color: #6b7891; margin: 10px 0 0; line-height: 1.4; }
body.tp-open { overflow: hidden; }

/* viewer */
.tp-viewer { position: fixed; inset: 0; z-index: 4200; background: rgba(8, 14, 26, .92); display: flex; align-items: center; justify-content: center; padding: 16px; }
.tp-viewer[hidden] { display: none; }
.tp-viewer figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; }
.tp-viewer img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 8px; }
.tp-viewer figcaption { color: #fff; font-size: 14px; text-align: center; margin-top: 10px; line-height: 1.45; }
.tp-viewer figcaption span { font-size: 12.5px; opacity: .85; }
.tp-viewer figcaption a { color: #fff; }
.tp-viewer .tp-x { background: rgba(255,255,255,.18); color: #fff; }

/* map/spot-photo entry */
.spot-photo-townlink { font-size: 13px; color: #51607a; margin: 8px 0 0; }
.spot-photo-townlink button { background: none; border: 0; padding: 0; font: inherit; color: #0f2340; font-weight: 600; text-decoration: underline; cursor: pointer; }
.spot-photo-townlink[hidden] { display: none; }
.tp-mem-link { font-size: 14px; margin: 10px 0; color: #51607a; }
.tp-mem-link a, .tp-linkbtn { color: #0f2340; font-weight: 600; }
.tp-linkbtn { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
