* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation; /*タブレット連打時の拡大防止 */
  -webkit-tap-highlight-color: transparent;
}
html { margin: 0; height: 100%; }
body {
  margin: 0;
  height: 100vh;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Sans",
    "Yu Gothic",
    "Meiryo",
    sans-serif;
  background: linear-gradient(160deg,#dff6ff 0%,#f5e6ff 50%,#ffe9f3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.container {
  width: 100%;
  max-width: 1196px;
  height: 540px;
  background: linear-gradient(135deg,#ffffff,#fef6ff);
  border: 2px solid #333;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.game-main {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
}
/* ---------- header ---------- */
  .game-header {
    height: 50px;
    flex: 0 0 50px;
    background: linear-gradient(90deg,#ff9ecb,#ffd07a);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    color: #ffffff;
    text-shadow: 0 2px 3px rgba(0,0,0,0.15);
  }
  .game-header .title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1px;
  }
  #progressLabel {
    font-size: 20px;
    font-weight: 700;
    background: rgba(255,255,255,0.35);
    padding: 4px 16px;
    border-radius: 20px;
  }
  .hidden { display: none !important; }

  #quitBtn {
    font-size: 18px;
    font-weight: 700;
    background: #ffffff;
    color: #ff6f91;
    border: none;
    border-radius: 20px;
    padding: 6px 20px;
    cursor: pointer;
    box-shadow: 0 4px 0 #e0a0b8;
    transition: transform .1s;
  }
  #quitBtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #e0a0b8; }

  /* ---------- screens ---------- */
  .screen {
    flex: 1;
    display: none;
    width: 100%;
    height: 100%;
  }
  .screen.active { display: flex; }

  /* ---------- start screen ---------- */
  #screen-start {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 18px;
    padding: 20px;
    background:
      radial-gradient(circle at 15% 20%, #fff6c0 0, transparent 12%),
      radial-gradient(circle at 85% 15%, #c0e8ff 0, transparent 14%),
      radial-gradient(circle at 50% 90%, #ffd6ec 0, transparent 20%);
  }
  #screen-start h1 {
    font-size: 46px;
    margin: 0;
    color: #6a4cff;
    text-shadow: 2px 2px 0 #ffe08a;
  }
  #screen-start p {
    font-size: 22px;
    color: #7a6a99;
    margin: 4px 0;
    line-height: 1.7;
  }
  .bigbtn {
    margin-top: 10px;
    font-size: 30px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(180deg,#ff9ecb,#ff6f91);
    border: none;
    border-radius: 40px;
    padding: 18px 60px;
    cursor: pointer;
    box-shadow: 0 8px 0 #d94f72;
    transition: transform .1s;
  }
  .bigbtn:active { transform: translateY(6px); box-shadow: 0 2px 0 #d94f72; }

  /* ---------- game screen ---------- */
  #screen-game {
    flex-direction: row;
    padding: 22px 28px;
    gap: 26px;
  }

  #canvasWrap {
    position: relative;
    width: 620px;
    height: 440px;
    flex: 0 0 620px;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    background: #000;
  }
  #canvasWrap canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
  }
  #artCanvas { z-index: 1; }
  #scratchCanvas { z-index: 2; cursor: pointer; }
  #fxCanvas { z-index: 3; pointer-events: none; }

  #instruction {
    position: absolute;
    bottom: 10px;
    left: 0; right: 0;
    text-align: center;
    color: rgba(255,255,255,0.85);
    font-size: 18px;
    font-weight: 700;
    z-index: 4;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  }

  #rightPanel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
  }

  #question {
    font-size: 24px;
    font-weight: 700;
    color: #7a5cff;
    margin-bottom: 4px;
    text-align: center;
  }

  #choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    width: 100%;
    max-width: 420px;
  }

  .choiceBtn {
    font-size: 56px;
    font-weight: 700;
    color: #4b3b6b;
    background: linear-gradient(180deg,#ffffff,#f1e9ff);
    border: none;
    border-radius: 22px;
    padding: 18px 0;
    cursor: pointer;
    box-shadow: 0 6px 0 #cbb8ec;
    transition: transform .08s;
  }
  .choiceBtn:nth-child(1){ background: linear-gradient(180deg,#fff,#ffe3ea); box-shadow: 0 6px 0 #ffb8c9;}
  .choiceBtn:nth-child(2){ background: linear-gradient(180deg,#fff,#e3f7ff); box-shadow: 0 6px 0 #a9dcf5;}
  .choiceBtn:nth-child(3){ background: linear-gradient(180deg,#fff,#fff6d9); box-shadow: 0 6px 0 #f3da8c;}
  .choiceBtn:nth-child(4){ background: linear-gradient(180deg,#fff,#e6ffe9); box-shadow: 0 6px 0 #a9e6b6;}
  .choiceBtn:active { transform: translateY(5px); }
  .choiceBtn:disabled { opacity: 0.6; cursor: default; }

  .choiceBtn.correct {
    background: linear-gradient(180deg,#baf7c4,#7fe89a) !important;
    box-shadow: 0 6px 0 #4fbf6c !important;
    animation: pop .4s ease;
  }
  .choiceBtn.wrong {
    animation: shake .4s ease;
    background: linear-gradient(180deg,#ffc9c9,#ff9b9b) !important;
    box-shadow: 0 6px 0 #e35d5d !important;
  }

  @keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
  }
  @keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
  }

  #feedback {
    min-height: 34px;
    font-size: 26px;
    font-weight: 700;
    text-align: center;
  }
  #feedback.good { color: #34b352; }
  #feedback.bad { color: #ff6f6f; }

  /* ---------- end screen ---------- */
  #screen-end {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
    background:
      radial-gradient(circle at 20% 30%, #fff6c0 0, transparent 15%),
      radial-gradient(circle at 80% 70%, #c0e8ff 0, transparent 18%);
  }
  #screen-end h2 {
    font-size: 42px;
    color: #6a4cff;
    margin: 0;
  }
  #resultText {
    font-size: 28px;
    color: #7a6a99;
    font-weight: 700;
  }
  #endButtons {
    display: flex;
    gap: 20px;
    margin-top: 10px;
  }
  .smallbtn {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 14px 36px;
    cursor: pointer;
    transition: transform .1s;
  }
  #retryBtn { background: linear-gradient(180deg,#8fd6ff,#5cb6ff); box-shadow: 0 6px 0 #3a8fd4; }
  #toTitleBtn { background: linear-gradient(180deg,#ffb3d1,#ff86b3); box-shadow: 0 6px 0 #d95c8c; }
  .smallbtn:active { transform: translateY(4px); }


.deco { display:flex; align-items:center; gap:30px; height:38px; }
.deco i { width:10px; height:10px; border-radius:50%; background:#ffd23f; box-shadow:0 -16px #ff5e7e,0 16px #54a0ff,16px 0 #7bed9f,-16px 0 #ff9ff3,11px 11px #feca57,-11px -11px #a29bfe; }
.deco i:nth-child(2) { transform:scale(.75); }
.deco i:nth-child(3) { transform:scale(1.1); }
