@font-face {
  font-family: 'Retropix';
  src: url('retropix.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

* {
  box-sizing: border-box;
}

body{
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px;
  background-color: #f4f3ec;
  margin: 0;
  padding: 0;
  overflow-x: auto;
}

.content {
  max-width: 640px;
  margin: auto;
}

.header-title {
  background-color: #323232;
  width: 100%;
  margin: 0;
  padding: 80px 140px;
  text-align: center;
  box-sizing: border-box;
}

.header-title-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
  font-size: 28px;
  line-height: 1;
  text-align: center;
  margin-top: -40px;
  gap: 3px;
}

.header-title-text .line-1, .header-title-text .line-4 {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-weight: bold;
  color: #facc76;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
  text-align: center;
  width: 100%;
}

.header-title-text .line-2, .header-title-text .line-3 {
  font-family: 'Retropix', 'VT323', 'Courier New', monospace;
  color: #facc76;
  text-transform: uppercase;
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1;
  text-align: center;
  width: 100%;
}

.header-title-author {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: #ffffff;
  text-align: center;
  margin-top: 60px;
}

.header-title-author strong {
  font-weight: bold;
}

.header-image-container {
  position: relative;
  width: 100%;
  margin: 0 auto;
  margin-bottom: 0;
  /* Aspect ratio ajustado para mostrar mais altura da imagem */
  aspect-ratio: 2.2 / 1;
  overflow: hidden;
  /* Melhora estabilidade de posicionamento */
  contain: layout;
  transform: translateZ(0);
  /* Força renderização precisa mesmo com zoom */
  image-rendering: -webkit-optimize-contrast;
}

.header-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 80%;
  display: block;
}

.face {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  transform: translate(-50%, -50%);
  width: 28%;
  max-width: 530px;
  height: auto;
  z-index: 10;
  cursor: pointer;
  transform-origin: center center;
  pointer-events: auto;
  object-fit: contain;
  /* Garante renderização precisa e estável */
  will-change: transform;
  backface-visibility: hidden;
  /* Força renderização em subpixels para maior precisão */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  /* Aplicar rotação separadamente para não interferir no posicionamento */
  animation: swing 2s infinite ease-in-out;
}

.face-1 {
  width: 32%;
  max-width: 600px;
}

.face-2 {
  width: 30%;
  max-width: 550px;
}

.face-4 {
  width: 20%;
  max-width: 380px;
}

.face-5 {
  width: 35%;
  max-width: 520px;
}

.face-6 {
  width: 33%;
  max-width: 550px;
}

.face-7 {
  width: 20%;
  max-width: 380px;
}

@keyframes swing {
  0%, 100% { 
    transform: translate(-50%, -50%) rotate(-3deg);
  }
  50% { 
    transform: translate(-50%, -50%) rotate(3deg);
  }
}

.header-title-overlay {
  position: absolute;
  top: 200px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.header-title-line {
  font-family: 'Retropix', 'VT323', 'Courier New', monospace;
  font-size: 30px;
  font-weight: normal;
  color: #ffffff;
  background-color: #000000;
  padding: 6px 10px;
  text-transform: uppercase;
  text-align: center;
  display: inline-block;
  letter-spacing: 1px;
  line-height: 0.3;
  vertical-align: middle;
}

.header-title-line:first-child {
  padding-top: 10px;
  padding-bottom: 10px;
}

.header-click-text {
  position: absolute;
  top: 290px;
  left: 85px;
  z-index: 20;
  font-family: 'Retropix', 'VT323', 'Courier New', monospace;
  font-size: 30px;
  font-weight: normal;
  color: #ffffff;
  background-color: #000000;
  padding: 8px 10px;
  text-transform: uppercase;
  text-align: center;
  display: inline-block;
  letter-spacing: 1px;
  line-height: 0.3;
  transform: rotate(-10deg);
}

.header-click-right {
  left: auto;
  right: 320px;
  top: 380px;
  transform: rotate(3deg);
  size: 30px;
}

.header-click-center {
  left: 42%;
  top: 450px;
  transform: translateX(-50%) rotate(-2deg);
}

.scrolly-container {
  position: relative;
  margin-bottom: 0px;
  margin-top: -50px;
}

.sticky-thing {
  position: sticky;
  top: 0;
  transform: translate(0px, 0px);
  z-index: 0;
  min-height: 400px;
  height: auto;
  width: 100vw;
  margin: 0;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f4f3ec;
  transition: background 0.8s ease;
}

.background-text {
  position: absolute;
  width: 100%;
  max-width: 690px;
  padding: 0;
  color: white;
  text-align: center;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.background-text.active {
  opacity: 1;
}

.background-text h2 {
  font-family: 'Lora', Georgia, serif;
  font-size: 80px;
  margin: 0 0 6px 0;
  font-weight: bold;
  line-height: 1;
}

.background-text .big-number {
  font-size: 160px;
  font-weight: bold;
  margin: 4px 0;
  line-height: 1;
}

.background-text p {
  font-size: 30px;
  line-height: 1.4;
  max-width: 800px;
  margin: 0 auto;
}

#bg-text-1 {
  font-family: 'Noto Serif', serif;
  color: #545454;
  top: 35px;
  position: relative;
  z-index: 1;
}

#bg-text-1 p {
  font-family: 'Noto Serif', serif;
  color: #545454;
  font-size: 20px;
  text-align: justify;
  max-width: 650px;
  margin: 0 auto 20px auto;
  padding: 0 20px;
  box-sizing: border-box;
}

#bg-text-1 p:last-child {
  margin-bottom: 0;
}

#bg-text-2 {
  font-family: 'Noto Serif', serif;
  color: #545454;
  z-index: 1;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

#bg-text-2 p {
  font-family: 'Noto Serif', serif;
  color: #545454;
  font-size: 24px;
  margin: 0;
}

.steps-container {
  transform: translate3d(0, 0, 0);
  position: relative;
  padding: 0;
  z-index: 10;
  max-width: 100%;
  margin: 0;
  padding-bottom: 80px;
}

.step {
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 70vh;
  transform: translate(0px, 0px);
}

.step p {
  text-align: left;
  margin-bottom: 6px;
  padding-bottom: 0;
  font-size: 12px;
}

.step p:last-child {
  padding: 0;
}

.step p strong {
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  font-weight: bold;
  font-size: 20px;
}

.step>* {
  margin-left: auto !important;
  width: 370px;
  text-align: center;
  padding: 24px !important;
  background-color: #ffffff;
  border: 1px solid #000000;
  border-radius: 8px;
  box-shadow: none;
  font-family: 'Noto Serif', serif;
  color: #545454;
  font-size: 20px;
}

#step1 {
  justify-content: flex-end;
  width: 100%;
}

#step1>* {
  margin-right: 220px !important;
  margin-left: auto !important;
  width: 370px;
  background-color: #ffffff;
  border: 1px solid #000000;
  border-radius: 8px;
  padding: 24px !important;
  box-shadow: none;
  font-family: 'Noto Serif', serif;
  color: #545454;
  font-size: 20px;
}

#step1>* p {
  font-family: 'Noto Serif', serif;
  color: #545454;
  font-size: 17px;
}

#step1>* p:nth-child(2) {
  font-size: 15px;
}

#step2 {
  justify-content: flex-start;
}

#step2>* {
  margin-left: 220px !important;
  margin-right: auto;
  width: 370px;
  background-color: #ffffff;
  border: 1px solid #000000;
  border-radius: 8px;
  padding: 24px !important;
  box-shadow: none;
  font-family: 'Noto Serif', serif;
  color: #545454;
  font-size: 20px;
}

#step2>* p {
  font-family: 'Noto Serif', serif;
  color: #545454;
  font-size: 17px;
}

#step2>* p:nth-child(2) {
  font-size: 15px;
}

.sticky-thing.bg-purple, .sticky-thing.bg-ocean, .sticky-thing.bg-sunset, .sticky-thing.bg-forest, .sticky-thing.bg-fire {
  background: #f4f3ec;
}

#scrolly-slope {
  position: relative;
  margin-bottom: 0px;
  margin-top: 0px;
}

#scrolly-slope .sticky-slope {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 400px;
  height: auto;
  width: 100%;
  margin: 0;
  padding: 20px 0;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
}

#scrolly-slope .slope-steps-container {
  transform: translate3d(0, 0, 0);
  position: relative;
  padding: 0;
  z-index: 20;
  max-width: 100%;
  margin: 0;
  padding-top: 400px;
  padding-bottom: 20px;
}

#scrolly-slope .slope-step {
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 400px;
  transform: translate(0px, 0px);
}

#scrolly-slope .slope-step:last-child {
  margin-bottom: 0;
}

#scrolly-slope .slope-step p {
  text-align: center;
  margin-bottom: 6px;
  padding-bottom: 0;
  font-size: 16px;
}

#scrolly-slope .slope-step p:last-child {
  padding: 0;
}

#scrolly-slope .slope-step p strong {
  font-family: 'Noto Serif', serif;
  font-weight: bold;
}

#scrolly-slope .slope-step {
  position: relative;
}

#scrolly-slope .slope-step > * {
  margin-left: auto !important;
  margin-right: auto !important;
  width: 370px;
  text-align: center;
  padding: 24px !important;
  background-color: #ffffff;
  border: 1px solid #000000;
  border-radius: 8px;
  box-shadow: none;
  font-family: 'Noto Serif', serif;
  color: #545454;
  font-size: 50px;
  position: relative;
}

#scrolly-slope .slope-step-image {
  position: absolute;
  left: -96px;
  top: 50%;
  transform: translateY(-50%);
  height: 90px;
  width: auto;
  object-fit: contain;
  z-index: 10;
}

#scrolly-slope .slope-step-image-right {
  position: absolute;
  right: -96px;
  top: 50%;
  transform: translateY(-50%);
  height: 90px;
  width: auto;
  object-fit: contain;
  z-index: 10;
}

.map-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 10px;
}

#nyc-header {
  background-color: #b8d4e8;
  padding: 25px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  margin-bottom: 0;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

#search-container {
  background: white;
  border-radius: 50px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  border: 1px solid #333;
  width: 100%;
  max-width: 600px;
}

#search-icon {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  opacity: 0.6;
  flex-shrink: 0;
}

#zipcode {
  border: none;
  outline: none;
  flex: 1;
  font-size: 16px;
  padding: 0;
  background: transparent;
  color: #333;
}

#zipcode::placeholder { color: #999; }

#nyc-main-container {
  position: relative;
  width: 100%;
  height: 600px;
  padding: 20px;
  padding-top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 0;
}

#map {
  width: 90%;
  max-width: 1400px;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid #4a4a4a;
  position: relative;
}

#results-card {
  position: absolute;
  top: 50px;
  left: 140px;
  background: white;
  padding: 20px;
  max-width: 400px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  font-family: 'Barlow Condensed', sans-serif;
}

#results-card.show { display: block; }

#results-text {
  font-size: 13px;
  line-height: 1.8;
  color: #333;
  margin: 0;
}

.service-type {
  font-weight: 600;
  color: #2c3e50;
}

#borough-buttons {
  position: absolute;
  top: 60px;
  right: calc(5% + 50px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
  pointer-events: auto;
  max-width: 180px;
}

.borough-btn {
  background: white;
  border: 1px solid #4a4a4a;
  padding: 12px 20px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  color: #333;
  text-align: center;
  min-width: 150px;
}

.borough-btn:hover,
.borough-btn.active {
  background: #c85436;
  color: white;
  border-color: #c85436;
}

@media (max-width: 1600px) {
  #borough-buttons {
    right: calc(5% + 50px);
  }
}

@media (max-width: 1200px) {
  #borough-buttons {
    right: calc(2.5% + 40px);
  }
  .borough-btn {
    min-width: 130px;
    padding: 10px 16px;
    font-size: 13px;
  }
}

@media (max-width: 1024px) {
  #borough-buttons {
    right: 30px;
    top: 50px;
    max-width: 160px;
  }
  .borough-btn {
    min-width: 120px;
    padding: 10px 14px;
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  #nyc-header { padding: 15px; }
  #nyc-main-container { padding: 10px; height: 400px; }
  #map { width: 100%; border-radius: 10px; }
  #results-card {
    top: 10px;
    left: 10px;
    max-width: calc(100% - 20px);
    max-height: 40vh;
    padding: 15px;
    font-size: 12px;
  }
  #borough-buttons {
    top: 10px;
    right: 10px;
    gap: 5px;
    max-width: calc(100% - 20px);
  }
  .borough-btn {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 100px;
    max-width: 100%;
  }
}

.references-box {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 24px;
  max-width: 650px;
  width: 100%;
  margin: 0 auto 40px auto;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: #333;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.references-box .map-title {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.references-box a {
  color: #4a4a4a;
  text-decoration: none;
}

.references-box a:hover {
  color: #333;
  text-decoration: underline;
}

/* Mapbox Popup Styles - mesma característica da tooltip do gridmap */
.mapboxgl-popup-content {
  background-color: white !important;
  border: 1px solid #000 !important;
  border-radius: 4px !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
  text-align: center !important;
  max-width: 200px !important;
  word-wrap: break-word !important;
}

.mapboxgl-popup-tip {
  border-top-color: #000 !important;
}

.mapboxgl-popup.borough-info-popup .mapboxgl-popup-tip {
  display: none !important;
}

.mapboxgl-popup-close-button {
  display: none !important;
}

.map-title {
  font-family: 'Retropix', 'VT323', 'Courier New', monospace;
  font-size: 28px;
  color: #323232;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1.2;
  margin-bottom: 30px;
  margin-top: 5px;
  padding: 0 20px;
  max-width: 1200px;
}

.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  overflow-x: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

svg{
  margin: 0 auto;
  display: block;
  max-width: 100%;
  height: auto;
}

text{
  font-weight: 300;
}

.slope-wrapper{
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  justify-items: center;
  align-items: flex-start;
  padding: 10px 0;
}

.slope-card{
  background: transparent;
  padding: 4px;
}

.slope-card svg{
  display: block;
  max-width: 100%;
  height: auto;
}

.slope-source {
  position: absolute;
  bottom: 3px;
  right: 55px;
  text-align: right;
  font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  font-size: 10px;
  color: #000;
  font-weight: normal;
  z-index: 100;
  pointer-events: none;
}

.intro-text {
  font-family: 'Noto Serif', Georgia, serif;
  font-size: 1.6em;
  line-height: 1.5;
  margin: 0.2em auto;
  max-width: 650px;
  text-align: justify;
  padding: 0 20px;
  color: #333;
  width: 100%;
  box-sizing: border-box;
}

.intro-text + .intro-text {
  margin-top: 0.1em;
}

.tooltip {
  position: absolute;
  background-color: white;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 8px 12px;
  pointer-events: none;
  opacity: 0;
  font-size: 12px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  z-index: 1000;
  max-width: 200px;
  word-wrap: break-word;
  text-align: center;
}

.bar-chart-scrolly-container {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
}

.bar-chart-sticky-element {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  background-color: #f4f3ec;
  overflow: visible;
  z-index: 1;
  margin: 0;
  padding: 0;
}

.bar-chart-step {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  scroll-snap-align: start;
  margin: 0;
}

.bar-chart-container {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0;
  flex-wrap: nowrap;
  justify-content: center;
  width: 100%;
  max-width: 100vw;
  padding: 120px 2rem 0;
  overflow: visible;
}

.bar-chart-tooltip {
  position: absolute;
  top: 290px;
  left: 50%;
  transform: translateX(-50%);
  background-color: white;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 12px 16px;
  font-family: 'Noto Serif', Georgia, serif;
  font-size: 16px;
  color: #333;
  text-align: center;
  max-width: 600px;
  width: 90%;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.bar-chart-tooltip.visible {
  opacity: 1;
}

.bar-person-wrapper {
  position: relative;
  width: 270px;
  flex-shrink: 0;
  margin-left: -243px;
  display: inline-block;
  will-change: transform;
}

.bar-person-wrapper:first-child {
  margin-left: 0;
}

.bar-person-canvas {
  width: 100%;
  height: auto;
  display: block;
  will-change: contents;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.bar-person-annotation-line {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%) rotate(15deg);
  transform-origin: bottom center;
  width: 0;
  height: 100px;
  border-left: 1px dashed #000;
  z-index: 100;
  pointer-events: none;
}

.bar-person-annotation-text {
  position: absolute;
  top: -110px;
  left: 58%;
  transform: translateX(-50%) rotate(15deg);
  transform-origin: center center;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #000;
  z-index: 100;
  text-align: center;
  background-color: #f4f3ec;
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
  font-weight: normal;
  line-height: 1.4;
  max-width: 200px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .bar-chart-container {
    padding: 0 1rem;
  }

  .bar-person-wrapper {
    width: 150px;
    margin-left: -135px;
  }

  .bar-chart-sticky-element {
    min-height: 50vh;
  }

  .bar-chart-step {
    padding: 0.5rem;
    min-height: 50vh;
  }
}

@media (max-width: 480px) {
  .bar-person-wrapper {
    width: 120px;
    margin-left: -108px;
  }

  .bar-chart-sticky-element {
    min-height: 50vh;
  }

  .bar-chart-step {
    padding: 0.5rem;
    min-height: 50vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bar-person-wrapper {
    transition: none;
  }
}

@supports (contain: layout) {
  .bar-chart-container {
    contain: layout style paint;
  }
}

@media screen and (max-width: 1024px) {
  .face {
    width: 24%;
    max-width: 300px;
  }

  .header-title-overlay {
    top: 150px;
  }

  .header-title-line {
    font-size: 24px;
  }

}

@media screen and (max-width: 768px) {
  .face {
    width: 20%;
    max-width: 200px;
  }

  .header-title-overlay {
    top: 120px;
  }

  .header-click-right {
    right: 80px;
    top: 220px;
  }

  .header-title-line {
    font-size: 18px;
    padding: 4px 8px;
  }

  .header-click-text {
    font-size: 21px;
    top: 180px;
    left: 40px;
  }

}

@media screen and (max-width: 1024px) {
  .intro-text {
    max-width: 90%;
    font-size: 1.5em;
    padding: 0 20px;
  }
}

@media screen and (max-width: 768px) {
  body {
    padding: 5px;
    font-size: 10px;
    min-height: 100vh;
    align-items: flex-start;
    padding-top: 20px;
  }

  .intro-text {
    font-size: 1.3em;
    padding: 0 15px;
    margin: 0.3em auto;
    max-width: 95%;
  }

  .map-title {
    font-size: 22px;
    margin-top: 30px;
    margin-bottom: 20px;
    padding: 0 15px;
  }

  .container {
    align-items: flex-start;
  }

  .tooltip {
    font-size: 11px;
    padding: 6px 10px;
    max-width: 150px;
  }
}

@media screen and (max-width: 480px) {
  .face {
    width: 18%;
    max-width: 120px;
  }

  .header-title-overlay {
    top: 80px;
  }

  .header-click-right {
    right: 40px;
    top: 150px;
  }

  .header-title-line {
    font-size: 14px;
    padding: 2px 5px;
    letter-spacing: 0.5px;
  }

  .header-click-text {
    font-size: 15px;
    top: 120px;
    left: 15px;
    padding: 4px 6px;
  }

  body {
    padding: 3px;
    font-size: 9px;
    min-height: 100vh;
    align-items: flex-start;
    padding-top: 15px;
  }

  .intro-text {
    font-size: 1em;
    padding: 0 15px;
    margin: 0.3em auto;
    max-width: 100%;
    line-height: 1.5;
  }

  .map-title {
    font-size: 18px;
    margin-top: 20px;
    margin-bottom: 15px;
    padding: 0 10px;
    letter-spacing: 1px;
  }

  .container {
    align-items: flex-start;
  }

  .tooltip {
    font-size: 10px;
    padding: 5px 8px;
    max-width: 120px;
  }

  .slope-wrapper {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 5px 0;
  }

  .slope-card {
    padding: 2px;
  }

  .slope-source {
    font-size: 8px;
    padding: 8px 10px 0 0;
  }
}

@media screen and (max-width: 768px) {
  .slope-wrapper {
    grid-template-columns: repeat(2, 1fr);
  }

  .slope-source {
    font-size: 9px;
    padding: 8px 15px 0 0;
  }
}

@media screen and (max-width: 640px) {
  .slope-wrapper {
    grid-template-columns: 1fr;
  }

  .slope-source {
    font-size: 8px;
    padding: 8px 10px 0 0;
  }
}

@media screen and (max-width: 640px) {
  .face {
    width: 22%;
    max-width: 150px;
  }

  .header-title-overlay {
    top: 100px;
  }

  .header-click-right {
    right: 50px;
    top: 200px;
  }

  .header-title-line {
    font-size: 16px;
    padding: 3px 6px;
  }

  .header-click-text {
    font-size: 18px;
    top: 150px;
    left: 20px;
  }

  .header-click-right {
    right: 50px;
    top: 200px;
  }

  .intro-text {
    font-size: 1.2em;
    padding: 0 15px;
    max-width: 100%;
    line-height: 1.6;
  }

  .slope-wrapper {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .slope-card {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  body { font-size: 18px; }
  .content { padding-left: 10px; padding-right: 10px; }
  .background-text h2 { font-size: 50px; }
  .background-text .big-number { font-size: 100px; }
  .background-text p { font-size: 24px; }
  .step>* { width: 90%; }
  }

.dice-game-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 40px;
  width: 100%;
  margin: 20px 0 5px 0;
  min-height: 500px;
  overflow: visible;
}

.dice-game-section {
  perspective: 1000px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
}

.dice-game-group {
  display: flex;
  gap: 40px;
  align-items: center;
  justify-content: center;
}

.dice-game {
  width: 120px;
  height: 120px;
  position: relative;
  transform-style: preserve-3d;
  cursor: pointer;
  transform-origin: center center;
}

.dice-game.rolling {
  animation: rollDiceGame 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes rollDiceGame {
  0% { transform: translateY(0) rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  15% { transform: translateY(-150px) rotateX(180deg) rotateY(90deg) rotateZ(45deg); }
  30% { transform: translateY(0) rotateX(360deg) rotateY(180deg) rotateZ(90deg); }
  40% { transform: translateY(-30px) rotateX(450deg) rotateY(270deg) rotateZ(135deg); }
  50% { transform: translateY(0) rotateX(540deg) rotateY(360deg) rotateZ(180deg); }
  60% { transform: translateY(-15px) rotateX(630deg) rotateY(450deg) rotateZ(225deg); }
  70% { transform: translateY(0) rotateX(720deg) rotateY(540deg) rotateZ(270deg); }
  80% { transform: translateY(-8px) rotateX(810deg) rotateY(630deg) rotateZ(315deg); }
  90% { transform: translateY(0) rotateX(900deg) rotateY(720deg) rotateZ(360deg); }
  100% { transform: translateY(0) rotateX(1080deg) rotateY(900deg) rotateZ(450deg); }
}

.dice-game:hover:not(.rolling) {
  transform: rotateX(20deg) rotateY(20deg);
}

.dice-face {
  position: absolute;
  width: 120px;
  height: 120px;
  background: #adc9e6;
  border: 2px solid #fff;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.dice-pip {
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
}

.dice-face-1 { transform: rotateY(0deg) translateZ(60px); }
.dice-face-1 .dice-pip { top: 50%; left: 50%; transform: translate(-50%, -50%); }

.dice-face-2 { transform: rotateY(90deg) translateZ(60px); }
.dice-face-2 .dice-pip:nth-child(1) { top: 25%; left: 25%; }
.dice-face-2 .dice-pip:nth-child(2) { bottom: 25%; right: 25%; }

.dice-face-3 { transform: rotateY(180deg) translateZ(60px); }
.dice-face-3 .dice-pip:nth-child(1) { top: 25%; right: 25%; }
.dice-face-3 .dice-pip:nth-child(2) { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.dice-face-3 .dice-pip:nth-child(3) { bottom: 25%; left: 25%; }

.dice-face-4 { transform: rotateY(-90deg) translateZ(60px); }
.dice-face-4 .dice-pip:nth-child(1) { top: 25%; left: 25%; }
.dice-face-4 .dice-pip:nth-child(2) { top: 25%; right: 25%; }
.dice-face-4 .dice-pip:nth-child(3) { bottom: 25%; left: 25%; }
.dice-face-4 .dice-pip:nth-child(4) { bottom: 25%; right: 25%; }

.dice-face-5 { transform: rotateX(90deg) translateZ(60px); }
.dice-face-5 .dice-pip:nth-child(1) { top: 25%; left: 25%; }
.dice-face-5 .dice-pip:nth-child(2) { top: 25%; right: 25%; }
.dice-face-5 .dice-pip:nth-child(3) { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.dice-face-5 .dice-pip:nth-child(4) { bottom: 25%; left: 25%; }
.dice-face-5 .dice-pip:nth-child(5) { bottom: 25%; right: 25%; }

.dice-face-6 { transform: rotateX(-90deg) translateZ(60px); }
.dice-face-6 .dice-pip:nth-child(1) { top: 20%; left: 25%; }
.dice-face-6 .dice-pip:nth-child(2) { top: 20%; right: 25%; }
.dice-face-6 .dice-pip:nth-child(3) { top: 50%; left: 25%; transform: translateY(-50%); }
.dice-face-6 .dice-pip:nth-child(4) { top: 50%; right: 25%; transform: translateY(-50%); }
.dice-face-6 .dice-pip:nth-child(5) { bottom: 20%; left: 25%; }
.dice-face-6 .dice-pip:nth-child(6) { bottom: 20%; right: 25%; }

.dice-sum-display {
  position: absolute;
  left: calc(50% + 180px);
  top: 48%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #333;
  max-width: 450px;
  width: 450px;
  text-align: left;
  line-height: 1.5;
  white-space: pre-line;
  word-spacing: 0;
  letter-spacing: 0;
  font-family: 'Noto Serif', Georgia, serif;
}

.dice-sum-display .dice-number {
  font-size: 48px;
  font-weight: bold;
  color: #626161;
  display: block;
  margin-bottom: 16px;
  line-height: 1;
  text-align: left;
  width: 100%;
}

.dice-sum-display .dice-word {
  background: #facc76;
  padding: 2px 4px;
  border-radius: 0;
  display: inline-block;
  margin: 0;
  white-space: nowrap;
}

.dice-sum-display .dice-word:first-child {
  border-radius: 3px 0 0 3px;
}

.dice-sum-display .dice-word:last-child {
  border-radius: 0 3px 3px 0;
}

.dice-controls {
  text-align: center;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.dice-controls button {
  padding: 10px 20px;
  font-size: 14px;
  background: white;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 400;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.dice-controls button:hover {
  border-color: #999;
  background: #f9f9f9;
}

.dice-controls button:active {
  background: #f0f0f0;
}

@media (max-width: 1024px) {
  .dice-game-container {
    padding: 30px 20px;
  }

  .dice-game-section {
    position: static;
    transform: none;
    left: auto;
    top: auto;
  }

  .dice-game, .dice-face {
    width: 100px;
    height: 100px;
  }

  .dice-face-1 { transform: rotateY(0deg) translateZ(50px); }
  .dice-face-2 { transform: rotateY(90deg) translateZ(50px); }
  .dice-face-3 { transform: rotateY(180deg) translateZ(50px); }
  .dice-face-4 { transform: rotateY(-90deg) translateZ(50px); }
  .dice-face-5 { transform: rotateX(90deg) translateZ(50px); }
  .dice-face-6 { transform: rotateX(-90deg) translateZ(50px); }

  .dice-pip {
    width: 14px;
    height: 14px;
  }

  .dice-sum-display {
    position: static;
    transform: none;
    left: auto;
    top: auto;
    margin-top: 40px;
    max-width: 600px;
    width: 100%;
    text-align: center;
  }

  .dice-sum-display .dice-number {
    font-size: 36px;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .dice-game-container {
    padding: 20px 15px;
    flex-direction: column;
    gap: 30px;
  }

  .dice-game-section {
    position: static;
    transform: none;
    left: auto;
    top: auto;
  }

  .dice-game-group {
    gap: 20px;
  }

  .dice-game, .dice-face {
    width: 80px;
    height: 80px;
    border: 1.5px solid #fff;
    border-radius: 10px;
  }

  .dice-face-1 { transform: rotateY(0deg) translateZ(40px); }
  .dice-face-2 { transform: rotateY(90deg) translateZ(40px); }
  .dice-face-3 { transform: rotateY(180deg) translateZ(40px); }
  .dice-face-4 { transform: rotateY(-90deg) translateZ(40px); }
  .dice-face-5 { transform: rotateX(90deg) translateZ(40px); }
  .dice-face-6 { transform: rotateX(-90deg) translateZ(40px); }

  .dice-pip {
    width: 12px;
    height: 12px;
  }

  .dice-sum-display {
    position: static;
    transform: none;
    left: auto;
    top: auto;
    margin-top: 30px;
    max-width: 100%;
    width: 100%;
    font-size: 14px;
    text-align: center;
    padding: 0 10px;
  }

  .dice-sum-display .dice-number {
    font-size: 32px;
    margin-bottom: 12px;
    text-align: center;
  }

  .dice-controls {
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  .dice-controls button {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .dice-game, .dice-face {
    width: 70px;
    height: 70px;
    border-radius: 8px;
  }

  .dice-face-1 { transform: rotateY(0deg) translateZ(35px); }
  .dice-face-2 { transform: rotateY(90deg) translateZ(35px); }
  .dice-face-3 { transform: rotateY(180deg) translateZ(35px); }
  .dice-face-4 { transform: rotateY(-90deg) translateZ(35px); }
  .dice-face-5 { transform: rotateX(90deg) translateZ(35px); }
  .dice-face-6 { transform: rotateX(-90deg) translateZ(35px); }

  .dice-pip {
    width: 10px;
    height: 10px;
  }

  .dice-sum-display {
    font-size: 13px;
  }

  .dice-sum-display .dice-number {
    font-size: 28px;
  }

  .dice-game-group {
    gap: 15px;
  }
}

