* {box-sizing: border-box;margin: 0;padding: 0;}
body { overflow-y: auto; scrollbar-width: none; background: radial-gradient(circle, #2c3e50 0%, #0f171e 100%); color: #9395f3; font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
html { min-height: 100%; scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }
#game-container { background: rgba(24, 44, 65, 0.85); padding: 10px; border-radius: 16px; box-shadow: 0 15px 35px rgba(11, 11, 12, 0.849); text-align: center; max-width: 920px; width: 100%; backdrop-filter: blur(5px); }
h1 { margin: 0; padding: 10px; font-family: "Yu Gothic", "Meiryo", sans-serif; font-size: 30px; font-weight: 900; letter-spacing: 4px; text-align: center; color: #f5d58a; background: linear-gradient(180deg, #fff2c2 0%, #e5bd65 35%, #b77b27 65%, #f3d58b 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; text-shadow: 0 2px 2px rgba(0, 0, 0, 0.5), 0 4px 5px rgba(0, 0, 0, 0.493), 0 0 12px rgba(218, 164, 65, 0.37); }
#status-bar { font-size: 17px; font-weight: bold; margin-bottom: 8px; background: #1a252f; padding: 10px; border-radius: 8px; border: 1px solid #34495e; }
#message-area { min-height: 28px; margin: 0 auto 16px; padding: 8px 16px; color: #e9fff5; font-size: 14px; font-weight: 600; letter-spacing: .5px; line-height: 1.5; background: linear-gradient(180deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, .15)); border: 1px solid rgba(255, 215, 0, .5); border-radius: 8px; text-align: center; text-shadow: 0 0 4px #00ff88, 0 0 10px #00ff88; box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 0 12px rgba(0,255,136,.2); }
#message-area::before { content: "🎱"; color: #ffd700; font-size: 11px; margin-right: 10px; font-weight: 700; }
.canvas-wrapper { display: flex; justify-content: center; margin-bottom: 15px; }
canvas { border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8); cursor: crosshair; }
#controls { display: flex; flex-wrap: wrap; justify-content: space-around; align-items: center; background: #1a252f; padding: 12px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #34495e; }
.power-container { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: linear-gradient(145deg, #292929, #171717); border: 1px solid #555; border-radius: 8px; box-shadow: inset 0 1px 3px rgba(255,255,255,0.08), 0 3px 6px rgba(0,0,0,0.4); }
.power-container label { color: #ddd; background: linear-gradient(to right, #5f2f03, #9b7d08, #7e5909, #944902); font-size: 16px; font-weight: bold; border-radius: 6px; white-space: nowrap; text-shadow: 0 1px 2px #000; }
#powerRange { flex: 1; min-width: 100px; height: 8px; appearance: none; -webkit-appearance: none; border-radius: 10px; cursor: pointer; background: linear-gradient(to right, #27ae60, #f1c40f, #e67e22, #e74c3c); box-shadow: inset 0 2px 4px rgba(0,0,0,0.7), 0 1px 2px rgba(255,255,255,0.15); }
#powerRange::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffffff, #d5d5d5 45%, #777 100%); border: 2px solid #f39c12; box-shadow: 0 2px 5px rgba(0,0,0,0.7), 0 0 6px rgba(243,156,18,0.5); cursor: grab; }
#powerRange::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
#powerRange::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffffff, #d5d5d5 45%, #777 100%); border: 2px solid #f39c12; box-shadow: 0 2px 5px rgba(0,0,0,0.7); cursor: grab; }
#powerVal { min-width: 30px; padding: 4px 7px; text-align: center; font-size: 16px; font-weight: bold; color: #f39c12; background: #111; border: 1px solid #8a641e; border-radius: 5px; text-shadow: 0 0 6px rgba(243,156,18,0.5); box-shadow: inset 0 1px 4px rgba(0,0,0,0.8); }
button { background: linear-gradient(to right, #5f2f03, #9b7d08, #7e5909, #944902); color: rgb(248, 213, 243); border: none; padding: 10px 8px; font-size: 14px; font-weight: bold; border-radius: 6px; cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.3); transition: transform 0.1s, background 0.2s; }
button:hover { background: linear-gradient(135deg, #ff5e4d, #d63031); transform: translateY(-1px); }
#rules-info { text-align: left; background: #111a22; padding: 15px; border-radius: 8px; font-size: 13px; line-height: 1.6; border: 1px solid #2c3e50; }
#rules-info h3 { color: #3498db; margin-bottom: 6px; }
#rules-info ul { padding-left: 20px; }
.modal-overlay { display: none; position: fixed; inset: 0; justify-content: center; align-items: center; z-index: 1000; overflow: hidden;}
.modal-content { width: 90%; max-width: 410px; max-height: 80vh; padding: 25px; background: linear-gradient(to right, #22035c, #0a060f); color: white; border: 1px solid #555; border-radius: 10px; text-align: center; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5); overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; box-sizing: border-box; }
.modal-content h3 { margin-top: 0; }
.modal-buttons { display: flex; justify-content: center; gap: 12px; margin-top: 25px; }
.modal-buttons button { padding: 10px 20px; cursor: pointer; border: none; border-radius: 5px; }
.hud { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 24px; margin-bottom: 12px; padding: 8px 12px; width: 100%; max-width: 100%; box-sizing: border-box; background: linear-gradient(180deg, rgba(30,35,55,.95), rgba(10,15,25,.95)); border: 2px solid #3fa9ff; border-radius: 12px; color: #fff; font-family: "Segoe UI", sans-serif; font-size: 16px; box-shadow: 0 0 10px rgba(63,169,255,.5), inset 0 0 15px rgba(255,255,255,.05); }
.rack { color: #ffd54f; }
.battle, .match { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; min-width: 0; }
.you { color: #4dff88; font-weight: bold; text-shadow: 0 0 8px #4dff88; }
.ai { color: #ff5e7e; font-weight: bold; text-shadow: 0 0 8px #ff5e7e; }
.vs { color: #ffffffaa; font-weight: bold; }
.rules-content { max-height: 58vh; max-width: 60vh; overflow-y: auto; text-align: left; }
.rules-content h3 { text-align: center; margin-bottom: 20px; }
.rules-content h4 { color: #ffd966; margin: 20px 0 8px; }
.rules-content ul { padding-left: 22px; line-height: 1.8; }
.rules-content li { margin-bottom: 5px; }
#rulesCloseBtn { background: linear-gradient(135deg, #462e03, #cf9844); color: white; }
#soundToggleBtn { padding: 10px 18px; margin: 5px; font-size: 16px; font-weight: bold; color: white; background: #2b1e03; border: 1px solid #b99a50; border-radius: 8px; cursor: pointer; }
#soundToggleBtn:hover { background: #5a400b; }
.foul { display: flex; align-items: center; justify-content: center; gap: 10px; }
.foul .you { color: #4dff88; font-weight: bold; text-shadow: 0 0 8px #4dff88; }
.foul .ai { color: #e74c3c; }
.foul .vs { color: #777; }
.rules-content {position: relative;width: 640px; max-width: 90vw; height: 90vh; max-height: 680px; box-sizing: border-box; display: flex; flex-direction: column;}
.rules-frame {position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none;}
.rules-scroll {position: relative; flex: 1; min-height: 0; margin: 60px 60px 40px; padding: 10px 15px; box-sizing: border-box; overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; z-index: 1;}
.rules-content > .modal-buttons {position: relative; flex-shrink: 0; text-align: center; padding-bottom: 45px;}
.rules-content > :not(.rules-frame) {position: relative;}
#confirmClearRecords { color: rgb(31, 4, 20); background: linear-gradient(135deg, #d40d17, #da8989); }
#cancelClearRecords:hover { color: rgb(17, 15, 15); background: linear-gradient(135deg, #5f13b4, #b19de2); transform: translateY(-1px); }