/* Koi-Koi — original styling. Soft felt table, modern hanafuda cards. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP",
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #43302a; min-height: 100vh; overflow-x: hidden; background: #f3e7d3;
}
button { font: inherit; cursor: pointer; }
#bg { position: fixed; inset: 0; background: url("assets/bg.webp") center/cover no-repeat; opacity: .4; z-index: 0; }
#btn-sound, #btn-lang {
  position: fixed; top: 10px; z-index: 60;
  background: rgba(255,252,247,.94); color: #7a4a21; border: 2px solid #d9a05b;
  border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 14px; min-height: 44px;
}
#btn-sound { right: 10px; }
#btn-lang { right: 158px; }
.wrap { position: relative; z-index: 5; max-width: 560px; margin: 0 auto; padding: 58px 12px 44px; }
.title-block { text-align: center; margin-bottom: 10px; }
.kicker { margin: 0; font-size: 13px; letter-spacing: .3em; font-weight: 800; color: #a05c2c; }
.title-block h1 { margin: 4px 0 0; font-size: 31px; color: #5b3a29; text-shadow: 0 2px 0 rgba(255,255,255,.7); }
.subtitle { margin: 2px 0 0; font-weight: 700; color: #8a5a33; }
.panel {
  background: rgba(255,252,247,.94); border: 2px solid #ecd9bd; border-radius: 22px;
  padding: 16px 14px 18px; box-shadow: 0 16px 36px rgba(122,74,33,.18);
  animation: fadeIn .3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel.center { text-align: center; }
.panel h2 { margin: 10px 0 6px; font-size: 20px; }
.label { font-weight: 800; color: #8a5a33; margin: 14px 0 6px; font-size: 14px; }
.note { font-size: 12.5px; color: #9b7c62; line-height: 1.6; }
.opp-row { display: flex; align-items: flex-end; gap: 10px; }
.opp-row.center-row { align-items: center; }
.char-slot { position: relative; flex: none; line-height: 0; }
.char-img { width: 92px; height: auto; animation: bob 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
.char-img.small { width: 64px; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.kitten-bounce { animation: bounceA .55s ease !important; }
@keyframes bounceA { 30% { transform: translateY(-14px) scale(1.04); } 60% { transform: translateY(0); } }
.kitten-shake { animation: shakeA .45s ease !important; }
@keyframes shakeA { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.accent { position: absolute; font-size: 19px; pointer-events: none; animation: floatUp 1.1s ease-out forwards; text-shadow: 0 2px 6px rgba(255,255,255,.8); }
@keyframes floatUp { from { opacity: 0; transform: translateY(6px) scale(.6); } 25% { opacity: 1; } to { opacity: 0; transform: translateY(-40px) scale(1.15); } }
.bubble {
  position: relative; background: #fff; border: 2px solid #e8cf9f; border-radius: 14px;
  padding: 10px 12px; font-size: 14.5px; line-height: 1.55; flex: 1; color: #5b4232; font-weight: 600;
}
.bubble::before { content: ""; position: absolute; left: -9px; bottom: 16px; border: 6px solid transparent; border-right-color: #e8cf9f; border-left: 0; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  flex: 1; min-height: 48px; border-radius: 999px; border: 2px solid #dcc19a;
  background: #fff; color: #7a5230; font-weight: 800; font-size: 14.5px; padding: 8px 6px;
}
.seg button.on { background: #f3b25c; border-color: #c97e1e; color: #572f00; }
.btn {
  border-radius: 999px; border: 2px solid #dcc19a; padding: 11px 18px;
  font-weight: 800; font-size: 15.5px; min-height: 50px; background: #fff; color: #7a5230;
}
.btn.big { font-size: 17.5px; min-height: 58px; width: 100%; margin-top: 18px; }
.btn.primary { background: #f3b25c; border-color: #c97e1e; color: #572f00; box-shadow: 0 4px 0 #c97e1e; }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #c97e1e; }
.btn.ghost { background: transparent; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1; }
.row.col { flex-direction: column; }
.score-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.score-chip { background: #fff; border: 2px solid #e8cf9f; border-radius: 999px; padding: 4px 11px; font-weight: 800; font-size: 13.5px; color: #7a5230; }
.deck-chip { background: #7a9a52; border-color: #5d7f3a; color: #fff; }
.caps-label, .field-label { font-weight: 800; font-size: 13.5px; color: #8a5a33; margin: 10px 0 4px; }
.yaku-line { color: #b3541e; font-size: 12.5px; }
.caps { display: flex; flex-wrap: wrap; gap: 3px; min-height: 44px; background: rgba(122,154,82,.16); border-radius: 10px; padding: 4px; }
.field {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  background: #6d8f57; border: 3px solid #55703f; border-radius: 14px; padding: 8px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,.25); min-height: 96px;
}
.hand { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 84px; }
.card {
  border-radius: 6px; overflow: hidden; line-height: 0; flex: none;
  box-shadow: 0 2px 5px rgba(0,0,0,.3); 
  border: 1px solid #c9b99a; background: #fff8ee; padding: 0;
}
.card svg { display: block; width: 100%; height: 100%; }
.field .card { width: 100%; aspect-ratio: 0.606; }
.caps .card { width: 34px; aspect-ratio: 0.606; }
.hand .card { width: 52px; aspect-ratio: 0.606; cursor: pointer; transition: transform .12s ease; }
.hand .card:hover, .hand .card.sel { transform: translateY(-8px); outline: 3px solid #ffb703; }
.field .card.pickable { outline: 3px solid #ffb703; cursor: pointer; animation: pulse 1s ease-in-out infinite; }
.field .card.just { outline: 3px solid #ff8ab0; }
@keyframes pulse { 50% { outline-offset: 2px; } }
.card.back { background: #b03a2e; }
.status { min-height: 24px; text-align: center; font-weight: 700; color: #8a5a33; margin: 10px 0 0; font-size: 14px; }
.result-detail { font-size: 15.5px; font-weight: 700; color: #5b3a29; line-height: 1.7; white-space: pre-line; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(59,36,16,.55); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal-backdrop[hidden] { display: none; }
.modal-card { background: #fffcf7; border: 2px solid #ecd9bd; border-radius: 18px; padding: 20px 18px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,.3); }
.modal-card h3 { margin: 0 0 8px; font-size: 20px; }
.modal-card p { margin: 0; line-height: 1.6; font-weight: 600; color: #5b4232; white-space: pre-line; }
@media (max-width: 360px) {
  .field { grid-template-columns: repeat(4, 1fr); }
  .hand .card { width: 44px; }
  .title-block h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { .char-img, .field .card.pickable { animation: none; } }

.video-banner { width: 100%; height: 180px; object-fit: cover; border-radius: 14px; display: block; margin-bottom: 10px; background: #2e2a26; }

/* --- Large play area: use the full smartphone width --- */
.wrap { padding-left: 5px; padding-right: 5px; }
.panel { padding-left: 7px; padding-right: 7px; }
.hand .card { width: clamp(52px, 16.5vw, 68px); }
.caps .card { width: clamp(32px, 10vw, 42px); }
.video-banner { height: 200px; }
@media (max-width: 360px) { .hand .card { width: 15.5vw; } }
