:root {
  color-scheme: light;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", system-ui, sans-serif;
  background: #78918f;
  color: #24383b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #78918f;
}

body {
  overscroll-behavior: none;
}

button,
select,
a {
  font: inherit;
}

button,
select {
  color: inherit;
}

.rain-scene {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 100vh;
  isolation: isolate;
  overflow: hidden;
}

#rain-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
}

.scene-label,
.top-controls,
.interaction-hint,
.back-link,
.noscript {
  position: absolute;
  z-index: 2;
}

.scene-label {
  top: max(20px, env(safe-area-inset-top));
  left: max(22px, env(safe-area-inset-left));
  pointer-events: none;
}

.series {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.18em;
  opacity: 0.66;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(28px, 4.2vw, 54px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.description {
  margin: 10px 0 0;
  max-width: min(54vw, 520px);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  opacity: 0.66;
}

.top-controls {
  top: max(20px, env(safe-area-inset-top));
  right: max(22px, env(safe-area-inset-right));
  display: grid;
  justify-items: end;
  gap: 8px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.control-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
  opacity: 0.48;
}

.source-control {
  position: relative;
}

.source-control::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-right: 1px solid rgba(35, 54, 57, 0.58);
  border-bottom: 1px solid rgba(35, 54, 57, 0.58);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.source-select,
.site-language-buttons {
  border: 1px solid rgba(36, 56, 59, 0.18);
  background: rgba(225, 234, 230, 0.24);
  box-shadow: inset 0 1px 0 rgba(248, 251, 249, 0.2), 0 3px 12px rgba(39, 58, 60, 0.05);
  backdrop-filter: blur(10px);
}

.source-select {
  width: min(224px, 42vw);
  height: 30px;
  padding: 0 34px 0 12px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(225, 234, 230, 0.24);
  color: rgba(34, 54, 57, 0.86);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.source-select:hover {
  background-color: rgba(235, 242, 239, 0.34);
  border-color: rgba(36, 56, 59, 0.28);
}

.source-select:focus-visible,
.site-language-button:focus-visible {
  outline: 1px solid rgba(35, 54, 57, 0.58);
  outline-offset: 2px;
}

.source-select option {
  background: #d9e2de;
  color: #2b4143;
  font-size: 12px;
}

.site-language-buttons {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
}

.site-language-button {
  min-width: 34px;
  height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  opacity: 0.5;
}

.site-language-button.is-active {
  background: rgba(239, 245, 242, 0.72);
  box-shadow: 0 1px 6px rgba(35, 54, 57, 0.08);
  opacity: 0.92;
}

.stream-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 1px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0.66;
  pointer-events: none;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.38;
  transition: opacity 180ms ease;
}

.status-dot.is-live {
  opacity: 0.9;
}

.interaction-hint {
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  margin: 0;
  color: rgba(230, 239, 237, 0.64);
  font-size: 10px;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.back-link {
  left: max(22px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom));
  color: rgba(230, 239, 237, 0.64);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  text-decoration: none;
  transition: color 160ms ease;
}

.back-link:hover,
.back-link:focus-visible {
  color: rgba(244, 249, 248, 0.94);
}

.noscript {
  left: 50%;
  top: 50%;
  width: min(80vw, 420px);
  margin: 0;
  padding: 14px 18px;
  transform: translate(-50%, -50%);
  background: rgba(236, 242, 240, 0.86);
  border: 1px solid rgba(40, 62, 64, 0.16);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

@media (max-width: 640px) {
  .scene-label {
    top: max(16px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
  }

  .description {
    max-width: 48vw;
  }

  .top-controls {
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    gap: 7px;
  }

  .source-select {
    width: min(192px, 47vw);
    font-size: 8px;
  }

  .stream-status {
    max-width: 47vw;
    justify-content: flex-end;
    text-align: right;
    font-size: 8px;
  }

  .interaction-hint {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  .back-link {
    left: max(16px, env(safe-area-inset-left));
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .source-select,
  .status-dot,
  .back-link {
    transition: none;
  }
}
