* {
     margin: 0;
     padding: 0;
     box-sizing: border-box;
     font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  }

  body {
     background: linear-gradient(135deg, black, #2c3e50);
     color: #fff;
     min-height: 100vh;
     padding: 20px;
     display: flex;
     flex-direction: column;
     align-items: center;
    }

  header {
     text-align: center;
     margin: 20px 0 30px;
     width: 100%;
     max-width: 1200px;
    }

  h1 {
     font-size: 3.2rem;
     margin-bottom: 10px;
     text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
     letter-spacing: 2px;
    }

 .subtitle {
     font-size: 1.2rem;
     opacity: 0.8;
     margin-bottom: 15px;
    }

 .controls {
     display: flex;
     justify-content: center;
     gap: 20px;
     margin: 15px 0;
     flex-wrap: wrap;
    }

 .search-box {
     position: relative;
     width: 300px;
    }

  #search-input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border-radius: 30px;
    border: none;
   background: rgba(255, 255, 255, 0.15);
     color: white;
     font-size: 1rem;
    outline: none;
   transition: all 0.3s ease;
   }

   #search-input:focus {
     background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 15px rgba(66, 220, 255, 0.5);
    }
    
  .search-box i {
    position: absolute;
     left: 15px;
     top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
  }

  .legend {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 8px;
            margin: 15px 0 25px;
            max-width: 800px;
        }

  .legend-item {
            display: flex;
            align-items: center;
            font-size: 0.85rem;
            background: rgba(255, 255, 255, 0.1);
            padding: 5px 10px;
            border-radius: 15px;
        }

  .legend-color {
            width: 15px;
            height: 15px;
            border-radius: 3px;
            margin-right: 6px;
        }

  .container {
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
            max-width: 1200px;
        }

 .periodic-table {
            display: grid;
            grid-template-columns: repeat(18, 1fr);
            grid-gap: 4px;
            width: 100%;
            margin-bottom: 30px;
        }

 .element {
            position: relative;
            height: 70px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 5px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            z-index: 1;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
            overflow: hidden;
        }

 .element:hover {
            transform: scale(1.08);
            z-index: 10;
            box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
        }

 .element .number {
            position: absolute;
            top: 5px;
            left: 5px;
            font-size: 0.75rem;
            opacity: 0.8;
        }

  .element .symbol {
            font-size: 1.5rem;
            font-weight: bold;
            margin-bottom: 3px;
        }

  .element .name {
            font-size: 0.7rem;
            text-align: center;
            opacity: 0.9;
        }

  .element .mass {
            position: absolute;
            bottom: 5px;
            font-size: 0.65rem;
            opacity: 0.8;
        }

 .lanthanide-series, .actinide-series {
            display: grid;
            grid-template-columns: repeat(15, 1fr);
            grid-gap: 4px;
            width: calc(100% - 120px);
            margin-left: 60px;
            margin-top: 10px;
        }

 .series-label {
            text-align: center;
            font-size: 1.2rem;
            margin: 15px 0 8px;
            width: 100%;
            padding-left: 60px;
            opacity: 0.9;
        }

  /* Element category colors */
        .alkali-metal { background: linear-gradient(145deg, #ff9e80, #ff7043); }
        .alkaline-earth { background: linear-gradient(145deg, #ffd54f, #ffb300); }
        .transition-metal { background: linear-gradient(145deg, #90caf9, #42a5f5); }
        .post-transition { background: linear-gradient(145deg, #a5d6a7, #66bb6a); }
        .metalloid { background: linear-gradient(145deg, #80cbc4, #26a69a); }
        .nonmetal { background: linear-gradient(145deg, #f48fb1, #ec407a); }
        .halogen { background: linear-gradient(145deg, #ce93d8, #ab47bc); }
        .noble-gas { background: linear-gradient(145deg, #b39ddb, #7e57c2); }
        .lanthanide { background: linear-gradient(145deg, #ef9a9a, #ef5350); }
        .actinide { background: linear-gradient(145deg, #ffcc80, #ffa726); }
        .unknown { background: linear-gradient(145deg, #e0e0e0, #bdbdbd); color: #333; }

        /* Modal styling */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            z-index: 100;
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background: transparent;
            border-radius: 15px;
            width: 90%;
            max-width: 800px;
            padding: 30px 70px 50px;
            position: relative;
            box-shadow: 0 0 55px cyan, inset 0 0 35px cyan;
            border: 2px solid rgba(255, 255, 255, 0.1);
            animation: modalAppear 0.4s ease-out;
        }

        @keyframes modalAppear {
            from { opacity: 0; transform: scale(0.8); }
            to { opacity: 1; transform: scale(1); }
        }

        .close-modal {
            position: absolute;
            top: 15px;
            right: 20px;
            font-size: 3rem;
            cursor: pointer;
            color: rgba(255, 255, 255, 0.7);
            transition: all 0.2s;
        }

        .close-modal:hover {
            color: white;
            transform: scale(1.1);
        }

        .modal-header {
            display: flex;
            align-items: center;
            margin-bottom: 25px;
        }

        .modal-symbol {
            font-size: 5rem;
            font-weight: bold;
            margin-right: 20px;
            text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
        }

        .modal-info {
            flex-grow: 1;
        }

        .modal-name {
            font-size: 2.5rem;
            margin-bottom: 5px;
        }

        .modal-number {
            font-size: 1.2rem;
            opacity: 0.8;
            margin-bottom: 5px;
        }

        .modal-details {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 25px;
            margin-top: 20px;
        }

        .detail-item {
            background: rgba(255, 255, 255, 0.1);
            box-shadow: 0 0 15px cyan;
            padding: 15px;
            border-radius: 10px;
        }

        .detail-item h3 {
            font-size: 1.1rem;
            margin-bottom: 10px;
            color: #42dcff;
        }

        .electron-config {
            grid-column: span 2;
            font-family: monospace;
            font-size: 1.3rem;
            letter-spacing: 2px;
            text-align: center;
            padding: 15px;
            background: rgba(0, 0, 0, 0.3);
            box-shadow: 0 0 15px cyan;
            border-radius: 10px;
            margin-top: 10px;
        }

        footer {
            margin-top: 20px;
            text-align: center;
            font-size: 0.9rem;
            opacity: 0.7;
            width: 100%;
            padding: 15px;
        }

        @media (max-width: 1100px) {
            .periodic-table {
                grid-template-columns: repeat(9, 1fr);
            }
            .lanthanide-series, .actinide-series {
                grid-template-columns: repeat(8, 1fr);
                width: 100%;
                margin-left: 0;
            }
            .series-label {
                padding-left: 0;
            }
        }

        @media (max-width: 768px) {
            .periodic-table {
                grid-template-columns: repeat(5, 1fr);
            }
            .lanthanide-series, .actinide-series {
                grid-template-columns: repeat(4, 1fr);
            }
            .modal-details {
                grid-template-columns: 1fr;
            }
            .electron-config {
                grid-column: span 1;
            }
        }