.service-rail {
  --service-border: #d4e1d5;
  --service-green: #21664f;
  --service-ink: #112b24;
  --service-mist: #edf5e9;
  --service-shadow: 0 12px 36px #152f2526;
  color: var(--service-ink);
}

.service-rail [hidden] { display: none !important; }

.service-rail:not([data-service-ready]) {
  width: min(1180px, 100% - 28px);
  margin: 18px auto;
}

.service-rail:not([data-service-ready]) .service-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr));
  gap: 10px;
}

.service-card {
  width: 100%;
  border: 1px solid var(--service-border);
  border-radius: 15px;
  padding: 12px 14px 14px;
  background: #fffef9;
  outline-offset: 3px;
}

.service-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.service-card h2 { color: var(--service-ink); font-size: 17px; }
.service-card p { color: #4d6258; margin: 3px 0 10px; font-size: 13px; line-height: 1.5; }
.service-card:focus-visible { outline: 2px solid #597f67; }

.service-card figure {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 8px;
  border: 1px solid #e0e8de;
  border-radius: 10px;
  background: white;
}

.service-card img {
  display: block;
  width: min(168px, 100%);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.service-card-actions { display: flex; gap: 4px 12px; flex-wrap: wrap; margin-top: 6px; }
.service-card-actions a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  font-size: 13px;
  font-weight: 720;
  text-underline-offset: 3px;
}

.service-close {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  margin: -4px -7px -3px 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #49675b;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.service-close:hover { background: var(--service-mist); }

.service-rail[data-service-ready] { position: fixed; z-index: 24; }
body:has([data-guide-widget][data-guide-open]) .service-rail[data-service-ready] { visibility: hidden; }
.service-rail[data-service-ready] .service-card {
  width: min(240px, 100vw - 24px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-shadow: var(--service-shadow);
  animation: service-card-enter .2s ease-out both;
}

.service-option, .service-launch {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--service-border);
  border-radius: 12px;
  background: #fffef9;
  color: var(--service-green);
  cursor: pointer;
  transition: background-color .17s, border-color .17s, color .17s;
  -webkit-tap-highlight-color: #70a38831;
}

.service-option:hover, .service-option[aria-expanded=true] {
  background: var(--service-mist);
  border-color: #9dbca8;
}

.service-launch { width: 46px; height: 46px; border-radius: 50%; color: #fffef5; background: #21664f; border-color: #21664f; box-shadow: 0 6px 18px #143d2d33; }
.service-launch:hover, .service-launch[aria-expanded=true] { background: #144c38; }

.service-icon { display: block; position: relative; width: 23px; height: 23px; flex: 0 0 23px; }
.service-icon::before, .service-icon::after { display: block; position: absolute; }
.service-icon--headset::before {
  content: "";
  inset: 2px 2px 6px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}
.service-icon--headset::after {
  content: "";
  left: 2px;
  bottom: 4px;
  width: 5px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 14px 0 currentColor;
}
.service-icon--support::before {
  content: "";
  left: 1px;
  top: 4px;
  width: 12px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 7px 7px 7px 2px;
}
.service-icon--support::after {
  content: "";
  right: 0;
  bottom: 2px;
  width: 14px;
  height: 11px;
  border: 1px solid #fffef9;
  border-radius: 7px 7px 2px 7px;
  background: radial-gradient(circle at 35% 44%, #fffef9 1px, transparent 1.25px),
    radial-gradient(circle at 65% 44%, #fffef9 1px, transparent 1.25px), currentColor;
}
.service-icon--official::before {
  content: "";
  inset: 2px 4px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}
.service-icon--official::after {
  content: "";
  top: 7px;
  left: 8px;
  width: 7px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 4px currentColor, 0 8px currentColor;
}
@keyframes service-card-enter {
  from { opacity: .55; translate: 0 4px; }
  to { opacity: 1; translate: 0 0; }
}

@media (min-width: 1304px) {
  .service-rail[data-service-ready] {
    inset: 52% clamp(12px, calc((100vw - 1304px)/2 + 12px), 26px) auto auto;
    transform: translateY(-50%);
  }
  .service-rail[data-service-ready] .service-options {
    position: relative;
    display: grid;
    gap: 7px;
  }
  .service-option { box-shadow: 0 3px 12px #15392a17; }
  .service-option-label {
    position: absolute;
    z-index: 1;
    right: calc(100% + 8px);
    padding: 4px 7px;
    border-radius: 5px;
    background: #193c30;
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
  }
  .service-item:not([data-service-active]) .service-option:is(:hover, :focus-visible) .service-option-label { opacity: 1; }
  .service-rail[data-service-ready] .service-card {
    position: absolute;
    top: 50%;
    right: calc(100% + 12px);
    transform: translateY(-50%);
  }
}

@media (max-width: 1303px) {
  body:has(.service-rail[data-service-ready]) .site-footer { padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px)); }
  body:has([data-guide-widget][data-guide-ready]) .site-footer { padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px)); }
  .service-rail[data-service-ready] {
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  body:has([data-guide-widget][data-guide-ready]) .service-rail[data-service-ready] {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .service-rail[data-service-ready] .service-options {
    position: absolute;
    inset: auto 0 calc(100% + 8px) auto;
    display: grid;
    width: 160px;
    gap: 3px;
    padding: 6px;
    border: 1px solid var(--service-border);
    border-radius: 12px;
    background: #fffef9;
    box-shadow: var(--service-shadow);
  }
  .service-option {
    width: 100%;
    grid-template-columns: 23px auto;
    justify-content: start;
    gap: 7px;
    padding: 0 8px;
    border-color: transparent;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 720;
    white-space: nowrap;
  }
  html[lang=en] .service-rail[data-service-ready]:not([data-service-card-open]) .service-options {
    width: min(220px, 100vw - 24px);
  }
  html[lang=en] .service-option { white-space: normal; line-height: 1.2; text-align: left; }
  .service-rail[data-service-card-open] .service-options { display: block; width: auto; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .service-rail[data-service-card-open] .service-option,
  .service-rail[data-service-card-open] .service-item:not([data-service-active]) { display: none; }
  .service-rail[data-service-ready] .service-card {
    max-height: calc(100vh - 88px);
    max-height: calc(100dvh - 88px - env(safe-area-inset-bottom, 0px));
  }
  body:has([data-guide-widget][data-guide-ready]) .service-rail[data-service-ready] .service-card {
    max-height: calc(100dvh - 134px - env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .service-option, .service-launch { transition: none; }
  .service-rail[data-service-ready] .service-card { animation: none; }
}
