:root {
    --primary-grad: linear-gradient(135deg, #00c6ff, #0072ff);
    --accent-pink: #ff00cc;
    --accent-blue: #3333ff;
    --bg-dark: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-white: #ffffff;
    --text-dim: #94a3b8;
    --font-main: 'Outfit', 'Inter', system-ui, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Glowing Orbs */
.background-decor {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
    animation: pulse 15s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, #4facfe, #00f2fe);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, #ee0979, #ff6a00);
}

@keyframes pulse {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.1) translate(30px, 30px); }
}

.back-link {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
}

.container {
    width: 95%;
    max-width: 480px;
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    padding: 3rem 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--primary-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.icon-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-white);
    font-size: 1.2rem;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 6px;
    margin-bottom: 2.5rem;
    gap: 6px;
}

.tab-btn {
    flex: 1;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    border-radius: 14px;
    background: transparent;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    margin-bottom: 0;
}

.tab-btn i {
    font-size: 1.1rem;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

/* LINE Banner */
.line-banner {
    background: rgba(6, 199, 85, 0.15);
    border: 1px solid rgba(6, 199, 85, 0.3);
    border-radius: 20px;
    padding: 1.2rem;
    margin-bottom: 2.5rem;
    animation: fadeIn 0.5s ease-out;
}

.line-banner p {
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    color: #06c755;
    font-weight: 600;
}

#open-external-btn {
    background: #06c755;
    color: white;
    padding: 0.8rem;
    font-size: 0.9rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(6, 199, 85, 0.3);
    margin-top: 0.5rem;
}

/* Camera Scanner Styles */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 1.5rem auto;
    border-radius: 24px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 4 / 3;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#camera-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    box-shadow: inset 0 0 0 40px rgba(0, 0, 0, 0.4);
}

.scan-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: #00c6ff;
    box-shadow: 0 0 10px #00c6ff;
    top: 50%;
    animation: scan 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes scan {
    0% { top: 10%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 90%; opacity: 0; }
}

.corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: #00c6ff;
    border-style: solid;
}

.corner.top-left { top: 40px; left: 40px; border-width: 3px 0 0 3px; }
.corner.top-right { top: 40px; right: 40px; border-width: 3px 3px 0 0; }
.corner.bottom-left { bottom: 40px; left: 40px; border-width: 0 0 3px 3px; }
.corner.bottom-right { bottom: 40px; right: 40px; border-width: 0 3px 3px 0; }

.qr-container {
    background: white;
    padding: 20px;
    border-radius: 24px;
    display: inline-block;
    margin-bottom: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#qr {
    width: 100% !important;
    height: auto !important;
    max-width: 200px;
}

/* Options & Inputs */
.option-group {
    margin-bottom: 2rem;
    text-align: left;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.option-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.8;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-dim);
    user-select: none;
    transition: color 0.3s;
}

.checkbox-container:hover {
    color: var(--text-white);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 22px;
    width: 22px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    transition: all 0.3s;
}

.checkbox-container input:checked ~ .checkmark {
    background: var(--primary-grad);
    border: none;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 8px;
    top: 4px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Increased gap */
    margin-bottom: 2.5rem;
}

#text-input {
    width: 100%;
    padding: 1.2rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: all 0.3s;
}

#text-input:focus {
    border-color: #00c6ff;
    box-shadow: 0 0 20px rgba(0, 198, 255, 0.4);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.2rem; /* Consistent spacing */
}

button {
    width: 100%;
    padding: 1.1rem;
    border-radius: 18px;
    border: none;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#copy-btn {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    color: white;
    box-shadow: 0 10px 25px -5px rgba(58, 123, 213, 0.5);
}

#download-btn {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem; /* Extra breathing room */
}

/* Short URL Session */
.short-url-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeIn 0.5s ease-out;
}

.short-url-container-inner {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.short-url-container input {
    flex: 1;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    color: var(--text-white);
    font-family: monospace;
    font-size: 0.9rem;
    text-align: left;
}

#copy-url-btn {
    width: auto;
    min-width: 120px;
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    border: 1px solid var(--card-border);
    margin: 0;
}

.status-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 16px;
}

.status {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.version {
    font-size: 0.85rem;
    color: var(--text-dim);
    opacity: 0.6;
    font-weight: 600;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Reader Styles */
.upload-container {
    width: 100%;
    min-height: 200px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 2rem;
}

.upload-container:hover, .upload-container.dragover {
    border-color: #00c6ff;
    background: rgba(0, 198, 255, 0.05);
}

.upload-container i {
    font-size: 3rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
    transition: all 0.3s;
}

.upload-container:hover i {
    color: #00c6ff;
    transform: translateY(-5px);
}

.upload-container p {
    color: var(--text-dim);
    font-size: 0.95rem;
}

.result-container {
    text-align: left;
    margin-top: 1.5rem;
}

.result-container h3 {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-box {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#reader-result {
    width: 100%;
    min-height: 80px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    color: var(--text-white);
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    outline: none;
}

#copy-reader-result-btn {
    background: var(--primary-grad);
    color: white;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--bg-dark);
    margin: 10% auto;
    padding: 2.5rem;
    border: 1px solid var(--card-border);
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 2rem;
    padding: 0;
    width: auto;
    cursor: pointer;
}

.setting-item {
    text-align: left;
    margin-bottom: 2rem;
}

.setting-item label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: var(--text-white);
}

.setting-item input {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-white);
}

.setting-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.8rem;
    line-height: 1.4;
}

.primary-btn {
    background: var(--primary-grad);
    color: white;
}