:root {
  --ink: #16383a;
  --muted: #5e7775;
  --teal: #087d82;
  --teal-dark: #075b61;
  --coral: #e96e52;
  --cream: #fffaf0;
  --paper: rgba(255, 252, 242, .94);
  --bamboo-a: #d9a84f;
  --bamboo-b: #8a5925;
  --shadow: 0 18px 45px rgba(13, 54, 57, .18);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; background: #d8eee9; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.background { position: fixed; inset: 0; z-index: -2; background: linear-gradient(rgba(9,61,64,.25), rgba(9,61,64,.32)), url('/sprawozdania/static/travel-bg.png') center/cover no-repeat; }
.background::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(250,246,229,.08), rgba(232,246,240,.55) 65%, #d8eee9 100%); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(18px, 4vw, 58px); backdrop-filter: blur(16px); background: rgba(255,250,240,.82); border-bottom: 1px solid rgba(25,79,78,.12); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: white; font-size: 22px; background: var(--teal); border-radius: 50% 50% 50% 10%; transform: rotate(-8deg); box-shadow: 0 6px 16px rgba(8,125,130,.25); }
.brand-mark + span { display: grid; line-height: 1.05; }
.brand strong { font-family: Georgia, serif; font-size: 22px; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(25,79,78,.18); border-radius: 50%; color: var(--teal-dark); background: rgba(255,255,255,.75); cursor: pointer; transition: .2s ease; }
.icon-button:hover { transform: translateY(-2px); background: white; box-shadow: 0 7px 18px rgba(20,58,60,.13); }
.icon-button svg { width: 21px; fill: currentColor; }
.edit-badge { padding: 8px 12px; color: #fff; background: var(--coral); border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }

main { min-height: calc(100vh - 145px); }
.hero { min-height: 45vh; display: grid; place-items: center; padding: 88px 22px 58px; text-align: center; color: white; text-shadow: 0 3px 20px rgba(0,42,48,.55); }
.hero-inner { max-width: 860px; animation: rise .7s ease both; }
.kicker { display: inline-flex; align-items: center; justify-content: center; gap: 8px; max-width: 100%; padding: 7px 13px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; background: rgba(7,70,74,.25); backdrop-filter: blur(7px); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.hero h1, .trip-hero h1 { margin: 17px 0 10px; overflow-wrap: anywhere; font: 700 clamp(44px, 8vw, 88px)/.94 Georgia, serif; letter-spacing: -.045em; }
.hero p { max-width: 620px; margin: 0 auto; font-size: clamp(16px, 2vw, 21px); line-height: 1.65; }
.scroll-cue { display: inline-flex; align-items: center; gap: 8px; margin-top: 28px; color: #fff; text-decoration: none; font-weight: 750; font-size: 13px; }

.content-panel { width: min(1180px, calc(100% - 28px)); margin: -15px auto 50px; padding: clamp(22px, 4vw, 45px); background: rgba(255,252,243,.91); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.75); border-radius: 34px; box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.section-heading h2 { margin: 4px 0 0; font: 700 clamp(28px, 4vw, 44px)/1 Georgia, serif; }
.eyebrow { color: var(--coral); font-size: 11px; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.count-pill { padding: 9px 13px; border-radius: 999px; background: #e3f2ed; color: var(--teal-dark); font-size: 13px; font-weight: 800; }

.trip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: clamp(20px, 3vw, 32px); }
.bamboo-card { position: relative; min-height: 210px; display: flex; flex-direction: column; justify-content: end; padding: 28px; overflow: hidden; color: white; text-decoration: none; border: 13px solid transparent; border-radius: 20px; background: linear-gradient(155deg, rgba(4,88,92,.52), rgba(8,48,51,.83)), url('/sprawozdania/static/travel-bg.png') center/cover; box-shadow: 0 15px 25px rgba(29,58,54,.16), inset 0 0 0 2px rgba(255,244,194,.55); transition: transform .25s ease, box-shadow .25s ease; }
.bamboo-card::before { content: ""; position: absolute; inset: -11px; z-index: 0; border: 10px ridge var(--bamboo-a); border-radius: 17px; pointer-events: none; }
.bamboo-card::after { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; pointer-events: none; }
.bamboo-card:hover { transform: translateY(-6px) rotate(-.3deg); box-shadow: 0 22px 38px rgba(20,58,56,.24); }
.bamboo-card > * { position: relative; z-index: 1; }
.bamboo-card h3 { margin: 7px 0 5px; font: 700 30px/1.05 Georgia, serif; }
.bamboo-card p { margin: 0; opacity: .85; font-size: 13px; }
.card-tools { position: absolute; z-index: 3; top: 13px; right: 13px; display: flex; gap: 6px; }
.mini-button { width: 34px; height: 34px; display: grid; place-items: center; color: var(--ink); background: rgba(255,255,255,.9); border: 0; border-radius: 50%; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.mini-button.danger { color: #a62a20; }

.empty-state { grid-column: 1 / -1; padding: 65px 25px; text-align: center; border: 1px dashed #9bb7ac; border-radius: 22px; background: rgba(255,255,255,.48); }
.empty-state .empty-icon { font-size: 52px; }
.empty-state h3 { margin: 12px 0 6px; font: 700 28px Georgia, serif; }
.empty-state p { margin: 0; color: var(--muted); }

.trip-hero { min-height: 330px; display: grid; align-content: center; justify-items: center; padding: 70px 22px 95px; color: white; text-align: center; text-shadow: 0 3px 16px rgba(0,40,45,.6); }
.trip-hero h1 { font-size: clamp(40px, 7vw, 76px); }
.back-link { display: inline-flex; gap: 8px; color: white; text-decoration: none; font-weight: 800; }
.trip-content { margin-top: -48px; }
.description-card { padding: clamp(22px, 4vw, 38px); border-radius: var(--radius); background: #fffdf7; box-shadow: 0 12px 30px rgba(27,72,69,.1); }
.description-card p, .cost-card p { margin: 12px 0 0; white-space: pre-wrap; line-height: 1.75; color: #45615f; }
.description-card h2, .cost-card h2 { margin: 5px 0 0; font: 700 30px Georgia, serif; }
.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 28px 0; }
.category-card { min-height: 170px; display: grid; align-content: end; padding: 24px; color: white; text-decoration: none; border: 7px solid #c88d3c; border-radius: 20px; box-shadow: inset 0 0 0 3px #f5cf80, 0 12px 25px rgba(27,71,67,.14); transition: .2s ease; }
.category-card:nth-child(1) { background: linear-gradient(150deg, rgba(4,74,79,.38), rgba(4,59,63,.92)), url('/sprawozdania/static/travel-bg.png') 70% 48%/cover; }
.category-card:nth-child(2) { background: linear-gradient(150deg, rgba(222,101,64,.28), rgba(81,50,28,.9)), url('/sprawozdania/static/travel-bg.png') 15% 55%/cover; }
.category-card:nth-child(3) { background: linear-gradient(150deg, rgba(4,74,79,.38), rgba(4,59,63,.92)), url('/sprawozdania/static/travel-bg.png') 42% 55%/cover; }
.category-card:hover { transform: translateY(-4px); }
.category-icon { font-size: 30px; }
.category-card h3 { margin: 8px 0 3px; font: 700 25px Georgia, serif; }
.category-card span:last-child { font-size: 13px; opacity: .82; }
.cost-card { position: relative; overflow: hidden; padding: clamp(25px, 4vw, 38px); border-radius: var(--radius); background: #dff2ea; border-left: 6px solid var(--teal); }
.cost-card::after { content: "€  $  zł  £"; position: absolute; right: 20px; bottom: -8px; color: rgba(8,125,130,.08); font: 700 48px Georgia, serif; }
.admin-row { display: flex; justify-content: end; gap: 9px; margin-top: 14px; }

.gallery-head { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 28px; }
.gallery-head h2 { margin: 4px 0 0; font: 700 clamp(30px, 5vw, 52px)/1 Georgia, serif; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 24px; }
.media-card { position: relative; overflow: hidden; background: #fff; border: 1px solid rgba(23,74,70,.1); border-radius: 18px; box-shadow: 0 12px 30px rgba(27,72,69,.11); }
.media-preview { position: relative; aspect-ratio: 16/10; display: grid; place-items: center; overflow: hidden; background: #164b4f; cursor: pointer; }
.media-preview img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.video-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: rgba(255,255,255,.72); background: radial-gradient(circle at 50% 30%, #268c8f, #123e42); font-size: 55px; }
.media-card:hover img { transform: scale(1.035); }
.play { position: absolute; width: 58px; height: 58px; display: grid; place-items: center; padding-left: 4px; color: white; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; background: rgba(5,66,70,.72); backdrop-filter: blur(8px); font-size: 22px; box-shadow: 0 7px 22px rgba(0,0,0,.25); }
.media-copy { padding: 18px 20px 20px; }
.media-copy h3 { margin: 0; font: 700 21px Georgia, serif; }
.media-copy p { margin: 5px 0 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.media-delete { position: absolute; z-index: 2; right: 10px; top: 10px; }

.button { min-height: 42px; padding: 10px 17px; border: 0; border-radius: 999px; font-weight: 800; cursor: pointer; transition: .2s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--teal); box-shadow: 0 7px 18px rgba(8,125,130,.22); }
.button-ghost { color: var(--ink); background: #edf3ef; }
.button-danger { color: white; background: #b63d30; }
.full { width: 100%; }

.dialog { width: min(92vw, 500px); max-height: 92vh; padding: 0; overflow: visible; color: var(--ink); border: 0; border-radius: 24px; background: transparent; }
.dialog::backdrop { background: rgba(5,34,37,.68); backdrop-filter: blur(6px); }
.dialog-card { position: relative; display: grid; gap: 15px; max-height: 92vh; padding: clamp(24px, 5vw, 38px); overflow: auto; background: #fffdf7; border-radius: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.dialog-wide { width: min(92vw, 680px); }
#tripDialog, #mediaDialog { width: min(92vw, 680px); }
.dialog.compact { max-width: 420px; }
.dialog-card h2 { margin: -5px 0 0; font: 700 34px Georgia, serif; }
.dialog-card p { margin: -6px 0 3px; color: var(--muted); line-height: 1.55; }
.dialog-close { position: absolute; z-index: 4; top: 13px; right: 14px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #edf3ef; color: var(--ink); font-size: 25px; cursor: pointer; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 800; }
input, textarea, select { width: 100%; padding: 12px 14px; color: var(--ink); background: white; border: 1px solid #bed0c8; border-radius: 11px; outline: 0; transition: .2s; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8,125,130,.12); }
textarea { resize: vertical; }
.form-actions { display: flex; justify-content: end; gap: 10px; margin-top: 3px; }
.form-error { min-height: 18px; color: #ad2e25 !important; font-size: 13px; font-weight: 700; }
.form-hint { color: var(--muted); font-size: 12px; }
.or { display: block; margin: 8px 0 -8px; color: var(--muted); font-size: 12px; text-align: center; text-transform: uppercase; }

.toast { position: fixed; z-index: 99; left: 50%; bottom: 25px; transform: translate(-50%, 30px); max-width: min(90vw, 520px); padding: 12px 18px; color: white; background: #173f40; border-radius: 999px; box-shadow: 0 14px 34px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #a9342a; }

.player-dialog { width: min(96vw, 1100px); max-width: none; }
.player-shell { position: relative; overflow: hidden; background: #071d1f; border-radius: 20px; box-shadow: 0 30px 90px rgba(0,0,0,.5); }
.player-close { color: white; background: rgba(255,255,255,.15); }
#playerStage { position: relative; width: 100%; aspect-ratio: 16/9; display: grid; place-items: center; overflow: hidden; background: #000; }
#playerStage video, #playerStage iframe { width: 100%; height: 100%; border: 0; }
#playerStage img { max-width: 100%; max-height: 78vh; }
.vr360-viewer { position: absolute; inset: 0; overflow: hidden; color: white; background: #000; }
.vr360-viewer:fullscreen { width: 100vw; height: 100vh; }
.vr360-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.vr360-viewer.is-dragging .vr360-canvas { cursor: grabbing; }
.vr360-source { position: absolute; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.vr360-badge { position: absolute; top: 16px; left: 16px; padding: 7px 11px; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; background: rgba(3,24,27,.64); backdrop-filter: blur(8px); font-size: 13px; font-weight: 900; letter-spacing: .08em; }
.vr360-hint { position: absolute; top: 16px; left: 50%; margin: 0; padding: 7px 12px; transform: translateX(-50%); border-radius: 999px; color: white; background: rgba(3,24,27,.64); backdrop-filter: blur(8px); font-size: 12px; pointer-events: none; }
.vr360-status { position: absolute; left: 50%; top: 50%; max-width: min(80%, 520px); padding: 10px 14px; transform: translate(-50%, -50%); border-radius: 10px; color: white; background: rgba(3,24,27,.82); text-align: center; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.vr360-status.visible { opacity: 1; }
.vr360-controls { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 30px 14px 12px; background: linear-gradient(transparent, rgba(0,0,0,.88)); }
.vr360-control { min-width: 39px; min-height: 39px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.28); border-radius: 10px; color: white; background: rgba(10,38,41,.78); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.vr360-control:hover, .vr360-control.active { border-color: #78d7d4; background: rgba(8,125,130,.92); }
.vr360-control:focus-visible { outline: 3px solid #f7cf72; outline-offset: 2px; }
.vr360-control:disabled { color: rgba(255,255,255,.55); cursor: not-allowed; background: rgba(25,35,37,.7); }
.vr360-play, .vr360-mute, .vr360-fullscreen { font-size: 16px; }
.vr360-time { flex: 0 0 auto; min-width: 88px; font-size: 11px; font-variant-numeric: tabular-nums; }
.vr360-seek { flex: 1 1 170px; width: auto; min-width: 80px; padding: 0; accent-color: #37b9b8; cursor: pointer; }
.vr360-fallback { display: grid; place-items: center; }
.vr360-fallback video { position: static; width: 100% !important; height: 100% !important; opacity: 1; pointer-events: auto; }
.youtube360-player { width: 100%; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: #000; }
.youtube360-player > iframe, .youtube360-player > #youtubePlayer { width: 100%; height: 100%; }
.youtube360-note { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 9px 15px; color: #d7ebe8; background: #0b292c; font-size: 12px; }
.youtube360-note a { flex: 0 0 auto; padding: 7px 11px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: white; text-decoration: none; font-weight: 800; }
.youtube360-note a:hover { background: var(--teal); }
.player-meta { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 25px 22px; color: white; }
.player-copy { flex: 1; min-width: 0; }
.player-meta h2 { margin: 5px 0 0; font: 700 24px Georgia, serif; }
.player-back { flex: 0 0 auto; min-height: 42px; padding: 10px 16px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; color: white; background: rgba(255,255,255,.12); font: inherit; font-size: 14px; font-weight: 700; line-height: 1.2; cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .2s ease; }
.player-back:hover { border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.2); transform: translateX(-2px); }
.player-back:focus-visible { outline: 3px solid #f7cf72; outline-offset: 3px; }
#playerCounter { color: #9fc1bc; font-size: 13px; }

footer { display: flex; justify-content: space-between; gap: 15px; padding: 23px clamp(22px, 5vw, 64px); color: #54716e; font-size: 12px; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@media (max-width: 740px) {
  .brand small, .edit-badge { display: none; }
  .topbar { padding: 11px 14px; }
  .button { padding-inline: 13px; }
  #addTripBtn { font-size: 0; width: 44px; padding: 0; }
  #addTripBtn::first-letter { font-size: 22px; }
  .hero { min-height: 42vh; padding-top: 70px; }
  .player-meta { flex-wrap: wrap; gap: 12px; padding: 14px 16px 18px; }
  .player-back { order: 1; }
  .player-copy { order: 3; flex-basis: 100%; }
  #playerCounter { order: 2; margin-left: auto; }
  #playerStage.is-360 { min-height: 58vh; aspect-ratio: auto; }
  .vr360-controls { flex-wrap: wrap; padding: 25px 9px 9px; gap: 6px; }
  .vr360-time { min-width: 76px; }
  .vr360-seek { order: -1; flex-basis: 100%; }
  .vr360-control { min-height: 36px; padding: 7px 9px; }
  .vr360-hint { top: 55px; max-width: 72%; text-align: center; }
  .youtube360-note { align-items: stretch; flex-direction: column; gap: 7px; }
  .youtube360-note a { text-align: center; }
  .content-panel { width: calc(100% - 16px); border-radius: 24px; }
  .category-grid { grid-template-columns: 1fr; }
  .category-card { min-height: 135px; }
  .gallery-head { align-items: start; flex-direction: column; }
  footer { flex-direction: column; text-align: center; }
}

@media (max-width: 420px) {
  .hero { padding-inline: 16px; }
  .hero h1 { font-size: clamp(34px, 12vw, 44px); }
  .kicker { font-size: 10px; letter-spacing: .1em; }
  .content-panel { padding-inline: 18px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
