:root {
    --primary: #4a90e2;
    --primary-hover: #357abd;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #333333;
    --border: #e1e4e8;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.container {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-width: 600px;
    width: 100%;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

header {
    text-align: center;
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1a1a1a;
}

header p {
    font-size: 14px;
    color: #666;
}

.mode-switch {
    display: flex;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 4px;
}

.mode-switch button {
    flex: 1;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    background: transparent;
    transition: all 0.2s;
}

.mode-switch button.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 14px;
    font-weight: 600;
    color: #444;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    background: #f9f9f9;
    padding: 16px;
    border-radius: 8px;
}

.control-group {
    flex: 1;
    min-width: 140px;
    display: flex;
    gap: 12px;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.control-item label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-item input[type="number"],
.control-item input[type="color"],
.control-item select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

input[type="color"] {
    height: 40px;
    cursor: pointer;
}

.logo-upload {
    position: relative;
}

.upload-hint {
    display: block;
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-top: 4px;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    flex: 2;
    min-width: 120px;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.output-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #fafafa;
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

.placeholder {
    color: #999;
    font-size: 14px;
}

.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    width: 100%;
}

.qr-item {
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
}

.qr-item canvas, .qr-item img {
    max-width: 100%;
    height: auto;
    margin-bottom: 8px;
    border-radius: 4px;
}

.qr-item .text-label {
    font-size: 12px;
    color: #666;
    word-break: break-all;
    margin-bottom: 8px;
    display: block;
}

.qr-item .download-single {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
    font-size: 13px;
}

.btn-secondary:hover {
    background: var(--primary);
    color: #fff;
}

.download-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 16px;
}

.history-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-header h3 {
    font-size: 16px;
    color: #444;
}

.btn-text {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 12px;
}

.btn-text:hover {
    color: #e74c3c;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.history-item {
    background: white;
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid var(--border);
}

.history-item:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.history-item img {
    width: 100%;
    height: auto;
    display: block;
}

footer {
    text-align: center;
    font-size: 12px;
    color: #999;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}