* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation; /*タブレット連打時の拡大防止 */
}

html {
  margin: 0;
  height: 100%;
}

body {
  margin: 0;
  height: 100vh;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Sans",
    "Yu Gothic",
    "Meiryo",
    sans-serif;
  background: #f2f2f2;

  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  margin: 0 auto;
  background: #ffffff;
  border: 2px solid #333;

  width: 100%;
  max-width: 1196px;
  height: 540px;

  display: flex;
  flex-direction: column;
}

.game-header {
  height: 50px;
  padding: 10px;
  background: #ffffff;

  flex: 0 0 50px;

  display: flex;
  align-items: center;
}

.info {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: bold;
  flex-wrap: wrap;
  width: 100%;
}

.game-main {
  position: relative;
  background: #ffffff;

  flex: 1;

  overflow: hidden;

  display: grid;
  place-items: center;
}

  :root{
    --sky1:#8FE0FF;
    --sky2:#CFF6FF;
    --sun:#FFDD55;
    --sun-edge:#FFC233;
    --grass1:#9AD34E;
    --grass2:#7EBF3A;
    --pond:#4FC3F7;
    --pond-edge:#29B6F6;
    --card:#FFFDF6;
    --accent:#FF8A5B;
    --accent-dark:#F0653A;
    --accent2:#FFC94D;
    --accent2-dark:#F2AE1E;
    --ok:#7ED957;
    --ng:#FF6F6F;
    --ng-dark:#E14F4F;
    --text:#4A3B2A;
    --purple:#B58BFF;
    --purple-dark:#9464F0;
  }

  .deco{position:absolute;pointer-events:none;}
  .sun{
    top:26px;left:40px;width:86px;height:86px;border-radius:50%;
    background:radial-gradient(circle at 35% 35%, var(--sun), var(--sun-edge));
    box-shadow:0 0 0 10px rgba(255,221,85,0.28);
    animation:pulse 3.5s ease-in-out infinite;
  }
  @keyframes pulse{0%,100%{transform:scale(1);}50%{transform:scale(1.06);}}
  .cloud{
    background:#fff;border-radius:50px;opacity:0.9;
    box-shadow:0 6px 0 rgba(0,0,0,0.03);
  }
  .cloud::before,.cloud::after{content:"";position:absolute;background:#fff;border-radius:50%;}
  .cloud1{top:48px;left:220px;width:110px;height:38px;animation:drift 22s linear infinite;}
  .cloud1::before{width:50px;height:50px;top:-24px;left:14px;}
  .cloud1::after{width:38px;height:38px;top:-18px;left:60px;}
  .cloud2{top:20px;right:120px;width:90px;height:32px;animation:drift 28s linear infinite reverse;}
  .cloud2::before{width:40px;height:40px;top:-20px;left:10px;}
  .cloud2::after{width:30px;height:30px;top:-14px;left:50px;}
  @keyframes drift{0%{transform:translateX(0);}50%{transform:translateX(30px);}100%{transform:translateX(0);}}
  .pond{
    position:absolute;left:-40px;bottom:0;width:340px;height:90px;
    background:radial-gradient(ellipse at center, var(--pond) 55%, var(--pond-edge) 100%);
    border-radius:50%;
  }
  .pond2{
    position:absolute;right:-60px;bottom:-10px;width:260px;height:80px;
    background:radial-gradient(ellipse at center, var(--pond) 55%, var(--pond-edge) 100%);
    border-radius:50%;
  }
  .lily{position:absolute;width:34px;height:34px;background:#5BA84A;border-radius:50% 50% 50% 0;transform:rotate(45deg);}
  .flower{position:absolute;width:20px;height:20px;}
  .flower::before{content:"";position:absolute;inset:0;background:#fff;border-radius:50%;box-shadow:12px 0 #fff,-12px 0 #fff,0 12px #fff,0 -12px #fff;opacity:0.9;}
  .flower::after{content:"";position:absolute;top:6px;left:6px;width:8px;height:8px;border-radius:50%;background:var(--accent2);}

  .screen{
    position:absolute;inset:0;
    display:none;
    flex-direction:column;
    align-items:center;
    justify-content:center;
  }
  .screen.active{display:flex;}

  #screen-title h1{
    margin:0 0 6px;
    font-size:46px;
    color:var(--text);
    text-shadow:3px 3px 0 #fff, 0 4px 0 rgba(0,0,0,0.06);
    letter-spacing:4px;
  }
  .title-illust{display:flex;gap:26px;align-items:flex-end;margin-bottom:14px;}
  .title-illust .icon-box{width:96px;height:96px;}
  .title-illust .icon-box.big{width:130px;height:130px;}
  .arrow-icon{font-size:34px;color:var(--accent-dark);}

  .big-btn{
    border:none;
    border-radius:50px;
    font-family:inherit;
    font-weight:700;
    cursor:pointer;
    color:#fff;
    box-shadow:0 8px 0 rgba(0,0,0,0.15);
    transition:transform .08s ease;
  }
  .big-btn:active{transform:translateY(6px);box-shadow:0 2px 0 rgba(0,0,0,0.15);}
  #start-btn{
    font-size:30px;
    padding:18px 64px;
    background:linear-gradient(180deg,var(--accent),var(--accent-dark));
  }

  #screen-game{justify-content:flex-start;padding-top:18px;}

  #quit-btn{
    font-size:18px;
    padding:12px 26px;
    background:linear-gradient(180deg,#FF9E9E,#E9605F);
    border:none;border-radius:40px;color:#fff;font-weight:700;
    cursor:pointer;box-shadow:0 6px 0 rgba(0,0,0,0.15);font-family:inherit;
  }
  #quit-btn:active{transform:translateY(4px);box-shadow:0 2px 0 rgba(0,0,0,0.15);}
  .dots{display:flex;gap:8px;background:#ffffffcc;padding:8px 14px;border-radius:20px;}
  .dot{width:16px;height:16px;border-radius:50%;background:#e0dcd0;border:2px solid #fff;}
  .dot.done{background:var(--ok);}
  .dot.now{background:var(--accent2);box-shadow:0 0 0 3px #ffffff, 0 0 0 5px var(--accent2);}

  .question-area{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:34px;
    margin-top:6px;
  }
  .qcard{
    background:var(--card);
    border-radius:26px;
    padding:14px 26px 10px;
    box-shadow:0 8px 0 rgba(0,0,0,0.08);
    display:flex;flex-direction:column;align-items:center;
    position:relative;
  }
  .qcard .icon-box{width:110px;height:110px;}
  .qcard .label{font-size:22px;color:var(--text);font-weight:700;margin-top:2px;}
  .qtext{
    font-size:24px;color:var(--text);font-weight:700;
    background:#ffffffdd;
    padding:10px 22px;border-radius:20px;
  }

  .options{
    margin-top:16px;
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:16px;
    padding:0 26px;
    width:100%;
  }
  .opt-btn{
    background:var(--card);
    border:4px solid #ffffff;
    border-radius:22px;
    padding:10px 6px 8px;
    cursor:pointer;
    display:flex;flex-direction:column;align-items:center;
    box-shadow:0 8px 0 #dcd6c4;
    transition:transform .08s ease, box-shadow .08s ease;
    min-height:220px;
    justify-content:center;
  }
  .opt-btn .icon-box{width:100%;max-width:170px;height:180px;}
  .opt-btn:active{transform:translateY(6px);box-shadow:0 2px 0 #dcd6c4;}
  .opt-btn.wrong{
    background:#FFEFEF;border-color:var(--ng);
    box-shadow:0 8px 0 var(--ng-dark);
    animation:shake .4s ease;
  }
  @keyframes shake{0%,100%{transform:translateX(0);}25%{transform:translateX(-8px);}75%{transform:translateX(8px);}}

  #screen-result h2{font-size:38px;color:var(--text);margin:0 0 6px;text-shadow:2px 2px 0 #fff;}
  .stars{display:flex;gap:10px;margin:12px 0 6px;}
  .stars svg{width:52px;height:52px;}
  .score-text{font-size:26px;color:var(--text);font-weight:700;margin-bottom:22px;background:#ffffffcc;padding:6px 20px;border-radius:20px;}
  .result-btns{display:flex;gap:24px;}
  #retry-btn{background:linear-gradient(180deg,var(--accent2),var(--accent2-dark));}
  #home-btn{background:linear-gradient(180deg,var(--purple),var(--purple-dark));}
  .result-btns .big-btn{font-size:22px;padding:16px 40px;}

  .icon-box img{width:100%;height:100%;display:block;object-fit:contain;}

.container { position: relative; overflow: hidden; color: var(--text); background: linear-gradient(180deg,var(--sky1) 0%,var(--sky2) 55%,var(--grass1) 55%,var(--grass2) 100%); }
.game-main { min-height: 0; background: transparent; }
.game-header { position: relative; z-index: 10; background: transparent; padding: 5px 12px; justify-content: space-between; }
.game-header[hidden] { display: none; }
.info { width: auto; }
.info-box { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 40px; padding: 6px 16px; font-size: 18px; color: #444; box-shadow: 0 2px 0 #e8a000; }
.info-box .val { font-size: 22px; color: #ff6f3c; min-width: 24px; text-align: center; }
.header-center { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; }
.header-center h1 { margin: 0; font-size: 20px; line-height: 22px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
button { font-family: inherit; }
#quit-btn { padding: 7px 16px; height: 38px; font-size: 16px; box-shadow: 0 3px 0 #c23f3f; }
.sound-btn { height: 38px; border: 3px solid #f2b321; border-radius: 50px; padding: 4px 12px; font-size: 16px; font-weight: 700; background: #fff0ad; color: #694100; box-shadow: 0 3px 0 #d89500; min-width: 104px; cursor: pointer; letter-spacing: 1px; }
.sound-btn:hover { background: #ffe680; border-color: #dc9700; color: #5a3500; }
.sound-btn.sound-off { background: #e9edf1; border-color: #aeb7c0; color: #66717b; box-shadow: 0 3px 0 #929ba4; }
.top-sound { position: absolute; top: 8px; right: 12px; z-index: 20; }
[hidden] { display: none !important; }
.dots { padding: 0; background: transparent; gap: 6px; justify-content: center; margin-top: 3px; }
.dot { width: 12px; height: 12px; background: #ddd; border: 0; transition: background .3s; }
.dot.done { background: #6ecb63; }
.dot.now { background: #f9a825; border: 2px solid #c77c00; box-shadow: none; }
#screen-game { padding-top: 24px; }
.screen { text-align: center; }
.options { max-width: 1000px; }
.overlay { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: #281e1447; opacity: 0; pointer-events: none; }
.overlay.show { opacity: 1; pointer-events: auto; }
.overlay > div { padding: 25px 45px; border-radius: 30px; background: white; box-shadow: 0 14px 25px #0004; }
.overlay strong { display: block; font-size: 39px; }
.overlay p { font-size: 20px; font-weight: 800; }
.overlay.ok strong { color: #2fb768; }
.overlay.ng strong { color: #d9534f; }
.arrow-icon { width: 34px; height: 18px; background: var(--accent-dark); clip-path: polygon(0 35%,60% 35%,60% 0,100% 50%,60% 100%,60% 65%,0 65%); }
button:focus-visible { outline: 3px solid #9464f0; outline-offset: 4px; }
@media (max-width: 650px) {
 .game-header { padding: 5px 6px; }
 .header-center h1 { font-size: 14px; }
 .info-box { padding: 6px 8px; font-size: 12px; gap: 3px; }
 .info-box .val { font-size: 18px; min-width: 16px; }
 .header-actions { gap: 5px; }
 #quit-btn { font-size: 12px; padding: 5px 8px; }
 .sound-btn { min-width: 68px; padding: 4px 5px; font-size: 12px; }
 #screen-title h1 { font-size: 34px; }
 .question-area { gap: 12px; }
 .qcard { padding: 12px; }
 .qcard .label { font-size: 17px; }
 .qtext { font-size: 18px; padding: 10px; }
 .options { gap: 8px; padding: 0 10px; }
 .opt-btn { min-height: 200px; }
 .opt-btn .icon-box { height: 160px; }
 .result-btns { gap: 12px; }
 .result-btns .big-btn { font-size: 17px; padding: 15px 20px; }
 .score-text { font-size: 22px; }
}
@media (max-width: 380px) {
 .header-center h1 { font-size: 12px; }

 .qcard .icon-box { width: 90px; height: 90px; }
 .qtext { font-size: 16px; }

}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.overlay .reunion-panel { width: min(520px, calc(100% - 24px)); padding: 24px 18px; }
.reunion-pair { display: flex; justify-content: center; gap: 20px; }
.reunion-card { width: 170px; padding: 12px 8px; border-radius: 24px; background: var(--card); box-shadow: 0 6px 0 #e3d9c0; }
.reunion-card .icon-box { width: 120px; height: 120px; margin: auto; }
.reunion-card .label { color: var(--text); font-size: 20px; font-weight: 700; }
.reunion-card.arriving { animation: reunion-arrive var(--travel-time) ease-in-out both; }
@keyframes reunion-arrive {
 from { transform: translate(var(--from-x), var(--from-y)) scale(var(--from-scale)); }
 to { transform: translate(0, 0) scale(1); }
}
.moving-source, .answering .qtext { visibility: hidden; }
.answer-message { min-height: 106px; padding-top: 20px; }
.answer-message p { margin: 10px 0 0; line-height: 1.6; }
.overlay.gathering .reunion-panel { background: transparent; box-shadow: none; }
.overlay.ok .reunion-card { background: #efffe6; }
#screen-title h1 { font-size: clamp(26px, 4.5vw, 46px); letter-spacing: 1px; }
@media (max-width: 650px) {
 .header-center { max-width: calc(100% - 245px); }
 .header-center h1 { font-size: 12px; line-height: 14px; }
 .qtext { max-width: 190px; }
 .reunion-pair { gap: 12px; }
 .reunion-card { width: 140px; }
 .reunion-card .icon-box { width: 100px; height: 100px; }
 .reunion-card .label { font-size: 16px; }
 .answer-message p { font-size: 18px; }
}

.confetti-layer { position: absolute; inset: 0; z-index: 50; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -20px; width: 10px; height: 15px; border-radius: 2px; animation: confetti-fall 1.6s linear both; }
@keyframes confetti-fall {
 0% { transform: translate3d(0,0,0) rotate(0deg); opacity: 0; }
 10% { opacity: 1; }
 80% { opacity: 1; }
 100% { transform: translate3d(var(--drift),var(--fall),0) rotate(var(--spin)); opacity: 0; }
}

#feedback { background: transparent; align-items: flex-start; padding-top: 24px; }
#feedback .reunion-panel { position: relative; padding: 6px 18px; background: transparent; box-shadow: none; }
#feedback .answer-message { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); min-height: 0; padding: 8px 20px; border-radius: 20px; background: #fff; box-shadow: 0 4px 12px #0002; }
#feedback .answer-message strong { font-size: 28px; }
#feedback .answer-message p { margin: 3px 0 0; }
#feedback.gathering .answer-message { visibility: hidden; }
