

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
	font-size: 14px;
}

main {
	width: min(1240px, calc(100% - 36px));
	margin: 0 auto;
	padding: 24px 0 48px;
}

a {
	color: inherit;
}

.header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 22px;
	border-bottom: 2px solid var(--accent);
	padding-bottom: 14px;
}

h1 {
	margin: 0;
	color: var(--accent);
	font-size: 38px;
	font-weight: 850;
	line-height: 1.1;
	letter-spacing: 0;
}

.owner {
	color: var(--muted);
	font-size: 13px;
	font-weight: 650;
}

.back-link {
	color: var(--accent);
	font-weight: 750;
	text-decoration: none;
	white-space: nowrap;
}

.header-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.mode-control {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px;
	border: 1px solid var(--color-border-default);
	border-radius: 9px;
	background: var(--color-bg-selected);
}

.mode-indicator,
.mode-toggle {
	padding: 8px 12px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--panel);
	color: var(--accent);
	font-weight: 750;
	white-space: nowrap;
}

.mode-indicator.editing {
	border-color: var(--color-success-border);
	background: var(--color-success-bg);
}

.mode-toggle {
	border-color: var(--accent);
	background: var(--accent);
	color: white;
	cursor: pointer;
}

.mode-toggle.secondary {
	border-color: var(--line);
	background: var(--panel);
	color: var(--accent);
}

.summary-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(160px, 1fr));
	gap: 1px;
	margin-bottom: 24px;
	border: 1px solid var(--line);
	background: var(--line);
}

.metric {
	min-height: 84px;
	padding: 14px 16px;
	background: var(--panel);
}

.metric .label {
	color: var(--muted);
	font-size: 12px;
	font-weight: 750;
}

.metric .value {
	margin-top: 7px;
	font-size: 20px;
	font-weight: 850;
	line-height: 1.2;
}

.section {
	margin-top: 28px;
}

.section h2 {
	margin: 0 0 10px;
	color: var(--accent);
	font-size: 22px;
	font-weight: 850;
	letter-spacing: 0;
}

table {
	width: 100%;
	border: 1px solid var(--line);
	border-collapse: collapse;
	table-layout: fixed;
	background: var(--panel);
}

th,
td {
	height: 34px;
	padding: 8px 10px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: middle;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

th {
	background: var(--accent);
	color: var(--color-bg-surface);
	font-size: 12px;
	font-weight: 800;
}

tbody tr:nth-child(odd) {
	background: var(--row);
}

tbody tr:nth-child(even) {
	background: var(--row-alt);
}

.number {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.muted {
	color: var(--muted);
}

.daily-list {
	display: grid;
	gap: 7px;
	border: 1px solid var(--line);
	padding: 12px;
	background: var(--panel);
}

.daily-row {
	display: grid;
	grid-template-columns: 58px minmax(120px, 1fr) 120px 120px;
	gap: 10px;
	align-items: center;
	min-height: 28px;
}

.bar-track {
	height: 12px;
	background: var(--bar-bg);
}

.bar {
	height: 12px;
	background: var(--bar);
}

.empty {
	padding: 18px;
	border: 1px solid var(--line);
	background: var(--panel);
	color: var(--muted);
}

.notice {
	margin: 0 0 14px;
	padding: 10px 12px;
	border: 1px solid var(--color-success-border);
	background: var(--color-success-bg);
	color: var(--color-success-text);
	font-weight: 750;
}

.notice.error {
	border-color: var(--color-danger-border);
	background: var(--color-danger-bg);
	color: var(--color-danger-text);
}

.top-panels {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(480px, 520px);
	gap: 18px;
	align-items: stretch;
	margin-top: 28px;
	margin-bottom: 24px;
}

.game-panel {
	position: relative;
	overflow: hidden;
	border: 3px solid #5d371e;
	background:
		radial-gradient(circle at 22% 18%, rgba(255, 239, 182, 0.5), transparent 24%),
		radial-gradient(circle at 72% 82%, rgba(109, 53, 20, 0.28), transparent 32%),
		linear-gradient(135deg, #d7a14d, #b87932 44%, #d4a75e);
	box-shadow: inset 0 0 0 3px rgba(255, 228, 150, 0.38), inset 0 0 30px rgba(78, 31, 8, 0.42);
	color: #100904;
}

.game-panel h2 {
	margin: 0;
	padding: 12px 16px 8px;
	color: #1a0c03;
	font-size: 20px;
	font-weight: 900;
	border-bottom: 2px solid rgba(85, 42, 13, 0.55);
}

.game-panel .empty {
	margin: 12px;
	border-color: rgba(85, 42, 13, 0.55);
	background: rgba(255, 226, 150, 0.36);
	color: #4d2b13;
}

.timeline-panel {
	min-height: 340px;
}

.timeline-list {
	display: grid;
	gap: 0;
	border: 1px solid var(--line);
	background: var(--panel);
}

.timeline-row {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr);
	gap: 12px;
	align-items: start;
	min-height: 36px;
	padding: 9px 12px;
	border-bottom: 1px solid var(--line);
}

.timeline-row:last-child {
	border-bottom: 0;
}

.timeline-date {
	color: var(--accent);
	font-weight: 850;
	font-variant-numeric: tabular-nums;
}

.timeline-description {
	white-space: normal;
	line-height: 1.45;
}

.game-timeline-list {
	margin: 10px 12px 14px;
	max-height: 332px;
	overflow-y: auto;
	border: 2px solid rgba(85, 42, 13, 0.58);
	background: rgba(230, 176, 85, 0.36);
}

.game-timeline-row {
	display: grid;
	grid-template-columns: 58px minmax(0, 1fr);
	gap: 8px;
	align-items: start;
	padding: 8px 10px;
	border-bottom: 1px solid rgba(85, 42, 13, 0.38);
}

.game-timeline-row:last-child {
	border-bottom: 0;
}

.game-timeline-date {
	color: #523015;
	font-weight: 900;
	font-variant-numeric: tabular-nums;
}

.game-timeline-description {
	line-height: 1.45;
	word-break: keep-all;
	overflow-wrap: anywhere;
}

.game-timeline-description::before {
	content: "✓";
	margin-right: 6px;
	color: #557d9f;
	font-weight: 900;
}

.equipment-panel {
	min-height: 510px;
}

.equipment-board {
	position: relative;
	width: min(100%, 480px);
	height: 470px;
	margin: 10px auto 14px;
}

.appearance-column {
	position: absolute;
	left: 50%;
	bottom: 58px;
	transform: translateX(-50%);
	display: grid;
	gap: 4px;
	justify-items: center;
	width: 232px;
}

.appearance-column-title {
	color: #5b351c;
	font-size: 11px;
	font-weight: 900;
}

.appearance-slot-row {
	display: flex;
	gap: 8px;
}

.appearance-slot {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 70px;
	height: 70px;
	border: 3px solid rgba(65, 34, 18, 0.76);
	background: rgba(238, 190, 101, 0.46);
	box-shadow: inset 0 0 0 3px rgba(255, 230, 156, 0.34);
	cursor: pointer;
}

.appearance-slot.empty-slot {
	opacity: 0.72;
}

.appearance-slot:hover {
	border-color: #1a0c03;
	box-shadow: inset 0 0 0 3px rgba(255, 230, 156, 0.54), 0 0 0 2px rgba(26, 12, 3, 0.16);
}

.appearance-slot img {
	display: block;
	max-width: 42px;
	max-height: 42px;
	object-fit: contain;
	image-rendering: pixelated;
}

.equipment-slot {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 70px;
	height: 70px;
	border: 3px solid rgba(65, 34, 18, 0.76);
	background: rgba(238, 190, 101, 0.46);
	box-shadow: inset 0 0 0 3px rgba(255, 230, 156, 0.34);
	cursor: pointer;
}

.equipment-slot.equipped {
	align-items: stretch;
	justify-content: stretch;
}

.equipment-slot.empty-slot {
	opacity: 0.72;
}

.equipment-slot:hover {
	border-color: #1a0c03;
	box-shadow: inset 0 0 0 3px rgba(255, 230, 156, 0.54), 0 0 0 2px rgba(26, 12, 3, 0.16);
}

.equipment-slot.head {
	left: 50%;
	top: 28px;
	transform: translateX(-50%);
}

.equipment-slot.weapon {
	left: 80px;
	top: 128px;
}

.equipment-slot.armor {
	left: 50%;
	top: 142px;
	transform: translateX(-50%);
}

.equipment-slot.shield {
	right: 80px;
	top: 128px;
}

.equipment-slot.ring-left {
	left: 130px;
	bottom: 170px;
}

.equipment-slot.ring-right {
	right: 130px;
	bottom: 170px;
}

.equipment-slot.accessory-1 {
	left: 80px;
	top: 36px;
}

.equipment-slot.accessory-2 {
	right: 80px;
	top: 36px;
}

.equipment-slot img {
	display: block;
	max-width: 42px;
	max-height: 42px;
	object-fit: contain;
	image-rendering: pixelated;
}

.equipped-item {
	display: grid;
	grid-template-rows: minmax(0, 1fr) auto;
	align-items: center;
	justify-items: center;
	width: 100%;
	height: 100%;
	padding: 4px 3px 3px;
	gap: 2px;
}

.item-image-frame {
	display: grid;
	place-items: center;
	min-width: 0;
	min-height: 0;
}

.item-name-label {
	display: block;
	width: 100%;
	min-height: 14px;
	border: 1px solid rgba(73, 38, 17, 0.32);
	background: rgba(255, 229, 159, 0.72);
	color: #1c0d04;
	font-size: 9px;
	font-weight: 900;
	line-height: 12px;
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.slot-placeholder {
	color: rgba(58, 34, 18, 0.68);
	font-size: 11px;
	font-weight: 850;
	text-align: center;
}

.equipment-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 10px;
	display: grid;
	gap: 2px;
	color: #4d2b13;
	font-size: 12px;
	font-weight: 750;
	text-align: center;
}

.equipment-item-options {
	display: none;
}

.appearance-item-options {
	display: none;
}

dialog {
	width: min(420px, calc(100% - 32px));
	border: 2px solid var(--accent);
	border-radius: 10px;
	padding: 20px;
	color: var(--ink);
}

dialog::backdrop {
	background: rgba(0, 0, 0, 0.42);
}

.equipment-dialog-form {
	display: grid;
	gap: 12px;
}

.equipment-dialog-form h3 {
	margin: 0;
	color: var(--accent);
}

.equipment-dialog-form input {
	width: 100%;
	padding: 10px;
	font-size: 15px;
}

.equipment-item-suggestions {
	display: flex;
	flex-direction: column;
	min-height: 294px;
	max-height: 294px;
	overflow-y: auto;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--panel);
}

#equipment-equip-dialog {
	min-height: 500px;
}

.equipment-item-suggestions:empty {
	display: none;
}

.equipment-item-suggestion {
	flex: 0 0 42px;
	height: 42px;
	border: 0;
	border-bottom: 1px solid var(--line);
	padding: 9px 10px;
	background: transparent;
	color: var(--ink);
	cursor: pointer;
	font-size: 14px;
	text-align: left;
}

.equipment-item-suggestion:last-child {
	border-bottom: 0;
}

.equipment-item-suggestion:hover,
.equipment-item-suggestion.selected {
	background: var(--row);
}

.equipment-item-empty {
	padding: 10px;
	color: var(--muted);
}

.equipment-dialog-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.equipment-dialog-actions button {
	padding: 8px 14px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--panel);
	cursor: pointer;
}

.equipment-dialog-actions button[type="submit"] {
	border-color: var(--accent);
	background: var(--accent);
	color: white;
}

.editable-metric {
	cursor: pointer;
}

.editable-metric:hover {
	background: var(--color-bg-hover);
}

.editable-hint {
	margin-top: 4px;
	color: var(--accent);
	font-size: 11px;
	font-weight: 700;
}

.stats-dialog-form input {
	width: 100%;
	padding: 10px;
	font-size: 16px;
}

@media (max-width: 820px) {
	main {
		width: min(100% - 20px, 760px);
	}

	.header {
		display: block;
	}

	.header-actions {
		justify-content: flex-start;
		margin-top: 12px;
	}

	h1 {
		font-size: 30px;
	}

	.back-link {
		display: inline-block;
		margin-top: 12px;
	}

	.summary-grid {
		grid-template-columns: repeat(2, minmax(140px, 1fr));
	}

	.top-panels {
		grid-template-columns: 1fr;
		gap: 14px;
	}

	.game-timeline-list {
		max-height: 300px;
	}

	.equipment-board {
		width: min(100%, 480px);
		height: 470px;
	}

	.section {
		overflow-x: auto;
	}

	table {
		min-width: 760px;
	}

	.daily-list {
		min-width: 680px;
	}
}
