/* ===== PIRATE TYCOON — ธีมโจรสลัด × CI เติมเกมออนไลน์.com (กรมท่า/ดำ + ฟ้านีออน + สายฟ้า + ทอง) ===== */
:root {
  --k-sword: #e2e8f0; --k-compass: #3b82f6; --k-parrot: #22c55e; --k-powder: #ef4444; --k-gem: #a855f7; --k-gold: #fbbf24;
  --sea: #2b7fff; --sea-l: #60a5fa; --treasure: #fbbf24;
}
.k-sword { --k: var(--k-sword); --kt: #0f172a; } .k-compass { --k: var(--k-compass); --kt: #fff; } .k-parrot { --k: var(--k-parrot); --kt: #04130a; }
.k-powder { --k: var(--k-powder); --kt: #fff; } .k-gem { --k: var(--k-gem); --kt: #fff; } .k-gold { --k: var(--k-gold); --kt: #1f1405; }
.em { width: 1.15em; height: 1.15em; vertical-align: -0.2em; display: inline-block; pointer-events: none; user-select: none; }
.em.xs { width: 1em; height: 1em; }

/* ===== ฉากทะเล ===== */
#ty { background: #02040c; overflow: hidden; }
.ty-scene { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: radial-gradient(ellipse at 50% 108%, rgba(43, 127, 255, 0.35), transparent 55%), linear-gradient(180deg, #02040c 0%, #071230 45%, #0b1a3a 70%, #06122b 100%); }
.ty-scene .stars { position: absolute; inset: 0 0 40% 0; background-image: radial-gradient(1.4px 1.4px at 30px 40px, #fff, transparent), radial-gradient(1px 1px at 140px 90px, #bfdbfe, transparent), radial-gradient(1.2px 1.2px at 250px 30px, #fff, transparent), radial-gradient(1px 1px at 330px 140px, #e0e7ff, transparent), radial-gradient(1.5px 1.5px at 420px 70px, #fff, transparent); background-size: 460px 200px; animation: twinkle 4s ease-in-out infinite alternate; opacity: 0.8; }
.ty-scene .moon { position: absolute; top: 7%; right: 8%; width: clamp(54px, 12vw, 96px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 38% 36%, #f8fafc, #cbd5e1 55%, #94a3b8); box-shadow: 0 0 70px 24px rgba(96, 165, 250, 0.35); opacity: 0.85; }
.ty-scene .ship { position: absolute; bottom: 17%; left: 6%; width: clamp(60px, 15vw, 120px); opacity: 0.35; filter: brightness(0) drop-shadow(0 0 10px rgba(96, 165, 250, 0.8)); animation: ship-bob 6s ease-in-out infinite, ship-sail 70s linear infinite; }
.ty-scene .ship img { width: 100%; height: auto; }
.ty-scene .fog { position: absolute; left: -30%; right: -30%; bottom: 10%; height: 28%; background: radial-gradient(ellipse at 50% 100%, rgba(148, 163, 184, 0.16), transparent 70%); animation: fog 22s linear infinite alternate; }
/* คลื่น 3 ชั้น — ขอบคลื่นเรืองแสงฟ้า (CI) */
.ty-scene .wave { position: absolute; left: 0; right: 0; bottom: 0; height: 120px; background-repeat: repeat-x; background-size: 600px 120px; animation: wave-x 14s linear infinite; }
.ty-scene .wave.w1 { bottom: 0; opacity: 0.9; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='120'%3E%3Cpath d='M0 60 Q75 30 150 60 T300 60 T450 60 T600 60 V120 H0Z' fill='%23061433'/%3E%3Cpath d='M0 60 Q75 30 150 60 T300 60 T450 60 T600 60' fill='none' stroke='%232b7fff' stroke-width='2.5' stroke-opacity='.85'/%3E%3C/svg%3E"); }
.ty-scene .wave.w2 { bottom: 26px; opacity: 0.55; animation-duration: 22s; animation-direction: reverse; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='120'%3E%3Cpath d='M0 64 Q100 36 200 64 T400 64 T600 64 V120 H0Z' fill='%23081c45'/%3E%3Cpath d='M0 64 Q100 36 200 64 T400 64 T600 64' fill='none' stroke='%2360a5fa' stroke-width='2' stroke-opacity='.6'/%3E%3C/svg%3E"); }
.ty-scene .wave.w3 { bottom: 52px; opacity: 0.35; animation-duration: 34s; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='120'%3E%3Cpath d='M0 70 Q150 48 300 70 T600 70 V120 H0Z' fill='%230b2357'/%3E%3Cpath d='M0 70 Q150 48 300 70 T600 70' fill='none' stroke='%2393c5fd' stroke-width='1.5' stroke-opacity='.5'/%3E%3C/svg%3E"); }
.ty-scene .flash { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at 70% 10%, rgba(191, 219, 254, 0.55), rgba(43, 127, 255, 0.12) 40%, transparent 70%); }
.ty-scene .flash::after { content: ""; position: absolute; top: 0; right: 24%; width: 46px; height: 42%; opacity: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 300' preserveAspectRatio='none'%3E%3Cpath d='M60 0 30 130h22L35 300 80 110H55L75 0z' fill='%23fff'/%3E%3C/svg%3E") center / 100% 100% no-repeat; filter: drop-shadow(0 0 12px #60a5fa) drop-shadow(0 0 30px #2b7fff); }
.ty-scene .flash.on { animation: sky-flash 0.9s ease-out; }
.ty-scene .flash.on::after { animation: bolt-flash 0.9s ease-out; }
.ty-scene .rain { position: absolute; inset: -20% 0 0 0; opacity: 0; background-image: repeating-linear-gradient(105deg, transparent 0 14px, rgba(147, 197, 253, 0.28) 14px 15px); background-size: 120px 120px; transition: opacity 1.5s; }
body.ty-storm .ty-scene .rain { opacity: 1; animation: rain 0.45s linear infinite; }
body.ty-storm .ty-scene { background: radial-gradient(ellipse at 50% 108%, rgba(239, 68, 68, 0.22), transparent 55%), linear-gradient(180deg, #050208 0%, #1a0b1e 45%, #10142e 100%); }
body.ty-storm .ty-scene .moon { opacity: 0.2; }
@keyframes wave-x { to { background-position-x: 600px; } }
@keyframes ship-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes ship-sail { from { left: -15%; } to { left: 110%; } }
@keyframes sky-flash { 0% { opacity: 0; } 8% { opacity: 1; } 16% { opacity: 0.2; } 24% { opacity: 0.9; } 100% { opacity: 0; } }
@keyframes bolt-flash { 0%, 100% { opacity: 0; } 8%, 26% { opacity: 1; } 14% { opacity: 0.2; } 40% { opacity: 0; } }
@keyframes rain { to { background-position: -30px 120px; } }
body.fx-lite .ty-scene .wave, body.fx-lite .ty-scene .ship, body.fx-lite .ty-scene .fog, body.fx-lite .ty-scene .stars, body.fx-lite .ty-scene .rain { animation: none !important; }

#ty .topbar { z-index: 6; }
#ty .topbar .title { background: linear-gradient(180deg, #fff, #fde68a 60%, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ty-lobby, .ty-game { position: relative; z-index: 2; }
.ty-lobby { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 10px 16px 24px; gap: 14px; }
.ty-game { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ty-main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 6px 10px 8px; display: flex; flex-direction: column; gap: 8px; align-items: center; scrollbar-width: none; }
.btn-gold { background: linear-gradient(135deg, #f59e0b, #fbbf24 50%, #fde68a); color: #1c1405; border: 0; font-weight: 800; box-shadow: 0 8px 24px -8px rgba(251, 191, 36, 0.85), inset 0 -2px 0 rgba(0, 0, 0, 0.2); }
.money { color: #fde68a; font-weight: 700; }
.money.big { font-family: 'Kanit'; font-size: 20px; }
.money small { font-size: 12px; color: var(--muted); }
.bty { display: inline-block; transition: transform 0.2s; }
.bty.rolling { transform: scale(1.35); color: #fff; text-shadow: 0 0 12px #fbbf24; }
.bty-pop { position: absolute; top: -6px; left: 40px; z-index: 5; font-family: 'Kanit'; font-weight: 800; font-size: 20px; color: #fde68a; text-shadow: 0 0 12px #f59e0b, 0 2px 0 #000; pointer-events: none; animation: bty-pop 1.5s ease-out forwards; }
@keyframes bty-pop { 0% { transform: translateY(10px) scale(0.6); opacity: 0; } 20% { transform: translateY(-6px) scale(1.2); opacity: 1; } 100% { transform: translateY(-34px) scale(1); opacity: 0; } }

/* ===== เหรียญ ===== */
.coin { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-style: normal;
  background: radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--k) 45%, #fff), var(--k) 52%, color-mix(in srgb, var(--k) 55%, #000));
  box-shadow: 0 0 0 2px #fbbf24, 0 0 0 3.5px rgba(0, 0, 0, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.35); }
.coin.k-gold { box-shadow: 0 0 0 2px #fde68a, 0 0 0 3.5px rgba(0, 0, 0, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.28), 0 0 14px rgba(251, 191, 36, 0.7); }
.coin .em { width: 62%; height: 62%; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
.coin b { position: absolute; bottom: -4px; right: -6px; font-size: 11px; padding: 0 4px; border-radius: 99px; background: #0b1020; color: #fff; }
.coin.sm { width: 24px; height: 24px; vertical-align: middle; }
.coin.fly { width: 100%; height: auto; aspect-ratio: 1; box-shadow: 0 0 0 2px #fde68a, 0 0 20px var(--k), 0 0 32px rgba(251, 191, 36, 0.6); }
.ty-fly.spin .coin { animation: coin-spin 0.55s linear infinite; }
@keyframes coin-spin { 50% { transform: rotateY(80deg) scaleX(0.6); } }
.pip { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; font-style: normal; font-size: 11px; font-weight: 800; color: var(--kt); background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--k) 55%, #fff), var(--k) 60%); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.6); }
.pip.sq { border-radius: 5px; }

/* ===== การ์ด ===== */
.tc { position: relative; aspect-ratio: 0.76; width: 100%; border-radius: 11px; overflow: hidden; display: flex; flex-direction: column; padding: 5px; cursor: pointer; container-type: inline-size; isolation: isolate;
  background: linear-gradient(170deg, #10244f, #081430 70%); border: 2px solid #6b4423; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 18px -8px rgba(0, 0, 0, 0.9); transition: transform 0.18s, box-shadow 0.2s; }
.tc.b-sword { --k: var(--k-sword); } .tc.b-compass { --k: var(--k-compass); } .tc.b-parrot { --k: var(--k-parrot); } .tc.b-powder { --k: var(--k-powder); } .tc.b-gem { --k: var(--k-gem); }
.tc .tc-glow { position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--k) 45%, transparent), transparent 62%), repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 6px); }
.tc.t1 { border-color: #8b5a2b; }
.tc.t2 { border-color: #9ca3af; background: linear-gradient(170deg, #1d2a5a, #0b1336 70%); }
.tc.t3 { border-color: #fbbf24; background: linear-gradient(170deg, #3a2a0b, #120c03 75%); box-shadow: inset 0 0 0 1px rgba(253, 230, 138, 0.25), 0 0 16px -4px rgba(251, 191, 36, 0.6), 0 8px 18px -8px #000; }
.tc.t3::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.28) 50%, transparent 65%); background-size: 250% 100%; animation: shimmer 3.6s ease-in-out infinite; }
@keyframes shimmer { 0%, 55% { background-position: 150% 0; } 100% { background-position: -100% 0; } }
.tc-top { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 1; }
.tc .bounty { display: grid; place-items: center; min-width: clamp(18px, 30cqw, 30px); height: clamp(18px, 30cqw, 30px); padding: 0 3px; border-radius: 50%; font-family: 'Kanit'; font-weight: 800; font-size: clamp(11px, 20cqw, 19px); color: #1c1405; background: radial-gradient(circle at 35% 30%, #fff7d6, #fbbf24 55%, #b45309); box-shadow: 0 0 0 1.5px #78350f, 0 0 10px rgba(251, 191, 36, 0.7); }
.tc .bn { display: grid; place-items: center; width: clamp(18px, 28cqw, 28px); height: clamp(18px, 28cqw, 28px); border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--k) 45%, #fff), var(--k) 60%); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.55), 0 0 10px var(--k); }
.tc .bn .em { width: 66%; height: 66%; }
.tc-art { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; z-index: 1; }
.tc-art .em { width: clamp(22px, 46cqw, 52px); height: auto; aspect-ratio: 1; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.55)); }
.tc-title { position: relative; z-index: 1; font-family: 'Kanit'; font-weight: 600; letter-spacing: 0.2px; font-size: clamp(8px, 12.5cqw, 13px); text-align: center; line-height: 1.1; color: #f1f5f9; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.tc.t3 .tc-title { color: #fde68a; }
.tc-cost { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 2px; }
.tc-cost .pip { width: clamp(13px, 21cqw, 21px); height: clamp(13px, 21cqw, 21px); font-size: clamp(8px, 13cqw, 12px); }
.tc.back { justify-content: center; align-items: center; gap: 4px; background: repeating-linear-gradient(45deg, rgba(96, 165, 250, 0.08) 0 6px, transparent 6px 12px), radial-gradient(circle at 50% 40%, #1a4f9c, #071230 75%); border-color: #8b5a2b; }
.tc.back.t2 { background: repeating-linear-gradient(45deg, rgba(203, 213, 225, 0.08) 0 6px, transparent 6px 12px), radial-gradient(circle at 50% 40%, #334155, #0b1336 75%); border-color: #9ca3af; }
.tc.back.t3 { background: repeating-linear-gradient(45deg, rgba(251, 191, 36, 0.1) 0 6px, transparent 6px 12px), radial-gradient(circle at 50% 40%, #92400e, #1c1405 75%); border-color: #fbbf24; }
.tc.back .tc-art { flex: none; }
.tc.back .tc-art .em { width: clamp(22px, 44cqw, 50px); }
.tc.back .tc-title { color: #e2e8f0; font-size: clamp(8px, 13cqw, 13px); }
.tc.can { box-shadow: 0 0 0 2px #fbbf24, 0 0 22px 2px rgba(251, 191, 36, 0.75); animation: can-glow 1.5s ease-in-out infinite; }
.tc.can-later { box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.45); }
@keyframes can-glow { 50% { box-shadow: 0 0 0 2px #fde68a, 0 0 30px 6px rgba(251, 191, 36, 0.9); transform: translateY(-2px); } }
.tc:hover { transform: translateY(-3px); }
.tc.deal-in { animation: ty-deal 0.6s cubic-bezier(0.2, 1.2, 0.4, 1) backwards; }
@keyframes ty-deal { from { transform: translateY(-50px) rotateY(100deg) scale(0.6); opacity: 0; filter: brightness(2); } }
.tc.mini { width: 56px; flex: none; }
.tc.big { width: min(200px, 54vw); margin: 0 auto; cursor: default; animation: card-hover 3s ease-in-out infinite; }
.tc.hero { width: 92px; }
.tc.cine-card { width: clamp(150px, 40vw, 210px); }
@keyframes card-hover { 50% { transform: translateY(-6px) rotate(1deg); } }

/* ===== กระดาน ===== */
.ty-board { width: min(520px, 100%); display: flex; flex-direction: column; gap: 7px; }
.ty-tier { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 14px 5px 5px; border-radius: 14px; background: linear-gradient(180deg, rgba(7, 18, 48, 0.75), rgba(3, 8, 22, 0.75)); border: 1px solid rgba(96, 165, 250, 0.16); backdrop-filter: blur(3px); }
.ty-tier.t3 { border-color: rgba(251, 191, 36, 0.35); }
.tier-tag { position: absolute; top: -8px; left: 10px; z-index: 2; padding: 1px 9px; border-radius: 99px; font-family: 'Kanit'; font-size: 11px; letter-spacing: 1px; background: #0b1020; border: 1px solid rgba(96, 165, 250, 0.35); color: #93c5fd; }
.ty-tier.t3 .tier-tag { color: #fde68a; border-color: rgba(251, 191, 36, 0.5); }
.slot { position: relative; min-width: 0; perspective: 700px; }
.slot.empty, .deck.empty { border: 2px dashed rgba(148, 163, 184, 0.18); border-radius: 11px; aspect-ratio: 0.76; }
.slot .miss { position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); z-index: 3; font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 99px; background: #0b1020; border: 1px solid #f59e0b; color: #fcd34d; white-space: nowrap; pointer-events: none; }
.deck { position: relative; min-width: 0; padding: 0; background: none; border: 0; }
.deck .tc { box-shadow: 3px 3px 0 -1px rgba(255, 255, 255, 0.14), 6px 6px 0 -2px rgba(255, 255, 255, 0.07), 0 8px 18px -8px #000; }
.deck .cnt { position: absolute; bottom: 4px; right: 4px; z-index: 3; font-family: 'Kanit'; font-size: 12px; padding: 0 6px; border-radius: 99px; background: rgba(0, 0, 0, 0.65); }

/* ===== เกาะสมบัติ ===== */
.ty-isles { display: flex; gap: 6px; justify-content: center; width: min(520px, 100%); }
.isle { position: relative; flex: 1 1 0; min-width: 0; max-width: 118px; padding: 5px 6px 6px 34px; border-radius: 12px; cursor: pointer; overflow: hidden;
  background: radial-gradient(circle at 18% 50%, rgba(34, 197, 94, 0.25), transparent 45%), linear-gradient(160deg, #0c3b4f, #062033); border: 1.5px solid rgba(251, 191, 36, 0.55); box-shadow: 0 0 14px -5px rgba(251, 191, 36, 0.6); display: flex; flex-direction: column; gap: 3px; }
.isle-art { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); }
.isle-art .em { width: 26px; height: 26px; filter: drop-shadow(0 2px 3px #000); }
.isle-pts { position: absolute; top: 2px; right: 5px; font-family: 'Kanit'; font-weight: 800; font-size: 13px; color: #fde68a; text-shadow: 0 0 8px #f59e0b; }
.isle-name { font-family: 'Kanit'; font-size: 11px; line-height: 1.1; color: #e0f2fe; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 18px; }
.isle-need { display: flex; gap: 2px; }
.isle-need .pip { width: 17px; height: 17px; font-size: 10px; }
.isle.close { border-color: #fde68a; animation: can-glow 1.5s ease-in-out infinite; }
.isle.mini { flex: none; width: 120px; }
.isle.cine-isle { width: clamp(200px, 56vw, 280px); max-width: none; padding: 18px 16px 16px 84px; gap: 10px; animation: isle-rise 0.9s cubic-bezier(0.2, 1.3, 0.4, 1); }
.isle.cine-isle .isle-art .em { width: 64px; height: 64px; }
.isle.cine-isle .isle-name { font-size: 20px; }
.isle.cine-isle .isle-pts { font-size: 28px; }
.isle.cine-isle .pip { width: 30px; height: 30px; font-size: 16px; }
@keyframes isle-rise { from { transform: translateY(60px) scale(0.6); opacity: 0; } }

/* ===== หีบสมบัติ ===== */
.ty-bank { width: min(520px, 100%); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding: 8px 6px 6px; border-radius: 16px; background: linear-gradient(180deg, rgba(120, 72, 30, 0.45), rgba(60, 35, 12, 0.55)); border: 1.5px solid rgba(180, 120, 50, 0.55); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.06), 0 10px 24px -12px #000; }
.tpile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px 0; background: none; border: 0; transition: transform 0.15s; }
.tpile .stack { position: absolute; top: 2px; left: 50%; width: clamp(34px, 9.5vw, 44px); transform: translateX(-50%); }
.tpile .stack i { position: absolute; left: 0; width: 100%; aspect-ratio: 1; border-radius: 50%; top: calc(var(--i) * 3px + 3px); background: color-mix(in srgb, var(--k) 55%, #000); box-shadow: 0 0 0 1.5px #b45309, 0 0 0 3px rgba(0, 0, 0, 0.5); }
.tpile .face { width: clamp(34px, 9.5vw, 44px); height: auto; aspect-ratio: 1; z-index: 2; }
.tpile .n { font-family: 'Kanit'; font-size: 14px; margin-top: 8px; text-shadow: 0 1px 2px #000; }
.tpile .pk { position: absolute; top: -8px; right: 0; z-index: 3; padding: 0 6px; border-radius: 99px; background: #fbbf24; color: #1c1405; font-weight: 800; font-size: 12px; animation: pop 0.25s; }
.tpile.picked .face { transform: translateY(-6px) scale(1.08); box-shadow: 0 0 0 2px #fde68a, 0 0 22px var(--k); }
.tpile:disabled { opacity: 0.35; }
.tpile:not(.ro):not(:disabled):hover .face { transform: translateY(-4px); }
.tpile .face { transition: transform 0.18s cubic-bezier(0.2, 1.4, 0.4, 1); }

/* ===== ผู้เล่นอื่น ===== */
.ty-opps { display: flex; gap: 6px; padding: 8px 10px 2px; overflow-x: auto; scrollbar-width: none; flex: none; position: relative; z-index: 3; }
#ty .opp { position: relative; flex: 1 1 0; min-width: 136px; flex-direction: row; align-items: center; gap: 8px; padding: 6px 8px; text-align: left; color: inherit; font: inherit; background: linear-gradient(180deg, rgba(7, 18, 48, 0.85), rgba(3, 8, 22, 0.85)); }
#ty .opp .av { width: 40px; height: 40px; }
#ty .opp .info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#ty .opp .name { max-width: 100%; font-size: 12px; font-weight: 700; }
#ty .opp .stat { display: flex; gap: 8px; font-size: 12px; color: #cbd5e1; white-space: nowrap; align-items: center; }
#ty .opp .bonus { display: flex; gap: 2px; }
#ty .opp.turn { transform: none; border-color: #fbbf24; box-shadow: 0 0 0 2px #fbbf24, 0 0 22px -2px rgba(251, 191, 36, 0.8); --cur: #fbbf24; }
.first { color: #93c5fd; }
.dot { width: 15px; height: 15px; border-radius: 4px; font-size: 9px; font-style: normal; font-weight: 800; display: grid; place-items: center; color: var(--kt); background: var(--k); }
.dot:empty { opacity: 0.22; }
.solo { color: var(--muted); font-size: 13px; padding: 8px; }

/* ===== แถบตา / พายุ ===== */
.ty-turn { position: relative; z-index: 3; display: flex; align-items: center; gap: 8px; margin: 0 10px; padding: 6px 10px; border-radius: 14px; font-size: 13px; background: rgba(7, 18, 48, 0.92); border: 1px solid rgba(96, 165, 250, 0.3); }
.ty-turn .tt { flex: 1; }
.ty-turn .tt b { color: #fde68a; }
.ty-turn .wheel .em { width: 24px; height: 24px; animation: spin 8s linear infinite; }
.ty-turn.mine { background: linear-gradient(90deg, rgba(251, 191, 36, 0.28), rgba(43, 127, 255, 0.28)); border-color: #fbbf24; animation: banner-in 0.4s; }
.ty-turn.mine .wheel .em { animation-duration: 1.6s; }
.ty-turn.tray { padding: 5px 8px; }
.ty-turn .sel { display: flex; gap: 4px; }
.ty-turn .sel .coin { animation: pop 0.25s; }
.ty-turn .sel-hint { flex: 1; font-size: 12px; color: #fde68a; }
.ty-turn .btn { padding: 7px 12px; font-size: 14px; }
.ty-clock { min-width: 32px; padding: 2px 8px; border-radius: 99px; background: rgba(0, 0, 0, 0.45); font-family: 'Kanit'; text-align: center; }
.ty-clock.warn { background: #dc2626; animation: pulse 0.6s infinite; }
.ty-final { position: relative; z-index: 3; margin: 4px 10px 0; padding: 6px; border-radius: 12px; text-align: center; font-weight: 800; background: linear-gradient(90deg, #4c0519, #dc2626, #4c0519); background-size: 200% 100%; animation: ty-fire 2s linear infinite; box-shadow: 0 0 22px -4px #ef4444; }
@keyframes ty-fire { to { background-position: 200% 0; } }

/* ===== แผงของเรา (ท้องเรือ) ===== */
.ty-me { position: relative; z-index: 3; flex: none; margin: 6px 10px calc(8px + env(safe-area-inset-bottom)); padding: 8px 10px; border-radius: 18px; background: linear-gradient(180deg, rgba(92, 56, 22, 0.55), rgba(30, 18, 6, 0.85)), repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 16px); border: 1.5px solid rgba(180, 120, 50, 0.6); box-shadow: 0 -10px 30px -16px rgba(251, 191, 36, 0.4); }
.ty-me-head { position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ty-me-head .who { position: relative; }
.ty-me-head .av { width: 42px; height: 42px; }
.me-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.me-info .name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-tok, .me-sp { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.4); white-space: nowrap; }
.me-tok.warn { color: #fca5a5; box-shadow: 0 0 0 1px #ef4444; }
.ty-cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.cell { position: relative; display: flex; align-items: center; justify-content: center; gap: 3px; padding: 5px 2px; border-radius: 10px; background: color-mix(in srgb, var(--k) 14%, rgba(5, 8, 15, 0.7)); border: 1px solid color-mix(in srgb, var(--k) 45%, transparent); }
.cell > .em { width: 18px; height: 18px; }
.cell b { font-family: 'Kanit'; font-size: 15px; min-width: 17px; text-align: center; padding: 0 3px; border-radius: 5px; color: var(--kt); background: var(--k); }
.cell i { font-style: normal; font-weight: 700; font-size: 13px; color: #e2e8f0; }
.cell.k-gold i { font-size: 15px; color: #fde68a; }
.cell.hit { animation: cell-hit 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes cell-hit { 40% { transform: scale(1.18); box-shadow: 0 0 20px var(--k); } }
.ty-res { display: flex; align-items: center; gap: 6px; margin-top: 6px; overflow-x: auto; }
.ty-res > span { font-size: 12px; color: #fde68a; flex: none; }
.ty-res .tc.mini { width: 48px; }

/* ===== ล็อบบี้ ===== */
.ty-hero { position: relative; text-align: center; }
.hero-ship { width: 74px; margin: 0 auto -6px; animation: ship-bob 4s ease-in-out infinite; }
.hero-ship .em { width: 100%; height: auto; filter: drop-shadow(0 0 16px rgba(96, 165, 250, 0.7)); }
.ty-logo { display: flex; flex-direction: column; align-items: center; line-height: 0.9; font-family: 'Kanit'; font-weight: 800; }
.ty-logo span { font-size: clamp(18px, 5.5vw, 26px); letter-spacing: 10px; color: #93c5fd; text-shadow: 0 0 14px #2b7fff; }
.ty-logo b { font-size: clamp(46px, 14vw, 76px); background: linear-gradient(180deg, #fff, #fde68a 50%, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #78350f) drop-shadow(0 0 26px rgba(251, 191, 36, 0.55)); }
.ty-hero p { color: #cbd5e1; margin: 8px auto; max-width: 420px; font-size: 14px; }
.ty-hero p b { color: #fde68a; }
.ty-hero-cards { display: flex; justify-content: center; gap: 6px; margin-top: 4px; }
.tc.hero.h0 { transform: rotate(-10deg) translateY(10px); } .tc.hero.h2 { transform: rotate(10deg) translateY(10px); }
.ty-hero-cards .tc { animation: ty-deal 0.7s backwards; } .ty-hero-cards .h1 { animation-delay: 0.12s; } .ty-hero-cards .h2 { animation-delay: 0.24s; }
.ty-seats { grid-template-columns: repeat(4, minmax(0, 1fr)); width: min(420px, 100%); }
#ty .seat { background: linear-gradient(180deg, rgba(7, 18, 48, 0.8), rgba(3, 8, 22, 0.85)); }
#ty .settings { background: linear-gradient(180deg, rgba(7, 18, 48, 0.85), rgba(3, 8, 22, 0.9)); }

/* ===== โมดัล ===== */
.ty-sheet h3 { margin: 12px 0 6px; font-size: 15px; text-align: left; }
.ty-who { display: flex; align-items: center; gap: 12px; text-align: left; margin-bottom: 10px; }
.ty-who h2 { margin: 0; font-size: 20px; }
.ty-who .av { width: 56px; height: 56px; }
.ty-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ty-big { margin: 4px 0 10px; }
.ty-acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pay { font-weight: 700; padding: 8px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.pay.ok { background: rgba(251, 191, 36, 0.14); color: #fde68a; }
.pay.no { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
.ret { display: flex; flex-direction: column; gap: 6px; }
.ret-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: color-mix(in srgb, var(--k) 14%, rgba(5, 8, 15, 0.6)); border: 1px solid color-mix(in srgb, var(--k) 40%, transparent); }
.ret-row .nm { flex: 1; text-align: left; font-weight: 600; }
.ret-row .have { color: var(--muted); font-size: 12px; }
.ret-row .btn { padding: 4px 12px; }
.ret-row b { min-width: 20px; font-family: 'Kanit'; font-size: 18px; }
.ty-legend { display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: center; font-size: 13px; margin: 6px 0; }
.ty-legend span { display: inline-flex; align-items: center; gap: 4px; }
.ty-howto .row { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.ty-end h2 { background: linear-gradient(180deg, #fff, #fde68a 55%, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ===== ของที่บิน / ฝนเหรียญ ===== */
.ty-fly { position: fixed; z-index: 66; pointer-events: none; will-change: transform; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.6)); perspective: 400px; }
.ty-fly .tc.fly-card { width: 100%; }
.coin-rain { position: fixed; inset: 0; z-index: 84; pointer-events: none; overflow: hidden; }
.coin-rain span { position: absolute; top: -60px; width: calc(34px * var(--s)); animation: coin-fall linear forwards; filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.8)); }
.coin-rain .em { width: 100%; height: auto; }
@keyframes coin-fall { to { transform: translateY(115vh) rotate(720deg); } }

/* ===== picker ===== */
.game-card.ty { background: radial-gradient(circle at 80% 10%, rgba(251, 191, 36, 0.45), transparent 50%), radial-gradient(circle at 10% 100%, rgba(43, 127, 255, 0.4), transparent 50%), linear-gradient(160deg, #071230, #02040c); }
.game-card .gi .em { width: 64px; height: 64px; }

/* ===== จอกว้าง ===== */
@media (min-width: 900px) {
  .ty-game { display: grid; grid-template-columns: 270px 1fr; grid-template-rows: auto 1fr auto auto; }
  .ty-opps { grid-row: 1 / 5; grid-column: 1; flex-direction: column; overflow-y: auto; padding: 10px; }
  #ty .opp { flex: none; }
  .ty-final, .ty-main, .ty-turn, .ty-me { grid-column: 2; }
  .ty-final { grid-row: 1; } .ty-main { grid-row: 2; } .ty-turn { grid-row: 3; } .ty-me { grid-row: 4; }
  .ty-board, .ty-isles, .ty-bank { width: min(600px, 100%); }
  .ty-turn, .ty-me { width: min(600px, calc(100% - 20px)); justify-self: center; }
}
@media (max-height: 720px) { .tc-title { display: none; } }

/* ===== ปรับ layout มือถือ ===== */
html, body { overflow: hidden; }
body:has(#ty:not(.hidden)) .toast-wrap { top: auto; bottom: 200px; }
.tc { aspect-ratio: 0.84; }
.slot.empty, .deck.empty { aspect-ratio: 0.84; }
.ty-tier { padding-top: 11px; }
.ty-bank { flex: none; position: relative; z-index: 3; margin: 2px auto 6px; width: min(520px, calc(100% - 20px)); }
.isle { padding: 4px 5px 5px; align-items: stretch; }
.isle-head { display: flex; justify-content: space-between; align-items: center; }
.isle-art { position: static; transform: none; }
.isle-art .em { width: 20px; height: 20px; }
.isle-pts { position: static; }
.isle-name { padding-right: 0; font-size: 10.5px; }
.isle.cine-isle { padding: 16px; }
.isle.cine-isle .isle-art .em { width: 64px; height: 64px; }
@media (min-width: 900px) {
  .ty-game { grid-template-rows: auto 1fr auto auto auto; }
  .ty-opps { grid-row: 1 / 6; }
  .ty-main { grid-row: 2; } .ty-bank { grid-column: 2; grid-row: 3; } .ty-turn { grid-row: 4; } .ty-me { grid-row: 5; }
  .ty-bank { width: min(600px, calc(100% - 20px)); }
}
@media (min-width: 900px) {
  .ty-game { grid-template-columns: 300px 1fr; grid-template-rows: auto 1fr auto auto; }
  .ty-opps { grid-column: 1; grid-row: 1 / 3; }
  .ty-me { grid-column: 1; grid-row: 3 / 5; width: auto; align-self: end; margin: 6px 10px 10px; }
  .ty-me .ty-cells { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ty-final { grid-column: 2; grid-row: 1; } .ty-main { grid-column: 2; grid-row: 2; } .ty-bank { grid-column: 2; grid-row: 3; } .ty-turn { grid-column: 2; grid-row: 4; margin-bottom: 10px; }
  .ty-board, .ty-isles { width: min(640px, 100%, calc((100vh - 300px) * 1.45)); }
  .ty-bank, .ty-turn { width: min(640px, calc(100% - 20px)); justify-self: center; }
}
/* การ์ดที่จอง: แถวเดียวกับชื่อ (ประหยัดความสูง) */
.ty-me-head .ty-res { margin: 0; gap: 4px; flex: none; }
.ty-me-head .ty-res .tc.mini { width: 40px; padding: 3px; }
.ty-me-head .ty-res .tc.mini .tc-title, .ty-me-head .ty-res .tc.mini .tc-cost { display: none; }
.ty-me-head .ty-res .tc.mini .tc-top .bn { display: none; }
.ty-me-head .me-info { min-width: 70px; }
@media (max-width: 420px) { .me-tok { padding: 4px 6px; } }
@media (min-width: 900px) {
  .ty-me { grid-row: 2 / 5; }
  .ty-opps { grid-row: 1 / 2; max-height: 50vh; }
}
@media (min-width: 900px) {
  .ty-opps { grid-row: 1 / 5; align-self: start; max-height: 52vh; }
  .ty-me { grid-row: 1 / 5; align-self: end; }
}
@media (min-width: 900px) {
  .ty-board, .ty-isles { width: min(640px, 100%, calc((100vh - 380px) * 1.4 + 30px)); }
}
/* artwork วาดเอง: ใหญ่กว่าอีโมจิ (ภาพมีขอบว่างในตัว) */
.tc-art .em.art { width: clamp(34px, 72cqw, 96px); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.55)); }
.tc.back .tc-art .em.art { width: clamp(30px, 62cqw, 80px); }
.coin .em.art { width: 92%; height: 92%; }
.tc .bn .em.art { width: 90%; height: 90%; }
.cell > .em.art { width: 24px; height: 24px; }
.isle-art .em.art { width: 34px; height: 34px; margin: -6px 0 -4px -4px; }
.ty-turn .wheel .em.art { width: 26px; height: 26px; }
.hero-ship .em.art { width: 120%; margin-left: -10%; }
/* การ์ดในฉากพิเศษ: ขนาดตายตัว (ไม่พึ่ง container query) */
.cine-card .tc { width: 190px; height: 226px; aspect-ratio: auto; container-type: normal; }
.cine-card .tc .tc-art .em { width: 116px; }
.cine-card .tc .bounty { min-width: 36px; height: 36px; font-size: 22px; }
.cine-card .tc .bn { width: 32px; height: 32px; }
.cine-card .tc .tc-title { font-size: 16px; }
.cine-card .tc .pip { width: 24px; height: 24px; font-size: 13px; }
