* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #000;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}
h1 {
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 40px;
}
h1 a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
h1 a:hover { opacity: 0.85; }
h1 a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.upload-area {
    border: 2px dashed #555;
    border-radius: 8px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 30px;
}
.upload-area:hover {
    border-color: #888;
    background: #111;
}
.upload-area.dragover {
    border-color: #fff;
    background: #222;
}
.upload-area.hide {
    display: none;
}
.upload-text {
    font-size: 18px;
    margin-bottom: 10px;
}
input[type="file"] {
    display: none;
}
.btn {
    background: #333;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
    margin: 5px;
}
.btn:hover {
    background: #555;
}
.btn.active {
    background: #fff;
    color: #000;
}
.platform-buttons {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}
.platform-buttons.show {
    display: flex;
}
.platform-select-wrapper {
    display: none;
    margin-bottom: 30px;
    text-align: center;
}
.platform-select-wrapper select {
    width: 90%;
    max-width: 400px;
    padding: 15px;
    font-size: 16px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
}
.preview-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.preview-container.show {
    display: flex;
}
.preview-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: center;
    max-width: 100%;
}
.canvas-wrapper {
    position: relative;
    display: inline-block;
    cursor: move;
}
.rotate-btn {
    background: #555;
    padding: 15px 20px;
    font-size: 32px;
    min-width: 70px;
    border: 1px solid #777;
    flex-shrink: 0;
}
.rotate-btn:hover {
    background: #777;
    border-color: #999;
}
.rotate-btn svg {
    display: block;
}
.rotate-buttons-wrapper {
    display: none;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}
canvas {
    max-width: calc(100vw - 200px);
    max-height: 60vh;
    border: 1px solid #555;
}
.crop-box {
    position: absolute;
    border: 2px solid #fff;
    pointer-events: none;
}
.crop-overlay {
    position: absolute;
    background: rgba(0,0,0,0.7);
    pointer-events: none;
}
.execute-btn {
    background: #fff;
    color: #000;
    font-weight: bold;
    padding: 16px 48px;
    font-size: 18px;
}
.execute-btn:hover {
    background: #ddd;
}
.execute-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}
.execute-btn:disabled:hover {
    background: #333;
}
.action-buttons {
    display: flex;
    gap: 15px;
}
.reset-btn {
    background: #555;
    padding: 16px 32px;
    font-size: 18px;
}
.reset-btn:hover {
    background: #666;
}
.zoom-container {
    display: none;
    margin-top: 20px;
    width: 80%;
    text-align: center;
}
#zoomSlider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    width: 60%;
}
#zoomSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}
#zoomSlider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}
.save-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
}
.save-modal.show {
    display: flex;
}
.save-modal img {
    max-width: 90%;
    max-height: 70vh;
    border: 2px solid #fff;
}
.save-modal-text {
    color: #fff;
    text-align: center;
    margin-top: 20px;
    font-size: 16px;
}
.save-modal-close {
    margin-top: 20px;
    background: #fff;
    color: #000;
    padding: 12px 32px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .platform-buttons {
        display: none !important;
    }
    .platform-select-wrapper.show {
        display: block !important;
    }
    .preview-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    .preview-wrapper .rotate-btn {
        display: none;
    }
    .rotate-buttons-wrapper {
        display: flex;
    }
    canvas {
        max-width: 90vw;
    }
    .action-buttons {
        flex-direction: column;
        width: 100%;
        max-width: 90vw;
    }
    .execute-btn, .reset-btn {
        width: 100%;
        padding: 18px;
    }
}

@media (prefers-color-scheme: light) {
    body {
        background: #f5f5f5;
        color: #000;
    }
    .upload-area {
        border-color: #ccc;
    }
    .upload-area:hover {
        border-color: #999;
        background: #e8e8e8;
    }
    .upload-area.dragover {
        border-color: #666;
        background: #ddd;
    }
    .btn {
        background: #e0e0e0;
        color: #000;
    }
    .btn:hover {
        background: #d0d0d0;
    }
    .btn.active {
        background: #333;
        color: #fff;
    }
    .platform-select-wrapper select {
        background: #fff;
        color: #000;
        border-color: #ccc;
    }
    .rotate-btn {
        background: #e0e0e0;
        border-color: #ccc;
    }
    .rotate-btn:hover {
        background: #d0d0d0;
        border-color: #aaa;
    }
    .rotate-btn svg path,
    .rotate-btn svg line,
    .rotate-btn svg circle {
        stroke: #000;
    }
    canvas {
        border-color: #ccc;
    }
    .crop-box {
        border-color: #000;
    }
    .execute-btn {
        background: #333;
        color: #fff;
    }
    .execute-btn:hover {
        background: #555;
    }
    .execute-btn:disabled {
        background: #e0e0e0;
        color: #999;
    }
    .execute-btn:disabled:hover {
        background: #e0e0e0;
    }
    .reset-btn {
        background: #e0e0e0;
        color: #000;
    }
    .reset-btn:hover {
        background: #d0d0d0;
    }
    #zoomSlider {
        background: #ddd;
    }
    #zoomSlider::-webkit-slider-thumb {
        background: #333;
    }
    #zoomSlider::-moz-range-thumb {
        background: #333;
    }
    .save-modal {
        background: rgba(255,255,255,0.95);
    }
    .save-modal img {
        border-color: #000;
    }
    .save-modal-text {
        color: #000;
    }
    .save-modal-close {
        background: #333;
        color: #fff;
    }
}
