* {
  box-sizing: border-box;
}

.adsbygoogle {
  margin: 16px 0;
  text-align: center;
}

:root {
  --marimo: #1b9229;
  --marimo-dark: #14771f;
  --marimo-light: #35a83f;
  --water-top: #a9d9d7;
  --water-bottom: #d8ece8;
  --sand: #b7c8a7;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

body {
  min-height: 100vh;
  overflow: hidden;
  background: #b9ddda;
  color: #16392d;
  user-select: none;
  -webkit-user-select: none;
}

.scene {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0) 42%),
    linear-gradient(to bottom, var(--water-top) 0 70%, var(--sand) 70% 100%);
}

.scene::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 70%;
  height: 6px;
  background: rgba(75, 112, 76, .28);
  box-shadow: 0 -12px 40px rgba(255, 255, 255, .25);
}

.scene::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 30%;
  opacity: .4;
  background-image:
    radial-gradient(circle at 8% 24%, #75856f 0 2px, transparent 3px),
    radial-gradient(circle at 23% 50%, #75856f 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 65% 30%, #75856f 0 2px, transparent 3px),
    radial-gradient(circle at 88% 66%, #75856f 0 1.5px, transparent 2.5px);
  background-size: 150px 80px;
  pointer-events: none;
}

.water-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(14px);
  background: rgba(255, 255, 255, .20);
  pointer-events: none;
}

.water-glow-a {
  width: 42vw;
  height: 12vw;
  left: -6vw;
  top: 16vh;
  transform: rotate(-12deg)
}

.water-glow-b {
  width: 36vw;
  height: 9vw;
  right: -4vw;
  top: 36vh;
  transform: rotate(9deg)
}

.stage {
  position: relative;
  z-index: 3;
  width: min(94vw, 760px);
  height: min(92vh, 820px);
  min-height: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.hint {
  margin: 0;
  padding: 10px 18px;
  border: 2px solid rgba(14, 76, 45, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .68);
  box-shadow: 0 6px 18px rgba(12, 73, 52, .08);
  font-size: clamp(13px, 2.4vw, 17px);
  font-weight: 700;
  letter-spacing: .02em;
  text-align: center;
  backdrop-filter: blur(8px);
}

.character-wrap {
  position: relative;
  width: min(62vw, 430px);
  aspect-ratio: 1/1;
  display: grid;
  place-items: center;
  transform-origin: 50% 80%;
  animation: float 4.8s ease-in-out infinite;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.shadow {
  position: absolute;
  width: 68%;
  height: 11%;
  left: 16%;
  bottom: 5%;
  border-radius: 50%;
  background: rgba(48, 69, 43, .25);
  filter: blur(6px);
  transform: scaleX(1);
  animation: shadowPulse 4.8s ease-in-out infinite;
}

.marimo {
  position: relative;
  width: 82%;
  aspect-ratio: 1;
  border-radius: 49% 51% 48% 52% / 52% 47% 53% 48%;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .10), transparent 23%),
    radial-gradient(circle at 72% 66%, rgba(0, 0, 0, .05), transparent 26%),
    linear-gradient(145deg, var(--marimo-light), var(--marimo) 40%, var(--marimo-dark));
  border: 4px solid #111;
  box-shadow:
    inset -18px -12px 24px rgba(0, 0, 0, .06),
    inset 16px 12px 20px rgba(255, 255, 255, .05),
    0 18px 35px rgba(36, 83, 49, .14);
  transform-origin: 50% 78%;
  transition: transform .16s ease;
  animation: breath 3.2s ease-in-out infinite;
  --eye-move-x: 0px;
  --eye-move-y: 0px;
}

.character-wrap.is-pressed .marimo {
  transform: scale(.985, 1.025) translateY(3px);
}

.marimo-shine {
  position: absolute;
  width: 18%;
  height: 9%;
  left: 18%;
  top: 13%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
  filter: blur(6px);
  transform: rotate(-24deg);
}


.face {
  position: absolute;
  inset: 0;
  transform: translate3d(var(--face-x, 0px), var(--face-y, 0px), 0);
  transition: transform .08s linear;
  pointer-events: none;
}

.eye {
  position: absolute;
  top: 31%;
  width: 5.2%;
  height: 15%;
  border-radius: 50%;
  background: #050505;
  overflow: hidden;
  transform-origin: center;
  transition: transform .055s linear;
  transform: translate(var(--eye-move-x), var(--eye-move-y));
}

.eye-left {
  left: 40%
}

.eye-right {
  right: 40%
}

.eye-highlight {
  position: absolute;
  width: 30%;
  aspect-ratio: 1;
  top: 18%;
  left: 22%;
  border-radius: 50%;
  background: #fff;
  opacity: .95;
}

.mouth {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 11%;
  height: 12.5%;
  transform: translateX(-50%);
  transition: transform .12s ease, top .12s ease;
}

.mouth-default {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  transform: scale(1) translateY(0);
  transition: opacity .1s ease, transform .12s ease;
  overflow: visible;
}

.mouth-open {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .12s ease, transform .12s ease;
  overflow: visible;
}

.mouth.is-open {
  top: 53.8%;
  transform: translateX(-50%);
}

.mouth.is-open .mouth-default {
  opacity: 0;
  transform: scale(.72) translateY(-2px);
}

.mouth.is-open .mouth-open {
  opacity: 1;
  transform: scale(1);
}

.eye.blink {
  animation: blink .13s ease-in-out 2 alternate;
}

.action {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  background: #157c2d;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 6px 0 #0b5f20, 0 12px 24px rgba(12, 81, 32, .18);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}

.action:hover {
  filter: brightness(1.06)
}

.action:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #0b5f20, 0 7px 14px rgba(12, 81, 32, .16);
}

.weed {
  position: absolute;
  bottom: 23%;
  width: 100px;
  height: 230px;
  z-index: 1;
  opacity: .9;
  pointer-events: none;
}

.weed-left {
  left: 2vw
}

.weed-right {
  right: 1vw;
  transform: scaleX(-1)
}

.weed i {
  position: absolute;
  bottom: 0;
  width: 18px;
  height: 190px;
  border: 2px solid #163f25;
  border-radius: 100% 0 100% 0;
  background: #6b9157;
  transform-origin: bottom center;
}

.weed i:nth-child(1) {
  left: 8px;
  transform: rotate(-15deg);
  height: 160px
}

.weed i:nth-child(2) {
  left: 29px;
  transform: rotate(4deg);
  height: 210px
}

.weed i:nth-child(3) {
  left: 53px;
  transform: rotate(18deg);
  height: 175px
}

.weed i:nth-child(4) {
  left: 73px;
  transform: rotate(31deg);
  height: 130px
}

@keyframes breath {

  0%,
  100% {
    border-radius: 49% 51% 48% 52% / 52% 47% 53% 48%;
    transform: scale(1)
  }

  50% {
    border-radius: 51% 49% 51% 49% / 49% 53% 47% 51%;
    transform: scale(1.012, .995)
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0) rotate(-.4deg)
  }

  50% {
    transform: translateY(-9px) rotate(.5deg)
  }
}

@keyframes shadowPulse {

  0%,
  100% {
    transform: scaleX(1);
    opacity: .24
  }

  50% {
    transform: scaleX(.93);
    opacity: .18
  }
}

@keyframes blink {
  to {
    transform: translate(var(--eye-move-x), var(--eye-move-y)) scaleY(.08)
  }
}

@media (max-width:700px) {
  .stage {
    height: 100dvh;
    min-height: 500px;
    gap: 22px
  }

  .character-wrap {
    width: min(78vw, 390px)
  }

  .weed {
    transform: scale(.78);
    transform-origin: bottom left
  }

  .weed-right {
    transform: scale(-.78, .78);
    transform-origin: bottom right
  }

  .hint {
    max-width: 88vw
  }
}

@media (prefers-reduced-motion:reduce) {

  .character-wrap,
  .marimo,
  .shadow {
    animation: none
  }

  .face,
  .eye,
  .mouth,
  .mouth-default,
  .mouth-open {
    transition: none
  }
}





/* マリモくんのセリフ用フキダシ */
.speech-bubble {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 72px;
  min-width: min(300px, 78vw);
  max-width: 90vw;
  padding: 16px 26px;
  background: #fff;
  border: 3px solid #111;
  border-radius: 24px;
  color: #222;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .06);
  font-size: clamp(15px, 2.5vw, 20px);
  line-height: 1.5;
  font-weight: 700;
  overflow: visible;
}

.speech-bubble::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: calc(50% - 16px);
  bottom: -24px;
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 24px solid #111;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: calc(50% - 12px);
  bottom: -17px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 19px solid white;
}

.speech-bubble #speechText {
  position: relative;
  z-index: 2;
  display: block;
  min-height: 1.5em
}

@media(max-width:700px) {
  .speech-bubble {
    min-height: 66px;
    padding: 14px 20px;
  }
}

/* 背景色選択時は一面単色。草、水底、光などの装飾は隠す */
.scene.solid-background {
  background: var(--chosen-background, #a9d9d7)
}

.scene.solid-background::before,
.scene.solid-background::after {
  display: none
}

.scene.solid-background .water-glow,
.scene.solid-background .weed {
  display: none
}

.color-panel {
  position: relative;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid rgba(20, 66, 45, .25);
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 3px 15px rgba(0, 0, 0, .08);
  font-size: 13px;
  font-weight: 700
}

.color-panel input[type=color] {
  width: 44px;
  height: 33px;
  padding: 2px;
  border: 1px solid #9fae9f;
  border-radius: 6px;
  background: #fff;
  cursor: pointer
}

.color-reset {
  border: 1px solid #b2c7b7;
  border-radius: 7px;
  padding: 7px 8px;
  background: #fff;
  color: #284434;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer
}

.color-reset:hover {
  background: #edf8f0
}

@media(max-width:600px) {
  .color-panel {
    gap: 6px;
    padding: 6px 8px
  }

  .color-panel input[type=color] {
    width: 37px;
    height: 31px
  }
}


.speech-form {
  width: min(92vw, 560px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.speech-form-label {
  font-size: 14px;
  font-weight: 700;
  color: #18422e;
  padding-left: 6px;
}

.speech-form-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.speech-input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 3px solid #12361f;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-size: 16px;
  font-weight: 700;
  outline: none;
  box-shadow: 0 6px 18px rgba(12, 73, 52, .08);
}

.speech-input:focus {
  border-color: #1f8f39;
  box-shadow: 0 0 0 4px rgba(31, 143, 57, .15), 0 6px 18px rgba(12, 73, 52, .08);
}

.send-button {
  flex: 0 0 auto;
  min-width: 96px;
}

.send-button:disabled {
  opacity: .65;
  cursor: wait
}

.message-status {
  width: min(92vw, 560px);
  margin: -14px 0;
  min-height: 1.5em;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere
}

.speech-bubble #speechText {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  max-height: 25vh;
  overflow-y: auto;
  user-select: text;
  -webkit-user-select: text
}

@media (max-width:700px) {
  .speech-form {
    width: min(92vw, 460px);
  }

  .speech-form-row {
    gap: 8px;
  }

  .speech-input {
    height: 46px;
    font-size: 15px;
  }

  .send-button {
    min-width: 84px;
    padding: 12px 18px;
  }
}

/* 名前入力と会話の選択肢 */
body {
  overflow-y: auto
}

.stage {
  height: auto;
  min-height: 100dvh;
  padding: 24px 0
}

.character-wrap {
  flex-shrink: 0
}

.name-input {
  flex: none;
  width: 100%
}

.conversation-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px
}

.conversation-choices[hidden] {
  display: none
}

.conversation-choice {
  padding: 10px 12px;
  border: 2px solid #397c4b;
  border-radius: 12px;
  background: #fff;
  color: #16392d;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere
}

.conversation-choice:hover {
  background: #edf8f0
}

.conversation-choice:disabled {
  opacity: .6;
  cursor: wait
}

.conversation-choice:focus-visible {
  outline: 3px solid #1f8f39;
  outline-offset: 2px
}

@media(max-width:450px) {
  .conversation-choices {
    grid-template-columns: 1fr
  }
}

.color-panel {
  max-width: 100%;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center
}

.scene>footer {
  margin-bottom: 24px
}

.footer-ad {
  position: relative;
  z-index: 3;
  width: min(94vw, 760px);
  min-height: 300px;
  margin-bottom: 24px;
}


.app-intro {
  text-align: center
}

.app-intro h1 {
  margin: 0;
  font-size: clamp(20px, 4vw, 28px);
  line-height: 1.4
}

.app-intro p {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.7
}

.app-guide {
  width: min(92vw, 560px);
  padding: 12px 16px;
  border: 1px solid rgba(20, 66, 45, .25);
  border-radius: 14px;
  background: rgba(255, 255, 255, .85);
  font-size: 14px;
  line-height: 1.8
}

.app-guide summary {
  cursor: pointer;
  font-weight: 700
}

.app-guide p {
  margin: 10px 0 0
}


.name-settings-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
}

.name-settings-row .color-panel {
  width: 100%;
  min-width: 0;
  margin-top: 0;
  padding: 6px;
  gap: 6px;
}

.name-settings-row .color-panel label {
  font-size: 12px;
}

.name-settings-row .color-reset {
  padding: 6px;
  font-size: 11px;
}

.daily-usage {
  margin: 0;
  padding: 0 6px;
  font-size: 13px;
  line-height: 1.6;
  color: #18422e
}


.conversation-note {
  margin: 2px 6px 0;
  font-size: 12px;
  line-height: 1.6;
  color: #284434
}

.recent-conversations-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px
}

.recent-conversations-toolbar p {
  margin: 0;
  font-size: 12px
}

.recent-conversations-toolbar button {
  flex-shrink: 0
}

.recent-conversations-list {
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 12px
}

.recent-conversations-list li {
  padding: 12px;
  background: #fff;
  border: 1px solid #b2c7b7;
  border-radius: 12px
}

.recent-conversations-list p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text
}

.recent-conversations-list p+p {
  margin-top: 10px
}

.recent-conversations-list strong {
  display: block;
  font-size: 12px;
  color: #397c4b
}

[hidden]{display:none!important}
.ads-checking #characterWrap,.ads-checking #speechBubble,.ads-checking #speechForm,.ads-checking #messageStatus,
.ads-blocked #characterWrap,.ads-blocked #speechBubble,.ads-blocked #speechForm,.ads-blocked #messageStatus,
.ads-checking #quotaAd,.ads-blocked #quotaAd{display:none!important}
.ad-access-status{width:min(92vw,560px);padding:16px;text-align:center;line-height:1.8;background:#fff;border:1px solid #b2c7b7;border-radius:14px}
.ad-access-status p{margin:0 0 8px}
.quota-ad{width:min(92vw,560px);min-height:300px;text-align:center}
.quota-ad>p{font-size:14px;line-height:1.6}
