body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
    padding: 20px;
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    padding: 20px;
    box-sizing: border-box;
}

.start-content {
    background: rgba(0, 0, 0, 0.6);
    padding: 30px 40px;
    border-radius: 15px;
    max-width: 500px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.start-content p {
    font-size: 1.3em;
    line-height: 1.6;
    margin: 0 0 25px 0;
}

#start-btn {
    background-color: #ffffff;
    color: #333;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#start-btn:hover {
    background-color: #f0f0f0;
    transform: scale(1.05);
}

header {
    margin-bottom: 40px;
    position: relative;
}

#settings-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

#settings-btn:hover {
    transform: rotate(20deg);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

h1 {
    font-size: 2.5em;
    color: #1a1a1a;
    transition: color 0.3s ease;
}

main {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 400px;
    height: 450px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.3s ease;
}

h2 {
    margin-top: 0;
    color: #555;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    width: 100%;
    transition: color 0.3s ease, border-bottom-color 0.3s ease;
}

#drop-zone {
    border: 3px dashed #ccc;
    border-radius: 10px;
    width: calc(100% - 6px);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #aaa;
    transition: all 0.3s ease;
    cursor: pointer;
}

#drop-zone.dragover {
    border-color: #007bff;
    background-color: #f0f8ff;
}

#browse-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}

#browse-btn:hover {
    background-color: #0056b3;
}

#preview-container {
    position: relative;
    cursor: pointer;
    width: 100%;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#preview-container:hover .overlay-text {
    opacity: 1;
}

.overlay-text {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

#preview-image {
    max-width: 100%;
    max-height: 350px;
    border-radius: 8px;
    object-fit: contain;
}

#ai-output {
    width: 100%;
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#ai-output .placeholder {
    color: #aaa;
    transition: color 0.3s ease;
}

#ai-image {
    max-width: 100%;
    max-height: 380px;
    border-radius: 8px;
    object-fit: contain;
}

#loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    position: absolute;
}

.hidden {
    display: none !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Settings Modal */
#settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    position: relative;
    width: 90%;
    max-width: 400px;
    text-align: left;
}

#close-settings-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #888;
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 25px;
}

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}
.setting:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.setting label {
    font-weight: 500;
}

#language-select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

/* Theme Switch */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: #2196F3;
}
input:checked + .slider:before {
  transform: translateX(22px);
}
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}

/* Dark Mode */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}
body.dark-mode h1 {
    color: #f5f5f5;
}
body.dark-mode .container {
    background-color: #2c2c2c;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
body.dark-mode h2 {
    color: #ccc;
    border-bottom-color: #444;
}
body.dark-mode #drop-zone {
    border-color: #555;
    color: #777;
}
body.dark-mode #drop-zone.dragover {
    border-color: #007bff;
    background-color: #1a2a3a;
}
body.dark-mode #ai-output .placeholder {
    color: #777;
}
body.dark-mode .overlay-text {
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
}
body.dark-mode #settings-btn {
    background: #2c2c2c;
    border-color: #444;
    color: #e0e0e0;
}
body.dark-mode .modal-content {
    background: #333;
}
body.dark-mode #close-settings-btn {
    color: #bbb;
}
body.dark-mode .setting {
    border-bottom-color: #555;
}
body.dark-mode #language-select {
    background-color: #444;
    color: #e0e0e0;
    border-color: #666;
}