/* カラーバリアブル */
:root {
	--primary-color: #4a6fa5;
	--primary-dark: #3a5a80;
	--bg-color: #f5f7fa;
	--text-color: #333;
	--border-color: #ddd;
	--shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }
body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	line-height: 1.6;
	color: var(--text-color);
	background-color: var(--bg-color);
	padding: 20px;
}

.container {
	max-width: 1000px;
	margin: 0 auto;
	background: #fff;
	border-radius: 8px;
	box-shadow: var(--shadow);
	padding: 24px;
}

h1 { text-align: center; color: var(--primary-color); margin: 0 0 12px; }
.description { text-align: center; color: #666; margin-bottom: 20px; }

.drop-area {
	border: 2px dashed var(--border-color);
	border-radius: 8px;
	padding: 24px;
	text-align: center;
	background: #f9f9f9;
	transition: all .2s;
	position: relative;
	margin-bottom: 16px;
}
.drop-area.dragover { border-color: var(--primary-color); background: rgba(74,111,165,.05); }
.drop-area p { margin: 0 0 10px; color: #666; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.select-button {
	background: var(--primary-color);
	color: #fff;
	border: none;
	padding: 10px 16px;
	border-radius: 4px;
	cursor: pointer;
	transition: background .2s;
}
.select-button:hover { background: var(--primary-dark); }

.workspace { display: grid; grid-template-columns: 1fr; gap: 12px; }
.canvas-wrapper { position: relative; width: 100%; overflow: hidden; user-select: none; }
#imageCanvas { display: block; max-width: 100%; height: auto; }

.crop-overlay {
	position: absolute;
	border: 2px solid #00bcd4;
	box-shadow: 0 0 0 9999px rgba(0,0,0,.35);
	cursor: move;
}
.handle {
	position: absolute;
	width: 12px; height: 12px;
	background: #00bcd4;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.handle.tl { left: -6px; top: -6px; cursor: nwse-resize; }
.handle.tr { right: -6px; top: -6px; cursor: nesw-resize; }
.handle.bl { left: -6px; bottom: -6px; cursor: nesw-resize; }
.handle.br { right: -6px; bottom: -6px; cursor: nwse-resize; }

.controls { display: flex; gap: 10px; align-items: center; }
.aspect-group { display: flex; gap: 6px; align-items: center; }
.aspect-group select { padding: 6px 8px; border: 1px solid var(--border-color); border-radius: 4px; }
.btn { background: var(--primary-color); color: #fff; border: none; padding: 8px 14px; border-radius: 4px; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn:hover { background: var(--primary-dark); }
.clear-btn { background: #f0f0f0; color: #333; }
.clear-btn:hover { background: #e6e6e6; }

.results { margin-top: 20px; }
.result-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.result-item { background: #fafafa; border: 1px solid #eee; border-radius: 6px; padding: 10px; display: grid; gap: 8px; box-shadow: var(--shadow); }
.result-item img { width: 100%; height: 140px; object-fit: contain; background: #fff; border: 1px solid #eee; }
.download-btn { background: var(--primary-color); color: #fff; border: none; padding: 6px 10px; border-radius: 4px; cursor: pointer; justify-self: end; }
.download-btn:hover { background: var(--primary-dark); }

@media (max-width: 768px) {
	.container { padding: 16px; }
	.results { margin-top: 16px; }
}

/* Lightbox */
.lightbox { position: fixed; inset: 0; display: grid; place-items: center; z-index: 1000; }
.lightbox[hidden] { display: none; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); opacity: 1; }
.lightbox-content { position: relative; max-width: 92vw; max-height: 92vh; display: grid; }
.lightbox-content img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 6px; box-shadow: var(--shadow); background: #000; }
.lightbox-close { position: absolute; top: -10px; right: -10px; background: #000; color: #fff; border: 1px solid #555; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 18px; line-height: 28px; }



/* ホームボタンのスタイル */
.home-header {
    background-color: #4CAF50;
    text-align: center;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1000;
    margin-bottom: 20px;
}

.home-button {
    display: inline-block;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

/* PC表示時のスタイル */@media (min-width: 768px) {    .home-header {        text-align: right;        padding: 10px 20px;        background-color: transparent;        box-shadow: none;    }        .home-button {        display: inline-block;        background-color: #4CAF50;        border-radius: 5px;        box-shadow: 0 2px 4px rgba(0,0,0,0.2);        margin-right: 10px;    }        .home-button:hover {        background-color: #45a049;        box-shadow: 0 4px 8px rgba(0,0,0,0.3);        transform: translateY(-2px);    }}
