* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #101321; }
body { font-family: Arial, Helvetica, sans-serif; color: #f6f6fb; }
button { font-family: inherit; }
.game { position: relative; width: 100%; height: 100%; overflow: hidden; background: #11131f; isolation: isolate; }
#game { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
[hidden] { display: none !important; }
.screen { position: absolute; z-index: 4; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 26px 22px; overflow: hidden; background: radial-gradient(ellipse at 50% 5%, rgba(93, 92, 190, .3), transparent 50%), radial-gradient(ellipse at 15% 85%, rgba(38, 202, 212, .14), transparent 38%), rgba(10, 13, 25, .76); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.menu::before, .menu::after { position: absolute; z-index: -1; width: min(42vw, 430px); aspect-ratio: 1; border: 1px solid rgba(133, 227, 246, .13); border-radius: 35%; content: ""; transform: rotate(32deg); box-shadow: 0 0 90px rgba(92, 105, 233, .12), inset 0 0 55px rgba(91, 221, 238, .05); }
.menu::after { width: min(58vw, 610px); transform: rotate(58deg); border-color: rgba(174, 157, 255, .1); }
.menu h1 { margin: 0 0 27px; color: #fff; font-size: clamp(40px, 8vw, 76px); line-height: 1; letter-spacing: .16em; text-shadow: 0 3px 0 #4d52a0, 0 0 28px rgba(94, 226, 242, .42); }
.level-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; width: min(980px, 100%); max-height: min(72vh, 700px); overflow: auto; overscroll-behavior: contain; padding: 12px 12px 18px; scrollbar-color: rgba(119, 218, 232, .55) rgba(255, 255, 255, .08); scrollbar-width: thin; }
.level-card { position: relative; display: flex; min-width: 0; min-height: 142px; flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 14px 13px 12px; overflow: hidden; border: 1px solid rgba(199, 221, 255, .22); border-radius: 13px; background: linear-gradient(145deg, rgba(255, 255, 255, .15), rgba(142, 159, 220, .055) 52%, rgba(20, 25, 48, .52)); box-shadow: inset 0 1px rgba(255,255,255,.16), 0 8px 24px rgba(0,0,0,.18); color: #fff; text-align: left; font: 800 14px Arial, sans-serif; cursor: pointer; -webkit-backdrop-filter: blur(15px); backdrop-filter: blur(15px); transition: transform .2s, border-color .2s, box-shadow .2s, background .2s; }
.level-card::before { position: absolute; top: -35px; right: -25px; width: 92px; height: 92px; border: 1px solid rgba(113, 229, 240, .24); border-radius: 26px; content: ""; transform: rotate(35deg); }
.level-card:hover, .level-card:focus-visible { transform: translateY(-5px) scale(1.015); border-color: rgba(103, 238, 247, .85); background: linear-gradient(145deg, rgba(99, 205, 224, .2), rgba(122, 112, 214, .17), rgba(23, 30, 57, .75)); box-shadow: 0 12px 32px rgba(18, 189, 210, .15), inset 0 1px rgba(255,255,255,.25); outline: none; }
.level-card .number { display: block; position: relative; margin-bottom: 9px; color: #7beaf0; font-size: 10px; letter-spacing: .18em; }
.level-name { position: relative; display: block; min-height: 34px; line-height: 1.2; }
.level-record { position: relative; display: grid; gap: 5px; margin-top: auto; padding-top: 9px; color: #c6cee3; font-size: 9px; letter-spacing: .035em; }
.record-attempts { color: #eef2ff; font-size: 10px; }
.record-line { display: grid; grid-template-columns: 13px 1fr 30px; align-items: center; gap: 5px; }
.record-track { height: 4px; overflow: hidden; border-radius: 4px; background: rgba(255,255,255,.12); }
.record-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #59ddec, #c2a3ff); }
.record-value { color: #e9e9f4; font-size: 9px; text-align: right; }
.level-card.creator { border-color: rgba(174, 143, 255, .62); color: #e4d9ff; background: linear-gradient(145deg, rgba(137, 98, 220, .25), rgba(65, 62, 112, .16), rgba(20, 25, 48, .6)); }
.editor-tools { position: absolute; z-index: 3; top: 22px; left: 50%; display: none; gap: 8px; transform: translateX(-50%); }
.editor-tools.visible { display: flex; }
.tool { width: 45px; height: 43px; border: 1px solid rgba(213, 225, 255, .25); border-radius: 9px; background: rgba(26, 32, 54, .88); color: #fff; font-size: 20px; font-weight: 800; cursor: pointer; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.tool.selected { border-color: #59e4ed; color: #59e4ed; box-shadow: 0 0 18px rgba(89, 228, 237, .2); }
.tool.action { border-color: #9b83f3; }
.hud { position: absolute; z-index: 2; top: 22px; left: 50%; display: none; align-items: center; gap: 10px; width: min(420px, 68vw); transform: translateX(-50%); pointer-events: none; }
.hud.visible { display: flex; }
.progress-track { flex: 1; height: 9px; overflow: hidden; border: 2px solid #f3f3f7; border-radius: 8px; background: #25283a; }
.progress-fill { width: 0; height: 100%; background: #53e7ee; transition: width .08s linear; }
.progress-percent { min-width: 38px; color: white; font-size: 13px; font-weight: 800; text-shadow: 1px 2px #11131f; }
.modal-screen { position: absolute; z-index: 5; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(ellipse at 50% 40%, rgba(92, 97, 164, .2), transparent 62%), rgba(6, 8, 18, .52); -webkit-backdrop-filter: blur(15px) saturate(125%); backdrop-filter: blur(15px) saturate(125%); }
.modal-card { position: relative; width: min(390px, 100%); padding: 30px; overflow: hidden; border: 1px solid rgba(215, 225, 255, .26); border-radius: 20px; background: linear-gradient(145deg, rgba(46, 51, 79, .88), rgba(21, 25, 44, .88)); box-shadow: inset 0 1px rgba(255,255,255,.17), 0 24px 80px rgba(0, 0, 0, .52), 0 0 50px rgba(108, 99, 223, .12); text-align: center; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.modal-card::before { position: absolute; top: -75px; left: 50%; width: 210px; height: 130px; border-radius: 50%; background: rgba(86, 223, 237, .13); filter: blur(34px); content: ""; transform: translateX(-50%); pointer-events: none; }
.modal-card h2 { position: relative; margin: 0 0 24px; color: #fff; font-size: 27px; letter-spacing: .16em; text-shadow: 0 0 20px rgba(100, 222, 240, .22); }
.modal-button { min-height: 48px; border: 1px solid rgba(213, 225, 255, .2); border-radius: 10px; background: rgba(255, 255, 255, .07); color: #f7f8ff; font-size: 12px; font-weight: 800; letter-spacing: .12em; cursor: pointer; transition: transform .16s, background .16s, border-color .16s, box-shadow .16s; }
.modal-button:hover, .modal-button:focus-visible { transform: translateY(-2px); border-color: rgba(107, 230, 241, .8); background: rgba(100, 208, 226, .12); outline: none; }
.modal-button.primary { position: relative; width: 100%; border-color: rgba(116, 235, 238, .55); background: linear-gradient(100deg, rgba(32, 125, 144, .7), rgba(92, 86, 176, .7)); box-shadow: 0 6px 24px rgba(43, 191, 206, .16), inset 0 1px rgba(255,255,255,.18); }
.modal-button.primary:hover { box-shadow: 0 8px 28px rgba(43, 191, 206, .26); }
.modal-button.secondary { width: 100%; margin-top: 10px; }
.mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.mode-options .modal-button { width: 100%; }
.result-stats { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin: 0 0 22px; text-align: left; }
.result-stats span { color: #abb3ca; font-size: 12px; letter-spacing: .08em; }
.result-stats strong { color: #62e7ee; font-size: 13px; text-align: right; }
.frame { position: absolute; z-index: 1; inset: 12px; border: 2px solid rgba(221, 226, 255, .2); pointer-events: none; }
.corner { position: absolute; width: 22px; height: 22px; border: solid #62e7ee; }
.corner-tl { top: -2px; left: -2px; border-width: 4px 0 0 4px; }
.corner-tr { top: -2px; right: -2px; border-width: 4px 4px 0 0; }
.corner-bl { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; }
.corner-br { right: -2px; bottom: -2px; border-width: 0 4px 4px 0; }
@media (max-width: 760px) {
  .level-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; max-height: 72vh; }
  .level-card { min-height: 136px; padding: 11px 9px; }
  .menu h1 { margin-bottom: 18px; }
  .editor-tools { top: 16px; gap: 5px; }
  .tool { width: 40px; height: 39px; }
  .modal-card { padding: 25px 22px; }
}
@media (max-width: 420px) {
  .level-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .level-card { min-height: 130px; }
  .editor-tools { gap: 4px; }
  .tool { width: 37px; height: 38px; }
}
