:root {
  --ink: #10233f;
  --blue: #1769ff;
  --paper: #f5f7fb;
  --line: #dfe6ef;
  --muted: #708097;
  --wine: #7b1023;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, sans-serif; }
[hidden] { display: none !important; }
.diary-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.diary-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); }
.side-brand { padding: 28px 25px; color: var(--ink); font: 800 24px Manrope; text-decoration: none; }
.diary-sidebar nav { display: grid; margin-top: 18px; }
.diary-sidebar nav a { display: flex; align-items: center; gap: 14px; padding: 18px 25px; color: #52657e; font-size: 13px; font-weight: 650; text-decoration: none; }
.diary-sidebar nav a span { width: 25px; color: #37699f; font-size: 23px; text-align: center; }
.diary-sidebar nav a.active { color: #0d467d; background: #edf5ff; border-right: 3px solid #1769ff; }
.side-ferdinando { position: relative; margin-top: auto; padding-top: 170px; }
.side-ferdinando img { position: absolute; right: 18px; bottom: 118px; width: 195px; height: 210px; object-fit: cover; object-position: 50% 24%; border-radius: 90px 90px 10px 10px; }
.side-ferdinando p { position: relative; margin: 0 15px 17px; padding: 21px; color: #6e7e92; font-size: 12px; line-height: 1.65; background: #fff; border: 1px solid #d7e0ec; border-radius: 13px; box-shadow: 0 10px 25px rgba(15,40,75,.08); }

.diary-main { min-width: 0; padding: 30px clamp(25px,4vw,62px) 60px; }
.diary-title { display: flex; align-items: center; gap: 18px; }
.anchor-button { display: grid; width: 54px; height: 54px; place-items: center; color: #0e477e; font-size: 35px; text-decoration: none; background: #edf5ff; border: 1px solid #c9dcf3; border-radius: 15px; }
.diary-title h1 { margin: 0; font: 700 clamp(38px,4vw,58px) Libre Baskerville,serif; letter-spacing: -.035em; }
.diary-title p { margin: 7px 0 0; color: #7b899b; font-size: 14px; }
.diary-tabs { display: flex; gap: 36px; margin-top: 30px; border-bottom: 1px solid var(--line); }
.diary-tabs button { padding: 14px 22px; color: #6d7c90; font: 700 13px Inter; cursor: pointer; background: none; border: 0; border-bottom: 3px solid transparent; }
.diary-tabs button.active { color: #0d477f; border-color: #0d477f; }
.diary-tabs button span { margin-right: 8px; }

.map-view { display: grid; grid-template-columns: 380px minmax(0,1fr); gap: 24px; margin-top: 24px; align-items: start; }
.route-summary { display: flex; min-width: 0; flex-direction: column; gap: 12px; }
.total-card { display: flex; align-items: center; justify-content: space-between; min-height: 110px; padding: 20px 24px; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 24px rgba(16,35,63,.06); }
.total-card span, .total-card strong { display: block; }
.total-card span { color: #53657c; font-size: 11px; font-weight: 700; }
.total-card strong { margin-top: 6px; font: 800 35px Manrope; }
.total-card i { display: grid; width: 55px; height: 55px; place-items: center; color: #4b7bac; font-size: 34px; font-style: normal; background: #f1f6fc; border: 1px solid #d0ddec; border-radius: 50%; }
.stage-list { display: grid; gap: 10px; max-height: 650px; overflow: auto; }
.stage-item { display: grid; grid-template-columns: 42px minmax(0,1fr) 30px; gap: 13px; align-items: center; padding: 15px; background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 7px 20px rgba(16,35,63,.05); }
.stage-item > b { display: grid; width: 38px; height: 38px; place-items: center; color: #fff; font: 800 16px Manrope; border-radius: 50%; }
.stage-course-link { display: grid; min-width: 0; gap: 4px; color: inherit; text-decoration: none; }
.stage-course-link:hover strong { color: var(--blue); text-decoration: underline; }
.stage-item span { overflow: hidden; color: #75859a; font-size: 8px; font-weight: 800; letter-spacing: .1em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.stage-item strong { overflow: hidden; font: 700 12px Manrope; text-overflow: ellipsis; white-space: nowrap; }
.stage-item small { overflow: hidden; color: #8996a8; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.stage-item button { color: #0b5da8; font-size: 18px; cursor: pointer; background: none; border: 0; }

.route-map { position: relative; width: 100%; aspect-ratio: 3/2; overflow: hidden; background: #d8bd86 url('images/diario-map-bg.png') center/cover no-repeat; border: 1px solid #c6a877; border-radius: 18px; box-shadow: 0 15px 35px rgba(84,61,27,.17); }
.route-line { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.route-line path { fill: none; stroke: #0a3a68; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 8 12; vector-effect: non-scaling-stroke; filter: drop-shadow(0 1px 0 rgba(255,244,205,.8)); }
.route-marker { position: absolute; z-index: 5; display: grid; width: clamp(34px,3.2vw,48px); height: clamp(34px,3.2vw,48px); place-items: center; color: #fff; font: 800 clamp(14px,1.3vw,19px) Manrope; text-decoration: none; border: 4px solid #fff; border-radius: 50%; box-shadow: 0 6px 16px rgba(21,45,75,.32); transform: translate(-50%,-50%); transition: transform .15s, box-shadow .15s; }
.route-marker:hover, .route-marker:focus-visible { z-index: 6; transform: translate(-50%,-50%) scale(1.14); box-shadow: 0 8px 22px rgba(21,45,75,.5); outline: 3px solid rgba(23,105,255,.35); outline-offset: 3px; }

.list-view, .recommended-view { margin-top: 24px; }
.diary-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.diary-head span { font: 700 18px Manrope; }
.diary-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.diary-head button { padding: 9px 12px; color: var(--wine); font: 700 10px Inter; cursor: pointer; background: #fff; border: 1px solid #dec3c8; border-radius: 9px; }
.diary-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.diary-card { position: relative; display: flex; min-width: 0; overflow: hidden; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.diary-image { height: 155px; overflow: hidden; background: #e7eef7; }
.diary-image img { width: 100%; height: 100%; object-fit: cover; }
.remove-bookmark, .save-recommendation { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; color: #0759a7; font-size: 23px; cursor: pointer; background: #edf6ff; border: 1px solid #72a9df; border-radius: 50%; }
.save-recommendation { color: #7c8da2; background: rgba(255,255,255,.94); border-color: #c6d1df; }
.save-recommendation:hover { color: #0759a7; background: #edf6ff; border-color: #72a9df; }
.diary-card-body { flex: 1; padding: 19px; }
.diary-card .target { margin: 0; color: var(--blue); font-size: 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.diary-card h3 { margin: 8px 0 10px; font: 700 19px/1.2 Manrope; }
.diary-title-link { color: inherit; text-decoration: none; }
.diary-title-link:hover { color: var(--blue); text-decoration: underline; }
.description { display: -webkit-box; overflow: hidden; color: #607086; font-size: 11px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.meta { margin: 13px 0; color: #66788e; font-size: 10px; }
.reason { padding: 9px 11px; color: #38506c; font-size: 10px; line-height: 1.4; background: #f1f6fd; border-left: 3px solid var(--blue); }
.official-link { display: flex; justify-content: space-between; padding: 14px 18px; color: var(--ink); font-size: 11px; font-weight: 750; text-decoration: none; border-top: 1px solid var(--line); }
.official-link:hover { color: var(--blue); }
.official-link span { color: var(--blue); }

.recommended-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 22px; padding: 24px 27px; background: linear-gradient(120deg,#fff 15%,#edf5ff); border: 1px solid #d8e4f1; border-radius: 16px; }
.recommended-head span { color: var(--blue); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.recommended-head h2 { margin: 7px 0; font: 800 30px Manrope; }
.recommended-head p { max-width: 760px; margin: 0; color: #63758d; font-size: 12px; line-height: 1.55; }
.recommended-head > a, .recommended-empty a { flex: none; padding: 10px 14px; color: #fff; font-size: 11px; font-weight: 700; text-decoration: none; background: var(--blue); border-radius: 9px; }
.recommended-empty, .diary-empty { min-height: 360px; display: grid; place-items: center; align-content: center; text-align: center; background: #fff; border: 1px dashed #c7d3e1; border-radius: 18px; }
.diary-empty { margin-top: 24px; }
.recommended-empty div, .diary-empty div { color: #4076ac; font-size: 60px; }
.recommended-empty h3, .diary-empty h3 { margin: 8px 0; font: 700 24px Manrope; }
.recommended-empty p, .diary-empty p { max-width: 520px; margin: 0 0 18px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.diary-empty a { padding: 10px 15px; color: #fff; font-size: 11px; font-weight: 700; text-decoration: none; background: var(--blue); border-radius: 9px; }

@media (max-width:1200px) {
  .diary-shell { grid-template-columns: 210px 1fr; }
  .map-view { grid-template-columns: 320px 1fr; }
  .side-ferdinando img { width: 170px; }
}

@media (max-width:900px) {
  .diary-shell { display: block; }
  .diary-sidebar { position: relative; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 0 18px; }
  .side-brand { padding: 18px 0; }
  .diary-sidebar nav { display: flex; margin: 0 0 0 auto; }
  .diary-sidebar nav a { padding: 18px 12px; font-size: 0; }
  .diary-sidebar nav a span { font-size: 23px; }
  .side-ferdinando { display: none; }
  .diary-main { padding: 26px 18px 50px; }
  .map-view { grid-template-columns: 1fr; }
  .route-summary { display: grid; grid-template-columns: 200px 1fr; }
  .stage-list { display: flex; overflow: auto; }
  .stage-item { min-width: 270px; }
  .diary-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width:580px) {
  .diary-title h1 { font-size: 34px; }
  .diary-title p { font-size: 11px; }
  .anchor-button { width: 46px; height: 46px; font-size: 28px; }
  .diary-tabs { gap: 5px; }
  .diary-tabs button { padding: 13px 10px; font-size: 11px; }
  .route-summary { display: block; }
  .stage-list { margin-top: 10px; }
  .route-map { border-radius: 11px; }
  .route-line path { stroke-width: 3; stroke-dasharray: 5 8; }
  .route-marker { border-width: 3px; }
  .diary-grid { grid-template-columns: 1fr; }
  .recommended-head { align-items: start; flex-direction: column; }
}
