 * {
     box-sizing: border-box;
     margin: 0;
     padding: 0;
     font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
 }

 body {
     background: #0f172a;
     color: #e5e7eb;
     min-height: 100vh;
     display: flex;
     justify-content: center;
     align-items: stretch;
 }

 .game-container {
     width: 100%;
     max-width: 1100px;
     height: 100vh;
     background: #020617;
     display: flex;
     flex-direction: column;
 }

 @media (min-width: 900px) {
     .game-container {
         margin: 12px auto;
         height: calc(100vh - 24px);
         border-radius: 18px;
         box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
         border: 1px solid #1f2937;
         overflow: hidden;
     }
 }

 /* نوار تب برای موبایل */
 .tab-bar {
     display: flex;
     background: #020617;
     border-bottom: 1px solid #111827;
 }

 .tab-btn {
     flex: 1;
     padding: 10px 0;
     border: none;
     background: transparent;
     color: #9ca3af;
     font-size: 14px;
     font-weight: 500;
     cursor: pointer;
     display: flex;
     align-items: center;
     justify-content: center;
     gap: 6px;
     border-bottom: 2px solid transparent;
 }

 .tab-btn.active {
     color: #e5e7eb;
     border-bottom-color: #6366f1;
     background: radial-gradient(circle at top, #020617 0, #020617 40%, #020617 100%);
 }

 .tab-panels {
     flex: 1;
     display: flex;
     flex-direction: column;
 }

 .tab-panel {
     flex: 1;
     display: none;
 }

 .tab-panel.active {
     display: flex;
 }

 /* نسخه دسکتاپ */
 @media (min-width: 900px) {
     .tab-bar {
         display: none;
     }

     .tab-panels {
         flex-direction: row;
     }

     .tab-panel {
         display: flex !important;
     }
 }

 .left-panel {
     flex: 1;
     position: relative;
     background: radial-gradient(circle at top, #1f2937 0, #020617 55%);
     border-left: 1px solid #020617;
     border-right: 1px solid #111827;
     display: flex;
     justify-content: center;
     align-items: center;
     padding: 6px;
 }

 #gameCanvas {
     width: 100%;
     max-width: 700px;
     max-height: 700px;
     background:
         linear-gradient(#020617 1px, transparent 1px),
         linear-gradient(90deg, #020617 1px, transparent 1px);
     background-size: 40px 40px;
     border-radius: 12px;
     border: 1px solid #1f2937;
     box-shadow: 0 0 0 1px #020617, 0 15px 30px rgba(0, 0, 0, 0.5);
 }

 @media (max-width: 899px) {
     #gameCanvas {
         height: auto;
         aspect-ratio: 1 / 1;
     }
 }

 .right-panel {
     flex: 1;
     padding: 10px 10px 14px 10px;
     display: flex;
     flex-direction: column;
     gap: 8px;
     background: radial-gradient(circle at top left, #111827 0, #020617 60%);
     overflow: hidden;
 }

 @media (max-width: 899px) {
     .right-panel {
         padding: 10px 8px 14px 8px;
     }
 }

 .panel-section {
     background: rgba(15, 23, 42, 0.9);
     border-radius: 14px;
     padding: 8px 10px;
     border: 1px solid #1f2937;
     box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
 }

 .panel-header {
     font-size: 13px;
     font-weight: 600;
     color: #a5b4fc;
     margin-bottom: 6px;
     display: flex;
     align-items: center;
     gap: 6px;
 }

 .input-row {
     display: flex;
     gap: 6px;
     margin-bottom: 6px;
     align-items: center;
 }

 input[type="text"],
 input[type="number"] {
     background: #020617;
     border-radius: 999px;
     border: 1px solid #374151;
     padding: 6px 10px;
     color: #e5e7eb;
     font-size: 12px;
     outline: none;
     width: 100%;
 }

 .buttons {
     display: flex;
     gap: 6px;
     margin-top: 4px;
     flex-wrap: nowrap;
 }

 button.primary {
     flex: 1.1;
     background: linear-gradient(135deg, #4f46e5, #06b6d4);
     color: white;
     border-radius: 999px;
     border: none;
     padding: 6px 8px;
     font-size: 12px;
     font-weight: 600;
     cursor: pointer;
 }

 button.secondary {
     flex: 0.9;
     background: #111827;
     color: #e5e7eb;
     border-radius: 999px;
     border: 1px solid #374151;
     padding: 6px 8px;
     font-size: 12px;
     font-weight: 600;
     cursor: pointer;
 }

 .status-row {
     display: flex;
     justify-content: space-between;
     align-items: center;
     margin-top: 4px;
     font-size: 11px;
     color: #9ca3af;
 }

 .level-pill {
     padding: 3px 8px;
     border-radius: 999px;
     background: rgba(37, 99, 235, 0.18);
     color: #bfdbfe;
     font-weight: 600;
 }

 .status-text {
     padding: 3px 8px;
     border-radius: 999px;
     background: rgba(31, 41, 55, 0.8);
     border: 1px solid rgba(75, 85, 99, 0.9);
     color: #e5e7eb;
     font-size: 11px;
     flex: 1;
     text-align: left;
     margin-left: 6px;
 }

 .lines-list {
     max-height: 120px;
     overflow-y: auto;
 }

 .line-item {
     padding: 4px 6px;
     border-radius: 8px;
     background: rgba(15, 23, 42, 0.9);
     border: 1px solid #1f2937;
     margin-bottom: 4px;
     display: flex;
     justify-content: space-between;
     align-items: center;
     gap: 6px;
 }

 .line-delete-btn {
     background: transparent;
     border-radius: 999px;
     border: 1px solid #4b5563;
     padding: 3px 7px;
     color: #fca5a5;
     cursor: pointer;
 }