* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    background-image: url('images/background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 10px;
    touch-action: pan-x pan-y;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(245, 245, 245, 0.5);
    z-index: -1;
}

@media (min-width: 768px) {
    body {
        padding: 20px;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    touch-action: pan-x pan-y;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

.editor-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    overflow: hidden;
    touch-action: pan-x pan-y;
}

@media (min-width: 768px) {
    .editor-container {
        flex-direction: row;
        padding: 20px;
    }
}

.canvas-container {
    position: relative;
    min-height: 300px;
    flex: 2;
    background-color: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
    width: 100%;
    height: 100%;
    touch-action: none;
}

@media (min-width: 768px) {
    .canvas-container {
        min-height: 400px;
    }
}

#imageCanvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
    touch-action: none;
}

.text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    touch-action: none;
}

.text-element {
    position: absolute;
    cursor: move;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px;
    border-radius: 3px;
    pointer-events: auto;
    user-select: none;
    border: 1px dashed transparent;
    touch-action: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    min-width: 50px;
    min-height: 20px;
}

.text-element:hover, .text-element.active {
    border: 1px dashed #3498db;
    z-index: 10;
}

.text-element.editable {
    cursor: move;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #3498db;
    min-width: 100px;
    min-height: 20px;
    outline: none;
    transition: all 0.2s ease;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    transform-origin: center;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.2;
}

.text-element.editable:focus {
    background-color: rgba(255, 255, 255, 0.95);
    border: 2px solid #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
    cursor: text;
}

.text-element.editable:hover {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #2980b9;
}

.control-panel {
    flex: 1;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
    margin-top: 15px;
    touch-action: pan-x pan-y;
}

@media (min-width: 768px) {
    .control-panel {
        margin-top: 0;
        margin-left: 20px;
        padding: 20px;
    }
}

.text-controls h3, .text-elements-list h3 {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    color: #2c3e50;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.control-group input[type="text"],
.control-group select,
.control-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation;
    font-family: inherit;
}

.control-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.4;
}

.control-group input[type="range"] {
    width: calc(100% - 50px);
    vertical-align: middle;
    height: 6px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    touch-action: pan-x;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    touch-action: pan-x;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    touch-action: pan-x;
}

#fontSizeValue {
    display: inline-block;
    width: 45px;
    text-align: right;
}

.action-buttons {
    margin-top: 20px;
}

.action-buttons button {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    font-size: 16px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

.action-buttons button:hover {
    background-color: #27ae60;
}

.action-buttons button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

#addTextBtn {
    background-color: #3498db;
}

#addTextBtn:hover {
    background-color: #27ae60;
}

.download-notice {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
    text-align: center;
    line-height: 1.4;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

@media (max-width: 767px) {
    .download-notice {
        font-size: 11px;
        padding: 6px;
    }
}

.text-elements-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    margin-bottom: 30px;
    touch-action: pan-x pan-y;
}

@media (min-width: 768px) {
    .text-elements-list {
        padding: 20px;
    }
}

#textItemsList {
    list-style: none;
}

.text-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.text-item:last-child {
    border-bottom: none;
}

.text-item-content {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: #e74c3c;
    margin-left: 10px;
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 3px;
    touch-action: manipulation;
}

.text-item-actions button:hover {
    color: #c0392b;
    background-color: rgba(231, 76, 60, 0.1);
}

/* スマートフォン用の追加スタイル */
@media (max-width: 767px) {
    .control-group input[type="text"],
    .control-group select {
        font-size: 16px;
        padding: 12px;
    }
    
    .action-buttons button {
        padding: 15px;
        font-size: 16px;
    }
    
    .text-element {
        min-width: 80px;
        min-height: 30px;
        padding: 8px;
    }
    
    .text-element.editable {
        min-width: 120px;
        min-height: 30px;
    }
} 