/* Fonts */
@font-face {
    font-family: 'Tomatoes';
    src: url('../fonts/Tomatoes.eot');
    src: url('../fonts/Tomatoes.eot?#iefix') format('embedded-opentype'),
        url('../fonts/Tomatoes.woff2') format('woff2'),
        url('../fonts/Tomatoes.woff') format('woff'),
        url('../fonts/Tomatoes.ttf') format('truetype'),
        url('../fonts/Tomatoes.svg#Tomatoes') format('svg');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Wizard */
#db-wizard{
	position: absolute!important;
	width: 100vw!important;
	height: calc(100vh - 72px);
	left: 50dvw!important;
	top: 50dvh!important;
	transform: translate(-50dvw, -50dvh)!important;
	background: #efefef;
	max-width: 100vw!important;
	text-align: center;
}

#db-wizard .db-wizard-item-wrap{
	width: 90dvw;
	height: 80dvw;
	max-height: 60dvh;
    max-width: 50dvw;
	display: inline-grid;
	position: relative;
	text-align: center;
}

#db-wizard .db-wizard-item-wrap .db-item-image{
	max-width: 90%;
	max-height: 90%;
	position: absolute;
	top: 50%;
	left: calc(50% + 10px);
	transform: translate(-50%, -50%);
}

#db-wizard .db-dresser-image{
	max-height: 60dvh;
	max-width: 50dvw;
}

#db-wizard .db-dresser-selector, #db-wizard .db-item-selector{
	width: 100dvw;
	margin: auto;
	position: relative;
}

#db-wizard-content{
	position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#db-wizard-content h2{
	margin-bottom: 40px;
}

#db-wizard .db-dresser-selector .previous, #db-wizard .db-item-selector .previous{
	position: absolute;
	left: 10%;
	top: 40%;
	outline: none!important;
	border: 0;
	background: none;
	cursor: pointer;
}

#db-wizard .db-dresser-selector .previous svg, #db-wizard .db-item-selector .previous svg{
	width:48px;
	height:48px;
	color: #000;
}

#db-wizard .db-dresser-selector .next, #db-wizard .db-item-selector .next{
	position: absolute;
	right: 10%;
	top: 40%;
	outline: none!important;
	border: 0;
	background: none;
	cursor: pointer;
}

#db-wizard .db-dresser-selector .next svg, #db-wizard .db-item-selector .next svg{
	width: 48px;
	height: 48px;
	color: #000;
}

#db-wizard .select-button, #db-wizard .skip-button, #db-wizard .save-state{
	font-size: 20px;
	padding: 8px 12px;
	cursor: pointer;
	border-radius: 3px;
	margin: 6px;
}

#db-wizard .db-item-image{
	z-index: -1;
}

#db-wizard .db-frame-uploader .db-upload-prompt{
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-53%, -55%) rotate(8deg) perspective(40px) rotatey(-0.4deg) skew(0deg, -3deg);
	z-index: 9;
	border: 2px dashed #666;
	text-align: center;
	display: inline-flex;
	align-items: center;
	border-radius: 8px;
	font-size: clamp(12px, 20px, 20px);
	padding: clamp(2%, 14px, 2%);
	box-sizing: border-box;
	background-color:rgba(255,255,255,0.6);
	max-height: 54%;
	max-width: 52%;
	width: auto;
	height: auto;
	aspect-ratio: 180 / 310;
	line-height: 31px;
}

@media only screen and (max-width: 460px), screen and (max-height: 572px){
	#db-wizard .db-frame-uploader .db-upload-prompt{
		font-size:12px;
		line-height: 12px;
	}
}

#db-wizard .db-frame-uploader .db-upload-preview{
	width: auto;
	height: auto;
	max-height: 64%;
	max-width: 70%;
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-61%, -53%) perspective(100px) rotatey(-1deg) rotate(7deg) skew(-1deg);
	z-index: -2;
	text-align: center;
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	transform-origin: right bottom;
	aspect-ratio: 180 / 290;
}

#db-wizard .db-frame-uploader.has-photo .db-upload-prompt{
	z-index: -2;
}

#db-wizard .db-frame-uploader.has-photo:hover .db-upload-prompt{
	z-index: 1;	
}

#db-wizard .db-frame-uploader .db-upload-preview .db-uploaded-photo{
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Container styling */
#dresser-container{
	background: #efefef url('../img/background.png') center bottom/cover no-repeat;
	position: absolute!important;
	width: 100dvw!important;
	height: 70dvw;
	max-height: calc(100dvh - 126px);
	left: 50dvw!important;
	top: 50dvh !important;
	transform: translate(-50dvw, -50dvh)!important;
	max-width: 100vw!important;
	text-align: center;
	padding-bottom: 80px;
	box-sizing: border-box;
}

/* Dresser */
.dresser-image-wrapper {
	position: absolute;
	bottom: 3%;
	left: 50%;
	transform: translateX(-50%);
	display: block;
	overflow: visible;
}

.dresser-image-wrapper .dresser-base {
	display: block;
	width: 100%;
	height: auto;
	max-width: 80dvw;
	max-height: 54dvh;
	background: url('../img/shadow.png')center bottom/contain no-repeat;
}

#drawer-drop-zone {
	position: absolute;
	pointer-events: none;
}

/* Items */
#dresser-container .item.small{
	max-width: 80px;
	max-height: 80px;
}

#dresser-container .item.medium{
	max-width: 140px;
	max-height: 140px;
}

#dresser-container .item.large{
	max-width: 260px;
	max-height: 260px;
}

#dresser-container .item.db-toggled{
	filter:brightness(1) saturate(1) drop-shadow(0 -30px 25px rgba(255,235,170,.15)) drop-shadow(0 -50px 45px rgba(255,225,140,.1)) drop-shadow(0 -30px 90px rgba(255,210,120,.05));
}

/* Photo Frame */
.frame-wrapper{
	display:block;
	top:0;
	right:0;
}

.frame-wrapper .photo-frame-photo-container{
	position: absolute;
	top: calc(50% + 12%);
	left: calc(50% - 10%);
	transform: translate(-50%, -50%) perspective(100px) rotatey(-1deg) rotate(7deg) skew(-1deg);
	text-align: center;
	border-radius: 8px;
	font-size: 20px;
	padding: 8%;
	box-sizing: border-box;
	transform-origin: right bottom;
	width: 120px;
	height: calc(100% + 3%);
	z-index: -1;
}

.frame-wrapper .photo-frame-base{
	width: 100%;
	z-index: 1;
}

.frame-wrapper .photo-frame-photo{
	height:100%;
	width:100%;
	object-fit: cover;
}

/* Draggable item styling */
.movable{
	position: absolute;
	touch-action: none;
}

/* Save Button */
#dresser-buttons-bar{
	position: absolute;
	bottom: -64px;
	background-color: #ccc;
	display: block;
	width: 100dvw;
	left: 50%;
	transform: translateX(-50%);
	font-size: 20px;
	padding: 16px;
	height: 72px;
	cursor: pointer;
	box-sizing: border-box;
}

#dresser-buttons-bar .button{
	font-size: 16px;
	padding: 8px 12px;
	cursor: pointer;
	background: #000;
	border: 0;
	color: #fff;
	margin: 0 6px;
	border-radius: 3px;
}
#save-button img{
	width: 32px;
    margin: -6px -6px -11px -3px;
    padding: 0;
}


/* Modal frame uploader */
.db-modal .db-wizard-item-wrap{
	position:relative;
	display:inline-grid;
	place-items:center;
	max-width:90vw;
	max-height:90vh;
	width: 90vw;
	height: 90vh;
	text-align:center;
}

.db-modal .db-wizard-item-wrap .db-item-image{
	position:absolute;
	top:50%;
	left: 51%;
	transform:translate(-50%,-50%);
	max-width:90%;
	max-height:90%;
	height:auto;
	width:auto;
	z-index: 1;
}

.db-modal .db-frame-uploader{
	position:relative;
	width:100%;
	height:100%;
}

.db-modal .db-frame-uploader .db-upload-prompt{
	position:absolute;
	left:50%;
	top:50%;
	transform:translate(-53%,-55%) rotate(8deg) perspective(40px) rotatey(-0.4deg) skew(0deg,-3deg);
	z-index:9;
	border:2px dashed #666;
	border-radius:8px;
	background-color:rgba(255,255,255,0.6);
	padding:clamp(2%,14px,2%);
	font-size:clamp(12px,20px,20px);
	line-height:31px;
	display:inline-flex;
	align-items:center;
	justify-content:center;
	cursor:pointer;
	max-width:52%;
	max-height:54%;
	width:auto;
	height:auto;
	aspect-ratio:180/310;
	text-align:center;
	box-sizing:border-box;
}

.db-modal .db-frame-uploader .db-upload-preview{
	position:absolute;
	left:50%;
	top:50%;
	transform: translate(-62%,-53%) perspective(100px) rotatey(-1deg) rotate(7deg) skew(-1deg);
	transform-origin:right bottom;
	z-index: 0;
	display:inline-flex;
	align-items:center;
	justify-content:center;
	width:auto;
	height:auto;
	max-width:70%;
	max-height:64%;
	aspect-ratio:180/290;
	box-sizing:border-box;
}

.db-modal .db-frame-uploader .db-upload-preview .db-uploaded-photo{
	width:100%;
	height:100%;
	object-fit:cover;
}

.db-modal .db-frame-uploader.has-photo .db-upload-prompt{
	z-index: -2;
}

.db-modal .db-wizard-item-wrap:hover .db-upload-prompt{
	z-index:1;
}

.db-modal .db-frame-uploader.drag-over .db-upload-prompt{
	border-color:#333;
}

/* Small viewport tweak: keep prompt text readable */
@media only screen and (max-width:460px),screen and (max-height:572px){
	.db-modal .db-frame-uploader .db-upload-prompt{
		font-size:12px;
		line-height:12px;
	}
}

/* Modal */
.db-modal{
	position:fixed;
	inset:0;
	background:rgba(0,0,0,.8);
	display:none;
	align-items:center;
	justify-content:center;
	z-index:9999;
}

.db-modal[aria-hidden="false"]{
	display:flex;
}

.db-modal-content{
	background: #fff;
	width: 90dvw;
	height: 84dvh;
	border-radius: 10px;
	box-shadow:none;
	position:relative;
	padding:0;
	display:flex;
	align-items:center;
	justify-content:center;
	overflow:hidden;
}

.db-modal-body{
	width: 89dvw;
	height: 90dvh;
	display:flex;
	align-items:center;
	justify-content:center;
	overflow:hidden;
}

#db-modal-image{
	display:block;
	width: 90%;
	height: 80%;
	object-fit:contain;
	position: relative;
	top: -3%;
}

#db-modal-image.db-toggled{
	filter:brightness(1) saturate(1) drop-shadow(0 -30px 25px rgba(255,235,170,.3)) drop-shadow(0 -50px 45px rgba(255,225,140,.05)) drop-shadow(0 -30px 90px rgba(255,210,120,.03));
}

.db-modal-close{
	position:absolute;
	top:8px;
	right:8px;
	padding:0;
	margin:0;
	z-index: 5;
	background: none;
	background-color: #333!important;
	color: #000!important;
	border: 2px solid #000;
	border-radius: 50%;
	width:36px;
	height:36px;
	font-size: 52px;
	text-align:center;
	cursor:pointer;
}

.db-modal-close svg{
	position: absolute;
	width: 20px;
	height: 20px;
	top: 6px;
	left: 6px;
	color:#fff;
	stroke: #fff;
}

/* Modal item toolbar */
.db-modal .db-modal-toolbar{
	position:absolute;
	bottom:16px;
	left:50%;
	transform:translateX(-50%);
	display:flex;
	gap:12px;
}

.db-modal .db-modal-button{
	border: 1px solid #333;
	background: #999;
	padding:8px 12px;
	border-radius:6px;
	cursor:pointer;
	font:inherit;
}

.db-modal .db-modal-button svg{
	position: relative;
	top:1px;
	margin-right:10px;
}

.db-modal .db-modal-button[aria-pressed="true"]{
	background:#111;
	color:#fff;
	border-color:#111;
}

/* Notepad overlay */
#dresser-container .db-note-overlay{
	position:absolute;
	pointer-events:none;
	white-space:pre-wrap;
	overflow:visible;
	overflow-wrap:anywhere;
	font-size: 12%;
	padding: 0.4% 1% 0px 1.4%;
	text-align: left;
	clip-path: polygon(28% 0%, 74% 9%, 85% 78%,18% 77%);
}

/* Modal: textarea over image */
#db-item-modal .db-modal-body{
	position:relative;
}

#db-item-modal .db-modal-img-wrap{
	position:relative;
	display:inline-block;
}

#db-item-modal .db-modal-img-wrap img{
	display:block;
}

/* Notepad-only modal sizing (doesn't affect other items) */
.db-modal.db-notepad .db-modal-img-wrap{
	position:relative;
	display:inline-block;
	max-width:90%;
	max-height:80%;
	overflow:hidden;
	container-type:size;
}

.db-modal.db-notepad #db-modal-image{
	display:block;
	width:100%;
	height:auto;
	position:static;
	top:auto;
}

.db-modal.db-notepad .db-modal-img-wrap .db-note-input{
	position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    border: 0;
    outline: 0;
    resize: none;
    padding: 13% 14% 6% 16%;
    margin: 0;
    font-family: 'Tomatoes', cursive;
    color: #063970;
	font-weight: bold;
    font-size: clamp(4px, 2.8cqw, 36px);
    line-height: clamp(4px, 5.3cqh, 44px);
}