body,
html {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #ffeef8 0%, #f0f8ff 50%, #fff0f8 100%);
    color: #5a4a6b;
    height: 100vh;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
}

/* 全体を囲むコンテナ */
.app-container {
    display: grid;
    grid-template-rows: 65px 1fr;
    height: 100%;
}

/* ヘッダーエリア */
.app-header {
    grid-row: 1 / 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    background: linear-gradient(135deg, #ffeef8, #fff5f8);
    border-bottom: 2px solid #f8e8f5;
    box-shadow: 0 2px 8px rgba(255, 182, 222, 0.2);
    z-index: 10;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    margin-right: 10px;
    font-weight: 700;
    font-size: 1.4em;
    color: #d63384;
    font-family: 'Comfortaa', sans-serif;
    text-shadow: 0 1px 3px rgba(214, 51, 132, 0.3);
}

.file-name {
    border: 2px solid #f8d7da;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9em;
    background: linear-gradient(135deg, #fff, #fef7f8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

.controls {
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    padding: 0;
    margin: 0;
}

.controls legend {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.controls label {
    font-size: 0.85em;
    color: #6f42c1;
    font-weight: 600;
}

.controls select,
.controls input[type="number"] {
    border: 2px solid #e9c9f0;
    border-radius: 15px;
    padding: 6px 12px;
    font-size: 0.85em;
    background: linear-gradient(135deg, #fff, #fef8ff);
    font-weight: 500;
    transition: all 0.3s ease;
}

.controls select:focus,
.controls input[type="number"]:focus {
    outline: none;
    border-color: #d63384;
    box-shadow: 0 0 0 3px rgba(214, 51, 132, 0.2);
}

.controls input[type="number"] {
    width: 70px;
}

.controls button {
    background: linear-gradient(135deg, #f8d7da, #f5c2c7);
    border: 2px solid #f1aeb5;
    border-radius: 18px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #721c24;
}

.controls button:hover {
    background: linear-gradient(135deg, #f5c2c7, #f1aeb5);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(241, 174, 181, 0.4);
}

.tool-button {
    background: linear-gradient(135deg, #e2e3f3, #d6d8e8);
    border: 2px solid #c5c8d9;
    border-radius: 18px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 600;
    color: #495057;
    transition: all 0.3s ease;
}

.tool-button:hover {
    background: linear-gradient(135deg, #d6d8e8, #c5c8d9);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(197, 200, 217, 0.4);
}

.button-primary {
    width: 100%;
    background: linear-gradient(135deg, #d63384, #b02a5b);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(214, 51, 132, 0.3);
    font-size: 0.9em;
}

.button-primary:hover {
    background: linear-gradient(135deg, #b02a5b, #8e1f47);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(214, 51, 132, 0.4);
}

.user-profile {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #ffeef8, #f8d7da);
    border: 3px solid #f1aeb5;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4em;
    box-shadow: 0 3px 8px rgba(241, 174, 181, 0.3);
    transition: all 0.3s ease;
}

.user-profile:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(241, 174, 181, 0.4);
}

/* メインコンテンツエリア */
.main-content {
    grid-row: 2 / 3;
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    overflow: hidden;
}

/* 左サイドバー */
.left-sidebar {
    grid-column: 1 / 2;
    background: linear-gradient(180deg, #fef7ff 0%, #fff 100%);
    border-right: 2px solid #f8e8f5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 2px 0 8px rgba(248, 232, 245, 0.3);
}

.tool-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tool-panel {
    padding: 20px 12px 12px 12px;
    border-bottom: 2px solid #f8e8f5;
}

.tool-panel li a {
    display: block;
    padding: 14px 18px;
    text-decoration: none;
    color: #6f42c1;
    border-radius: 18px;
    margin-bottom: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.tool-panel li a::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.3s ease;
}

.tool-panel li.active a,
.tool-panel li a:hover {
    background: linear-gradient(135deg, #e8d5ff, #f3e8ff);
    color: #6610f2;
    transform: translateX(4px);
    box-shadow: 0 3px 8px rgba(102, 16, 242, 0.2);
}

.tool-panel li a i {
    margin-right: 10px;
}

.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

/* 素材パネルのスタイル */
.material-category {
    margin-bottom: 28px;
}

.material-category h3 {
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 16px;
    color: #d63384;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.material-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.material-item img {
    width: 100%;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid #f8e8f5;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(248, 232, 245, 0.3);
    background: linear-gradient(135deg, #cccccc, #bbbbbb);
}

.material-item img:hover {
    border-color: #d63384;
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(214, 51, 132, 0.3);
    background: linear-gradient(135deg, #888888, #444444);
}

/* テキスト追加パネルのスタイル */
.add-text-btn {
    display: block;
    width: 100%;
    padding: 16px;
    margin-bottom: 12px;
    font-size: 1em;
    text-align: left;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #495057;
}

.add-text-btn:hover {
    background: linear-gradient(135deg, #888888, #444444);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(222, 226, 230, 0.4);
}

.sample1 {
    font-size: 40px;
    font-family: 'Hachi Maru Pop';
    font-weight: 900;
    color: #FF2DF1;
    text-shadow: 0px 0px 8px #FFFFFF;
}

.sample2 {
    font-size: 40px;
    font-family: 'Dela Gothic One';
    font-weight: 400;
    color: #333333;
    text-shadow: 2px 2px 0px #FFFFFF;
}

.sample3 {
    font-size: 40px;
    font-family: 'Kaisei Decol';
    font-weight: 900;
    color: #FFFFFF;
    text-shadow: 0px 0px 15px #00CAFF;
}

.sample4 {
    font-size: 40px;
    font-family: 'Meiryo';
    font-weight: 900;
    color: #000000;
}


/* 図形パネルのスタイル */
.shape-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.add-shape-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 85px;
    font-size: 2.8em;
    background: linear-gradient(135deg, #fff5f8, #fef7ff);
    border: 2px solid #f8d7da;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ff0080;
    box-shadow: 0 2px 6px rgba(248, 215, 218, 0.2);
}

.add-shape-btn:hover {
    background: linear-gradient(135deg, #fef7ff, #f5e1ff);
    color: #d63384;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 16, 242, 0.2);
}

.shape-line {
    color: #00000000;
    -webkit-text-stroke: 4px #ff0080;
}

.shape-line:hover {
    color: #00000000;
    -webkit-text-stroke: 4px #d63384;
}


/* 中央キャンバスエリア */
.canvas-area {
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, rgba(255, 238, 248, 0.05) 100%);
}

.canvas-area.drag-over {
    outline: 4px dashed #d63384;
    outline-offset: -10px;
    background: radial-gradient(circle at center, rgba(214, 51, 132, 0.1) 0%, rgba(214, 51, 132, 0.05) 100%);
}

.canvas-container {
    box-shadow: 0 8px 24px rgba(214, 51, 132, 0.15), 0 0 0 4px #ffeef8;
    background-color: white;
}

#editor-canvas {
    max-width: 100%;
    max-height: 100%;
}

/* 右サイドバー */
.right-sidebar {
    grid-column: 3 / 4;
    background: linear-gradient(180deg, #fff5f8 0%, #fff 100%);
    border-left: 2px solid #f8e8f5;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 8px rgba(248, 232, 245, 0.3);
}

.tabs {
    display: flex;
    border-bottom: 2px solid #f8e8f5;
    background: linear-gradient(135deg, #ffeef8, #fff5f8);
}

.tab-button {
    flex-grow: 1;
    padding: 14px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #8e44ad;
    transition: all 0.3s ease;
}

.tab-button.active {
    color: #d63384;
    border-bottom-color: #d63384;
    background: linear-gradient(135deg, rgba(214, 51, 132, 0.1), rgba(214, 51, 132, 0.05));
}

.tab-button:hover:not(.active) {
    color: #6610f2;
    background: linear-gradient(135deg, rgba(102, 16, 242, 0.05), rgba(102, 16, 242, 0.02));
}

.sidebar-content-right {
    flex-grow: 1;
    position: relative;
    overflow-y: auto;
}

.sidebar-content-right .panel {
    padding: 24px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#property-panel-controls {
    padding-bottom: 5px;
}

/* 右サイドバーのプロパティパネル */
.property-group {
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fef7ff, #fff);
    border: 2px solid #f8e8f5;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(248, 232, 245, 0.2);
}

.property-group h4 {
    font-size: 0.95em;
    color: #d63384;
    margin: 0 0 12px 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f3e8ff;
}

.property-group label {
    font-size: 0.85em;
    color: #495057;
    display: block;
    margin: 6px 0;
    font-weight: 600;
}

.property-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.property-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e9c9f0;
    border-radius: 12px;
    font-size: 0.9em;
    box-sizing: border-box;
    background: linear-gradient(135deg, #fff, #fef8ff);
    font-weight: 500;
    transition: all 0.3s ease;
}

.property-input:focus {
    outline: none;
    border-color: #d63384;
    box-shadow: 0 0 0 3px rgba(214, 51, 132, 0.2);
}

.property-input[type="color"] {
    padding: 4px;
    height: 38px;
    background-color: #fff;
    cursor: pointer;
}

#image-filter-controls button {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: linear-gradient(135deg, #f8d7da, #f5c2c7);
    border: 2px solid #f1aeb5;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #721c24;
    transition: all 0.3s ease;
}

#image-filter-controls button:hover {
    background: linear-gradient(135deg, #f5c2c7, #f1aeb5);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(241, 174, 181, 0.3);
}

#bg-type-selector {
    gap: 0;
    border: 1px solid #ced4da;
    border-radius: 6px;
    overflow: hidden;
    padding: 0;
}

#bg-type-selector label {
    display: block;
    margin: 0;
    padding: 8px 10px;
    text-align: center;
    cursor: pointer;
    background-color: #fff;
    color: #495057;
    transition: background-color 0.2s, color 0.2s;
    user-select: none;
    font-size: 12px;
}

#bg-type-selector label:first-of-type {
    border-right: 1px solid #ced4da;
}

#bg-type-selector input[type="radio"] {
    display: none;
}

#bg-type-selector label:not(:has(input:checked)):hover {
    background-color: #f0f2f5;
}

#bg-type-selector label:has(input:checked) {
    background-color: #d63384;
    color: #fff;
    border-color: #d63384;
}

/* 右サイドバーのレイヤーパネル */
#layer-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 2px solid #f8e8f5;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #fff, #fef7ff);
}

.layer-item:hover {
    background: linear-gradient(135deg, #f3e8ff, #e8d5ff);
    transform: translateX(4px);
}

.layer-item.selected {
    background: linear-gradient(135deg, #e8d5ff, #d4c5f9);
    font-weight: 700;
    color: #6610f2;
    box-shadow: 0 3px 8px rgba(102, 16, 242, 0.2);
}

.layer-icon {
    margin-right: 12px;
    font-size: 1.2em;
    width: 24px;
    text-align: center;
}

.layer-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9em;
    font-weight: 600;
}

.layer-actions {
    margin-left: auto;
    padding-left: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.layer-visibility-toggle,
.layer-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3em;
    padding: 4px 6px;
    color: #8e44ad;
    line-height: 1;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.layer-visibility-toggle:hover {
    color: #6610f2;
    background: rgba(102, 16, 242, 0.1);
}

.layer-delete-btn:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

/* ドラッグ＆ドロップ用のスタイル */
.layer-item.dragging {
    opacity: 0.6;
    background: linear-gradient(135deg, #d4eaff, #b8d7ff);
    transform: rotate(2deg);
}

.layer-item.drag-over-top {
    border-top: 3px solid #d63384;
}

.layer-item.drag-over-bottom {
    border-bottom: 3px solid #d63384;
}

/* モーダルパネルのスタイル */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(214, 51, 132, 0.8), rgba(102, 16, 242, 0.6));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: linear-gradient(135deg, #fff, #fef7ff);
    padding: 30px 35px;
    border-radius: 5px;
    width: 90%;
    max-width: 650px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(214, 51, 132, 0.3), 0 0 0 4px rgba(255, 255, 255, 0.1);
    animation: modalFadeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid #f8e8f5;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f8e8f5;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #6610f2;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2::before {
    content: "💡";
    font-size: 1.2em;
}

.close-button {
    background: linear-gradient(135deg, #f8d7da, #f5c2c7);
    border: 2px solid #f1aeb5;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #721c24;
    padding: 8px 12px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-button:hover {
    background: linear-gradient(135deg, #f5c2c7, #f1aeb5);
    transform: rotate(90deg);
    box-shadow: 0 4px 12px rgba(241, 174, 181, 0.4);
}

.modal-body {
    color: #495057;
    line-height: 1.8;
    font-weight: 500;
}

.modal-body h4 {
    margin-top: 1.8em;
    margin-bottom: 0.8em;
    color: #6610f2;
    border-left: 4px solid #d63384;
    background: linear-gradient(135deg, rgba(214, 51, 132, 0.05), rgba(102, 16, 242, 0.05));
    padding: 12px 16px;
    border-radius: 0 12px 12px 0;
    font-weight: 700;
}

.modal-body ul {
    padding-left: 24px;
    list-style: none;
}

.modal-body li {
    position: relative;
    margin-bottom: 8px;
}

.modal-body li::before {
    content: "🌟";
    position: absolute;
    left: -24px;
    top: 0;
}

/* スクロールバーのカスタマイズ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f8e8f5;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #d63384, #6610f2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #b02a5b, #4c0d9b);
}

/* Xボタン */
.button-x-wrap {
    display: flex;
    justify-content: center;
    gap: 50px;
}

.button-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    margin-top: 10px;
    border-radius: 30px;
    background-color: #000;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1em;
    transition: all 0.3s ease;
}

.button-x:hover {
    background-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}