/* KTC items (the chat's gifts). Each rarity class (system/ktc/items.php) frames the item in its
   colour wherever it is shown: the shop and profile cards, and the .gift_frame around the large
   views and the owner's Gifts page. Loaded after the theme so the rarity border wins over the
   card's own. The special borders are drawn on ::before rings that are transparent inside, so
   they sit right on every theme's background. */
.gift_rarity_normal { --gift-rarity: #9aa0a6; }
.gift_rarity_rare { --gift-rarity: #8fe06e; }
.gift_rarity_ultra { --gift-rarity: #ef4444; --gift-rarity-dark: #a11a2c; }
.gift_rarity_unique { --gift-rarity: #a855f7; --gift-gold: #ffc94a; }
/* the special borders' rings are placed against whatever carries the class */
.gift_rarity_ultra, .gift_rarity_unique { position: relative; }

/* square tiles: the cards, and a frame around the bare images */
.gcard, .pgcard { height: auto; aspect-ratio: 1 / 1; box-sizing: border-box; --gift-radius: 10px; border-radius: var(--gift-radius); }
.gcard .gcard_img { width: 56px; max-height: 56px; object-fit: contain; }
.gift_frame { position: relative; display: inline-block; box-sizing: border-box; padding: 4px; --gift-radius: 12px; border-radius: var(--gift-radius); line-height: 0; vertical-align: middle; }
.gift_frame img { display: block; object-fit: contain; }
.gift_frame .gift_received, .gift_frame .gift_del, .gift_frame .gift_selected { width: 90px; height: 90px; margin: 0; }
.gift_frame .gift_edit_img { width: 92px; height: 92px; }
.sub_list_gift .gift_frame { padding: 2px; --gift-radius: 10px; }
.sub_list_gift .gift_frame img { width: 44px; height: 44px; }

/* normal and rare: a plain border in the rarity's colour */
.gift_rarity_normal, .gift_rarity_rare { border: 4px solid var(--gift-rarity); }

/* ultra rare: the border alternates bright and darker red */
.gift_rarity_ultra { border: 4px solid transparent; }
.gift_rarity_ultra::before {
	content: ''; position: absolute; inset: calc(-1 * var(--gift-border, 4px)); padding: var(--gift-border, 4px); border-radius: inherit; pointer-events: none;
	background: repeating-linear-gradient(45deg, var(--gift-rarity) 0 6px, var(--gift-rarity-dark) 6px 12px);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* unique: a purple border with short gold lines running inward all round, a fine gold line inside,
   and a soft glow. The gold layer overlaps the border's inner pixel and takes the border's inner
   radius (outer radius minus the 4px border, plus that pixel), so no background shows between them. */
.gift_rarity_unique { border: 4px solid var(--gift-rarity); box-shadow: 0 0 6px rgba(168, 85, 247, 0.65), 0 0 14px rgba(255, 201, 74, 0.3); }
.gift_rarity_unique::before {
	content: ''; position: absolute; inset: -1px; border-radius: calc(var(--gift-radius, 10px) - 3px); pointer-events: none;
	box-shadow: inset 0 0 0 1px var(--gift-gold);
	background:
		repeating-linear-gradient(90deg, var(--gift-gold) 0 2px, transparent 2px 9px) top / 100% 6px no-repeat,
		repeating-linear-gradient(90deg, var(--gift-gold) 0 2px, transparent 2px 9px) bottom / 100% 6px no-repeat,
		repeating-linear-gradient(0deg, var(--gift-gold) 0 2px, transparent 2px 9px) left / 6px 100% no-repeat,
		repeating-linear-gradient(0deg, var(--gift-gold) 0 2px, transparent 2px 9px) right / 6px 100% no-repeat;
}
.sub_list_gift .gift_rarity_unique::before { background-size: 100% 4px, 100% 4px, 4px 100%, 4px 100%; }

/* the rarity's name, where an item is described (admin list) */
.gift_rarity_label { color: var(--gift-rarity); font-weight: 700; border: 0 !important; box-shadow: none !important; }
.gift_rarity_label::before { content: none !important; }

/* limited drops: the shop card's tag ("37 left", "2d 4h left") and the note on the chosen item */
.gcard_limit { position: absolute; top: 6px; left: 0; right: 0; z-index: 1; width: max-content; max-width: calc(100% - 12px); margin: 0 auto; padding: 1px 6px; overflow: hidden; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #ffc94a; font-size: 10px; font-weight: 700; line-height: 15px; white-space: nowrap; text-overflow: ellipsis; }
.gcard_limit i { font-size: 9px; }
.gift_limit_note { min-height: 18px; padding-top: 4px; color: #ffc94a; font-size: 13px; font-weight: 700; }
.gift_limit_field[hidden] { display: none; }

/* the item card (system/ktc/box/item_card.php) */
.item_card { padding-top: 24px; }
.item_card_head { display: flex; align-items: center; gap: 16px; }
.item_card_head .gift_frame .gift_received { width: 80px; height: 80px; }
.item_card_title { min-width: 0; }
.item_card_name { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.2; }
.item_card_rarity { margin: 4px 0 0; font-size: 14px; }
.item_card_meta { margin: 4px 0 0; font-size: 13px; }
.item_card_stats { display: flex; gap: 24px; margin: 16px 0 0; }
.item_card_stats > div { display: flex; flex-direction: column; }
.item_card_stat { font-size: 20px; font-weight: 800; line-height: 1.2; }
.item_card_stats .sub_text { font-size: 12px; }
.item_card_label { margin: 16px 0 8px; font-size: 12px; font-weight: 700; opacity: 0.7; }
.item_card_copies { display: flex; flex-wrap: wrap; gap: 8px; max-height: 104px; overflow-y: auto; }
.item_copy { min-height: 44px; padding: 0 16px; border: 2px solid rgba(128, 128, 128, 0.3); border-radius: 12px; background: none; color: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.item_copy_on { border-color: var(--gift-rarity, #ffc94a); background: rgba(128, 128, 128, 0.12); }
.item_card_tabs { margin-top: 16px; }
.item_card_tabs .modal_menu_item { min-height: 44px; display: inline-flex; align-items: center; }
.item_card_copy { margin-top: 16px; padding: 16px; border-radius: 12px; background: rgba(128, 128, 128, 0.08); }
.item_card_serial { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.item_card_copy .item_card_label { margin-top: 16px; }
.item_history { max-height: 168px; overflow-y: auto; }
#item_card_history { max-height: 320px; margin-top: 8px; }
.item_event { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 14px; line-height: 1.4; border-top: 1px solid rgba(128, 128, 128, 0.15); }
.item_event:first-child { border-top: 0; }
.item_event .sub_text { flex: 0 0 auto; white-space: nowrap; }
.item_send_panel { margin-top: 16px; }
.item_send_panel .full_input { min-height: 44px; font-size: 16px; }
.item_send_results { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 200px; overflow-y: auto; }
.item_send_person { display: flex; align-items: center; gap: 16px; min-height: 44px; padding: 4px 8px; border: 0; border-radius: 8px; background: none; color: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; }
.item_send_person:hover, .item_send_person:focus-visible { background: rgba(128, 128, 128, 0.12); }
.item_send_person img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.item_send_confirm p { margin: 8px 0; font-weight: 600; }
.item_card_actions { display: flex; flex-wrap: wrap; gap: 8px; }
.item_card_actions .reg_button { min-height: 44px; }

/* My items on a desktop: a titled box with the shop beside the title, and cards that say what each item is,
   as the phone's Market does (ktc-mobile.css, Inventory) */
.ktc_items_head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-right: 40px; }
.ktc_items_head h2 { margin: 0; font-size: 18px; }
@media (min-width: 769px) {
	#view_gift_box :has(> .pgcard) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
	#view_gift_box .pgcard ~ :not(.pgcard) { grid-column: 1 / -1; }
	#view_gift_box .pgcard { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; float: none; width: auto; height: auto; aspect-ratio: auto; margin: 0; padding: 10px 6px; text-align: center; }
	#view_gift_box .pgcard_img { width: 100%; height: 72px; max-height: 72px; object-fit: contain; }
	#view_gift_box .pgcard_count { top: 6px; right: 6px; bottom: auto; left: auto; }
	#view_gift_box .pgcard_name { display: block; margin: 0; font-size: 13px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
	#view_gift_box .pgcard_rarity { display: block; margin: 0; font-size: 12px; line-height: 1.2; }
}
