* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Alliance No.1 Light', -apple-system, BlinkMacSystemFont, sans-serif;
    user-select: none;
}

body {
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.ios-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* Status Bar */
.status-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

.status-left, .status-center, .status-right {
    display: flex;
    align-items: center;
}

.status-left {
    width: 33%;
}

.status-center {
    width: 34%;
    justify-content: center;
}

.status-right {
    width: 33%;
    justify-content: flex-end;
    gap: 6px;
}

.carrier::before {
    content: "●●●●●";
    letter-spacing: -1px;
    margin-right: 4px;
}

.battery-icon {
    width: 25px;
    height: 12px;
    margin-left: 2px;
}

/* Home Screen */
.home-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('iOS 6 Wallpaper.png');
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.home-apps {
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    justify-items: center;
    padding: 20px;
    gap: 20px;
}

/* Dock */
.dock {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 110px;
    z-index: 2;
    border-radius: 0;
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(20px);
}

.dock-bg {
    display: none;
}

.dock-icons {
    position: relative;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    padding: 0 10px;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
}

.app-icon svg, .app-icon img {
    width: 70px;
    height: 70px;
    border-radius: 0;
}

.app-icon span {
    color: white;
    font-size: 13px;
    margin-top: 5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Settings App */
.settings-app {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f2f2f7;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.settings-header {
    height: 60px;
    background-color: #f2f2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid #c8c7cc;
    padding-top: 24px;
}

.settings-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.settings-back {
    position: absolute;
    left: 16px;
    top: 24px;
    color: #007aff;
    font-size: 16px;
    cursor: pointer;
}

.settings-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    background-color: #f2f2f7;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: #fff;
    border-bottom: 1px solid #c8c7cc;
}

.settings-item:first-child {
    border-top: 1px solid #c8c7cc;
}

.settings-item-left {
    display: flex;
    align-items: center;
}

.settings-item-icon {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
}

.settings-item-icon.wifi {
    background-color: #0a84ff;
}

.settings-item-icon.bluetooth {
    background-color: #5856d6;
}

.settings-item-icon.cellular {
    background-color: #34c759;
}

.settings-item-icon.wallpaper {
    background-color: #5ac8fa;
}

.settings-item-icon.notifications {
    background-color: #ff3b30;
}

.settings-item-icon.general {
    background-color: #8e8e93;
}

.settings-item-icon.language {
    background-color: #ff9500;
}

.settings-item-text {
    font-size: 16px;
    color: #000;
}

.settings-item-right {
    display: flex;
    align-items: center;
    color: #8e8e93;
    font-size: 16px;
}

.arrow {
    margin-left: 8px;
    font-size: 20px;
}

.toggle {
    width: 50px;
    height: 30px;
    background-color: #e9e9ea;
    border-radius: 15px;
    position: relative;
    cursor: pointer;
}

.toggle.active {
    background-color: #34c759;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.toggle.active .toggle-slider {
    transform: translateX(20px);
}

/* Wallpaper Selector */
.wallpaper-selector {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f2f2f7;
    z-index: 51;
    display: flex;
    flex-direction: column;
}

.wallpaper-back {
    position: absolute;
    left: 16px;
    top: 24px;
    color: #007aff;
    font-size: 16px;
    cursor: pointer;
}

.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    margin-top: 30px;
}

.wallpaper-option {
    aspect-ratio: 9/16;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid transparent;
    transition: transform 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.upload-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #f2f2f7;
    border: 2px dashed #007AFF;
}

.upload-container label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 100%;
    height: 100%;
    color: #007AFF;
    font-size: 14px;
}

.upload-container label div {
    margin-top: 10px;
}

.wallpaper-option:active {
    transform: scale(0.95);
}

.wallpaper-option.active {
    border-color: #007aff;
}

.wallpaper-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wallpaper-color {
    width: 100%;
    height: 100%;
}

/* Language Selector */
.language-selector {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f2f2f7;
    z-index: 51;
    display: flex;
    flex-direction: column;
}

.language-back {
    position: absolute;
    left: 16px;
    top: 24px;
    color: #007aff;
    font-size: 16px;
    cursor: pointer;
}

.language-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.language-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background-color: #fff;
    border-bottom: 1px solid #c8c7cc;
    cursor: pointer;
}

.language-item:first-child {
    border-top: 1px solid #c8c7cc;
}

.language-name {
    font-size: 16px;
    color: #000;
}

.language-check {
    color: #007aff;
    font-size: 18px;
    font-weight: bold;
}

/* Error Popup */
.error-popup, .welcome-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.2);
    width: 80%;
    max-width: 300px;
    background-color: rgba(250, 250, 250, 0.95);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 100;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
}

.error-popup.show, .welcome-popup.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.error-title {
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    padding: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.error-message {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

.error-close, .welcome-close {
    width: 100%;
    padding: 12px;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: #007aff;
    background: none;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.error-close:active, .welcome-close:active {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Ping Pong Game */
.ping-pong-app {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.game-header {
    height: 60px;
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-top: 24px;
}

.game-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.game-back {
    position: absolute;
    left: 16px;
    top: 24px;
    color: #4CD964;
    font-size: 16px;
    cursor: pointer;
}

.game-score {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    background-color: #1a1a1a;
    color: white;
    font-size: 24px;
    font-weight: bold;
}

.score-divider {
    margin: 0 10px;
}

#pingPongCanvas {
    background-color: #000;
    flex: 1;
    width: 100%;
    max-height: calc(100% - 140px);
    touch-action: none;
}

.game-controls {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    background-color: #1a1a1a;
}

.game-button {
    padding: 10px 20px;
    background-color: #4CD964;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.game-button:active {
    background-color: #3ab04e;
}

/* iTunes App */
.itunes-app {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f2f2f7;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.itunes-back {
    position: absolute;
    left: 16px;
    top: 24px;
    color: #007aff;
    font-size: 16px;
    cursor: pointer;
}

.now-playing {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: #fff;
}

.album-art {
    width: 180px;
    height: 180px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.album-placeholder {
    width: 100%;
    height: 100%;
    background-color: #f2f2f7;
    display: flex;
    justify-content: center;
    align-items: center;
}

.track-info {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
}

.track-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin-bottom: 6px;
}

.track-artist {
    font-size: 16px;
    color: #8e8e93;
}

.track-progress {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.progress-time {
    font-size: 12px;
    color: #8e8e93;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background-color: #e5e5e5;
    border-radius: 3px;
    margin: 0 10px;
    position: relative;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: #007aff;
    border-radius: 3px;
    width: 0;
}

.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.control-button {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.control-button.play-pause {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #f2f2f7;
}

.track-list {
    flex: 1;
    overflow-y: auto;
}

.track-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e5e5e5;
    background-color: #fff;
    cursor: pointer;
}

.track-item.active {
    background-color: rgba(0, 122, 255, 0.1);
}

.track-number {
    width: 30px;
    font-size: 16px;
    color: #8e8e93;
    text-align: center;
}

.track-details {
    flex: 1;
    margin-left: 16px;
}

.track-name {
    font-size: 16px;
    color: #000;
    margin-bottom: 4px;
}

.track-creator {
    font-size: 14px;
    color: #8e8e93;
}

.track-duration {
    font-size: 14px;
    color: #8e8e93;
    width: 50px;
    text-align: right;
}

.track-item:active {
    background-color: rgba(0, 122, 255, 0.05);
}

/* Control Panel */
.control-panel-app {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 50;
    display: none;
    flex-direction: column;
    padding-top: 24px;
    overflow: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.control-panel-app.show {
    transform: translateY(0);
}

.control-panel-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: white;
    padding-top: 24px;
}

.panel-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.panel-back {
    position: absolute;
    left: 16px;
    top: 24px;
    color: #4CD964;
    font-size: 16px;
    cursor: pointer;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 20px;
    gap: 20px;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-item.active {
    background-color: rgba(76, 217, 100, 0.4);
}

.control-item:active {
    transform: scale(0.95);
}

.control-icon {
    margin-bottom: 8px;
    font-size: 24px;
}

.control-media {
    margin-top: 20px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    margin-left: 20px;
    margin-right: 20px;
}

.control-song {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    color: white;
}

.song-artwork {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background-color: #1a1a1a;
    margin-right: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.song-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.song-artist {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.media-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.media-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.brightness-slider {
    margin-top: 30px;
    padding: 0 20px;
}

.brightness-control {
    display: flex;
    align-items: center;
    width: 100%;
    color: white;
    margin-bottom: 5px;
}

.brightness-icon {
    margin-right: 10px;
    margin-left: 10px;
}

.slider-container {
    flex-grow: 1;
    height: 30px;
    position: relative;
    display: flex;
    align-items: center;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider {
    margin-top: 10px;
}

.swipe-indicator {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    z-index: 3;
    cursor: pointer;
}

@media (min-aspect-ratio: 9/16) {
    .ios-container {
        width: calc(100vh * 9/16);
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
}

@media (max-aspect-ratio: 9/16) {
    .ios-container {
        width: 100vw;
        height: calc(100vw * 16/9);
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
}

@media (max-width: 480px) {
    .ios-container {
        border-width: 0;
        border-radius: 0;
    }
    .app-icon svg, .app-icon img {
        width: 60px;
        height: 60px;
        border-radius: 0;
    }
    
    .dock {
        bottom: 0;
        width: 100%;
        height: 100px;
        border-radius: 0;
    }
}

@media (max-width: 360px) {
    .ios-container {
        border-width: 0;
        border-radius: 0;
    }
    
    .app-icon svg, .app-icon img {
        width: 50px;
        height: 50px;
        border-radius: 0;
    }
    
    .app-icon span {
        font-size: 11px;
    }
    
    .dock {
        bottom: 0;
        width: 100%;
        height: 85px;
        border-radius: 0;
    }
}