:root {
	color-scheme: light;
	--background: #f5f3ef;
	--surface: #fffdfa;
	--line: #e3ded5;
	--text: #272432;
	--muted: #69636b;
	--accent: #a33a1d;
	--action: #ab3c21;
	--soft: #f9f3eb;
	--error: #a3293a;
	--page-gutter: clamp(1rem, 2.5vw, 1.5rem);
	--page-width: 72rem;
	font-family: 'Pretendard', 'Malgun Gothic', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
	margin: 0;
	background: radial-gradient(ellipse at 8% 1%, #f8e8d8 0, transparent 34rem), var(--background);
	color: var(--text);
}
/* 모든 화면과 푸터에 같은 반응형 바깥 여백을 적용한다. */
main, .site-footer { width: min(calc(100% - 2 * var(--page-gutter)), var(--page-width)); margin: 0 auto; }
main { padding-bottom: 3rem; }
.site-footer { border-top: 1px solid var(--line); padding: .75rem 0 2rem; font-size: .875rem; line-height: 1.6; text-align: center; }
.site-footer p { max-width: 46rem; margin: .5rem auto; color: var(--muted); }
.footer-policies { display: flex; flex-wrap: wrap; justify-content: center; gap: .15rem 1rem; }
.footer-policies a { padding: .32rem 0; color: var(--text); font-weight: 650; text-underline-offset: .22em; }
.footer-policies a:hover { color: var(--accent); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

.contact-symbols { position: absolute; pointer-events: none; }
.footer-contact { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .2rem; margin-top: .8rem; }
.footer-contact strong { margin-right: .5rem; }
.contact-action {
	display: inline-flex; align-items: center; min-height: 2.5rem; padding: .35rem;
	border: 0; border-radius: .45rem; background: transparent; color: var(--text);
	font-size: .875rem; font-weight: 650; text-decoration: none;
}
.contact-action:is(:hover, :focus-visible) { background: var(--soft); }
.contact-icon { display: block; width: 1.8rem; height: 1.8rem; padding: .27rem; border-radius: .45rem; }
.contact-kakao-icon { color: #302018; background: #fee500; }
.contact-mail-icon { color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.contact-status { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
/* 복사 결과는 연락처 아래에 표시해 연락처 줄의 가운데 위치를 유지한다. */
.footer-contact .contact-status { flex-basis: 100%; }
.footer-contact .contact-status:empty { position: absolute; }

.masthead { display: flex; align-items: center; min-height: 4.2rem; border-bottom: 1px solid #ded4ca; }
.wordmark {
	display: inline-flex; align-items: center; gap: .63rem; color: var(--text); font-size: .95rem;
	font-weight: 850; letter-spacing: .13em; text-decoration: none;
}
.wordmark-icon {
	flex: none; width: 1.9rem; height: 1.9rem; object-fit: contain; image-rendering: pixelated;
}
.wordmark-beta {
	border: 1px solid var(--line); border-radius: .35rem; padding: .15rem .35rem;
	color: var(--accent); font-size: .68rem; letter-spacing: 0; white-space: nowrap;
}
form label { display: block; margin-bottom: .45rem; color: var(--muted); font-size: .85rem; font-weight: 600; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
input, button, select, textarea {
	min-width: 0; border: 1px solid var(--line); border-radius: .55rem; padding: .72rem .8rem;
	background: var(--surface); color: var(--text); font: inherit;
}
button { background: var(--action); color: #fff; border-color: transparent; font-weight: 750; cursor: pointer; }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
button:not(:disabled):hover { filter: brightness(.96); }
button:disabled { cursor: default; opacity: .53; }
input:focus-visible, button:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
	outline: 2px solid var(--accent); outline-offset: 3px;
}

.status { color: var(--muted); line-height: 1.55; font-size: .9rem; }
.status:not(:empty) { margin-top: .75rem; }
.status.error { color: var(--error); }
.panel {
	margin: 1rem 0; padding: clamp(1rem, 3vw, 1.5rem); background: var(--surface);
	border: 1px solid var(--line); border-radius: 1.05rem; box-shadow: 0 8px 24px #38263608; min-width: 0;
}
.panel-heading { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; margin-bottom: 1rem; }
.panel-heading h2 { font-size: 1.15rem; letter-spacing: -.035em; }
#character-name { font-size: clamp(1.3rem, 4vw, 1.85rem); overflow-wrap: anywhere; letter-spacing: -.04em; }
.character-name-with-decorations, .character-decorations {
	display: inline-flex; flex-wrap: wrap; align-items: center; max-width: 100%; min-width: 0;
	gap: .2rem .35rem; vertical-align: middle;
}
.character-title {
	max-width: 100%; padding: .12rem .35rem; border: 1px solid var(--line); border-radius: .35rem;
	color: var(--accent); background: var(--soft); font-size: .75rem; font-weight: 700; line-height: 1.2;
	letter-spacing: 0; overflow-wrap: anywhere; white-space: normal;
}
a.character-title { text-underline-offset: .15em; }
.character-decorations > .character-icon { width: 1rem; height: 1rem; margin: 0; object-fit: contain; }
.character-search-field { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.character-search-field > input { flex: 1 1 0; }
.character-search-field > .character-decorations { max-width: 55%; }
@supports (field-sizing: content) {
	.character-search-field:has(.character-decorations:not([hidden])) > input {
		flex: 0 1 auto; width: auto; min-width: min(3.5rem, 45%); field-sizing: content;
	}
}
#character-meta { margin-top: .3rem; }
.profile-head { display: flex; align-items: center; gap: 1rem; }
.portrait {
	display: grid; place-items: center; flex: 0 0 4.6rem; aspect-ratio: 1; border: 1px solid #efd8c4;
	border-radius: .9rem; background: radial-gradient(circle, #fffbec, #f5e1ce);
}
.portrait img { max-width: 100%; max-height: 4.5rem; image-rendering: pixelated; }
#combat-summary:not(:empty) { margin-top: 1rem; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: .6rem; }
.metric { display: grid; gap: .3rem; padding: .7rem; border: 1px solid var(--line); border-radius: .55rem; min-width: 0; }
.metric span { color: var(--muted); font-size: .8rem; }
.metric strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metrics .wide { grid-column: 1 / -1; padding: .85rem 1rem; border-color: #f0d7c5; background: #fff2e5; }
.metrics .wide strong { color: var(--accent); font-size: clamp(1.35rem, 4vw, 2.2rem); }
.stats:not(:empty) { margin-top: .75rem; }
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.columns .panel { margin: 0; }
.equipment { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); align-items: start; gap: .5rem; }
details { border: 1px solid var(--line); border-radius: .55rem; min-width: 0; padding: .65rem .7rem; }
summary { cursor: pointer; overflow-wrap: anywhere; }
details ul { padding-inline-start: 1.3rem; margin: .7rem 0 .15rem; font-size: .88rem; color: var(--muted); }
li + li { margin-top: .32rem; }
.data-list { list-style: none; margin: 0; padding: 0; }
.data-list li { display: flex; justify-content: space-between; gap: .8rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.data-list li:last-child { border-bottom: 0; }
.data-list span:last-child { flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }

.workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr); gap: 1rem; align-items: start; }
.workspace .panel { margin: 0; }
.workspace-side { display: grid; gap: 1rem; min-width: 0; }
.count { color: var(--accent); font-size: .84rem; font-weight: 700; }
.inventory-frame {
	padding: clamp(.44rem, 1.7vw, 1.15rem); border-radius: .82rem; border: 1px solid #3e3a4d;
	background: radial-gradient(ellipse at 50% 0, #3b3c57, #222334 66%);
}
.inventory-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(.18rem, .8vw, .55rem); }
button.inventory-slot {
	display: grid; grid-template-rows: 2.25rem minmax(1rem, auto); justify-items: center; gap: .22rem;
	position: relative; padding: .38rem .08rem .28rem; min-height: 4.05rem; border-radius: .48rem;
	border: 1px solid #595a70; background: #303144; color: #edebf2; letter-spacing: -.04em;
}
.pet-support-slot { text-align: center; align-content: center; }
.pet-support-slot strong { align-self: center; font-size: .83rem; }
button.inventory-slot[aria-pressed='true'] { background: #4b3b3c; border-color: #ffc69b; box-shadow: inset 0 0 0 1px #ffc69b; }
button.inventory-slot.is-changed { border-color: #e9a878; }
button.inventory-slot.is-changed::after {
	content: ''; position: absolute; right: .23rem; bottom: .22rem; width: .26rem; height: .26rem;
	background: #ffc69b; border-radius: 50%;
}
button.inventory-slot:focus-visible { outline-color: #ffdeba; outline-offset: 2px; }
.slot-icon { display: grid; place-items: center; width: 100%; }
.slot-mark, .slot-icon img { grid-area: 1 / 1; }
.slot-mark { color: #b7b8ca; font-size: .66rem; font-weight: 550; }
.slot-icon:has(.item-icon:not([hidden])) .slot-mark { visibility: hidden; }
.item-icon { height: 2rem; width: 2rem; object-fit: contain; image-rendering: pixelated; }
.slot-label { font-size: clamp(.60rem, 1.03vw, .75rem); align-self: center; overflow-wrap: anywhere; }
.slot-stars {
	position: absolute; top: .16rem; right: .2rem; color: #ffe295; font-size: clamp(.51rem, 1vw, .62rem);
	padding: 0 .19rem; border-radius: .2rem; background: #222334;
}
.inventory-actions { display: flex; flex-wrap: wrap; gap: .43rem; margin-top: .9rem; }
.inventory-actions button { padding: .5rem .65rem; font-size: .82rem; }
.slot-heading { font-size: .9rem; font-weight: 750; margin-bottom: .55rem; color: var(--accent); }
.item-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .55rem; }
.item-card { padding: .75rem; min-width: 0; border: 1px solid var(--line); border-radius: .63rem; background: var(--soft); }
.item-caption { color: var(--muted); font-size: .78rem; }
.item-title { display: flex; align-items: center; gap: .42rem; margin-top: .38rem; font-size: 1rem; overflow-wrap: anywhere; }
.item-title img { flex: 0 0 2rem; }
.item-lines {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: .25rem .8rem;
	list-style: none; padding: .65rem 0 0; margin: .45rem 0 0; border-top: 1px solid var(--line);
	font-size: .8rem; line-height: 1.5; color: var(--muted);
}
.item-lines li { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }

fieldset { margin: .65rem 0 0; padding: .65rem; border: 1px solid var(--line); border-radius: .55rem; }
fieldset label { display: inline-flex; align-items: center; margin: .15rem .7rem .15rem 0; gap: .3rem; }
legend { color: var(--muted); font-size: .9rem; }
input[type='checkbox'] { accent-color: var(--accent); }
fieldset input[type='number'] { width: 5.5rem; padding: .4rem .5rem; }
.comparison-scroll { overflow-x: auto; }

dialog {
	width: min(100% - 2rem, 32rem); max-height: calc(100% - 2rem); padding: 1.25rem; border: 1px solid var(--line);
	border-radius: 1rem; background: var(--surface); color: var(--text); box-shadow: 0 18px 52px #20152950;
}
dialog::backdrop { background: #221d31a0; }
.policy-dialog { width: min(calc(100% - 2rem), 40rem); padding: 0; }
.policy-dialog[open] { display: flex; flex-direction: column; max-height: min(85dvh, 45rem); overflow: hidden; }
.policy-dialog header {
	display: flex; justify-content: space-between; align-items: center; gap: 1rem;
	padding: .9rem clamp(1rem, 4vw, 1.6rem); border-bottom: 1px solid var(--line);
}
.policy-dialog h2 { font-size: 1.2rem; }
.policy-dialog button { padding: .4rem .75rem; font-size: .875rem; }
.policy-body { overflow: auto; overscroll-behavior: contain; padding: 1.2rem clamp(1rem, 4vw, 1.6rem) 1.5rem; }
.policy-body:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.policy-body h3 { margin: 1.25rem 0 .35rem; font-size: 1rem; }
.policy-body h3:first-child { margin-top: 0; }
.policy-body p, .policy-body ul { color: var(--muted); font-size: .92rem; line-height: 1.7; overflow-wrap: anywhere; }
.policy-body p + p, .policy-body ul { margin: .4rem 0 0; }
.policy-body ul { padding-inline-start: 1.4rem; }
.equipment-edit-tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; border-bottom: 1px solid var(--line); padding-bottom: .6rem; }
.equipment-edit-tabs button { padding: .42rem .65rem; font-size: .82rem; }
.equipment-edit-tabs [aria-selected='true'] { background: var(--action); border-color: var(--action); color: #fff; }
.equipment-edit-panel { display: grid; gap: .55rem; }
.equipment-edit-panel label { display: grid; gap: .22rem; min-width: 0; margin: 0; }
.equipment-edit-panel :is(input, select) { width: 100%; padding: .48rem .6rem; }
.edit-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.edit-stat-add { display: flex; align-items: end; gap: .55rem; }
.edit-stat-add label { flex: 1; }
.edit-stat-add button { padding: .48rem .65rem; }

@media (max-width: 49rem) {
	.workspace { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
	.inventory-grid { gap: .4rem; }
}

@media (max-width: 33rem) {
	.columns { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
	.inventory-grid { gap: .24rem; }
}
