.guild {
  padding: 16px;
  padding-bottom: 90px;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guild__appbar {
  position: sticky;
  top: 0;
  z-index: 99;
}

.guild__hero.card {
  padding: 20px;
}

.guild__name {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.guild__level {
  margin-bottom: 8px;
}

.guild__introduce {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin: 8px 0;
  line-height: 1.5;
}

.guild__master {
  font-size: 13px;
  color: var(--special-100);
  margin-bottom: 12px;
}

.guild__manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.guild__manage-actions .btn {
  flex: 1 1 auto;
  min-height: 44px;
}

.guild__danger {
  display: flex;
  justify-content: flex-end;
}

.guild__danger .btn {
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
  color: var(--alert-300);
  font-size: 12px;
}

.guild__create-panel {
  position: relative;
  overflow: hidden;
  padding: 22px 20px 20px;
  border: 1px solid rgba(255, 193, 7, 0.28);
  background: linear-gradient(145deg, rgba(255, 193, 7, 0.12), rgba(255, 255, 255, 0.04));
}

.guild__create-panel::after {
  content: '';
  position: absolute;
  width: 120px;
  height: 120px;
  top: -58px;
  right: -32px;
  border-radius: 50%;
  background: rgba(255, 193, 7, 0.12);
}

.guild__create-panel .btn {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
}

.guild__section-eyebrow {
  position: relative;
  z-index: 1;
  color: var(--special-100);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.guild__section-title {
  position: relative;
  z-index: 1;
  margin-top: 5px;
  font-size: 20px;
  font-weight: 800;
}

.guild__section-description {
  position: relative;
  z-index: 1;
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  line-height: 1.5;
}

.guild__explore-section {
  padding-top: 4px;
}

.guild__list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.guild__list-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.guild__explore {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
}

.guild__members-section {
  padding-top: 4px;
}

.guild__members-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
}

.guild__member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.guild__member-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.guild__member-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guild__member-info span,
.guild__member-meta > span:last-child {
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
}

.guild__member-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.guild__explore-card {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.guild__explore-info {
  flex: 1;
  min-width: 0;
}

.guild__explore-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.guild__explore-master,
.guild__explore-level {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.guild__explore-introduce {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

.guild__explore-card .btn {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 16px;
}

.guild__empty,
.guild__error {
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  padding: 24px 0;
}

.guild__state {
  text-align: center;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

/* Modal refinements */
.guild__form-modal {
  background: rgba(4, 11, 31, 0.86);
  backdrop-filter: blur(8px);
}

.guild__form-modal .modal-content {
  position: relative;
  padding: 34px 26px 32px;
  background: linear-gradient(160deg, var(--primary-400), var(--primary-500));
  border: 1px solid rgba(252, 255, 107, 0.24);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.guild__form-modal .modal-header {
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.guild__form-modal .modal-header h3 {
  color: var(--special-100);
  font-size: 20px;
}

.guild__form-modal .field-label {
  display: block;
  margin-top: 20px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.guild__form-help {
  margin: -4px 0 4px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  line-height: 1.5;
}

.guild__form-modal .field {
  box-sizing: border-box;
  display: block;
  width: 100%;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--border-radius-sm);
  color: #fff;
  line-height: 1.45;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.guild__form-modal .field::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.guild__form-modal .field:focus {
  background: rgba(255, 255, 255, 0.11);
  border-color: var(--special-100);
}

.guild__form-modal textarea.field {
  min-height: 104px;
  resize: vertical;
}

.guild__form-modal #modal-submit {
  width: 100%;
  min-height: 30px;
  margin-top: 14px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.guild .modal-content .field,
.guild-app-modal .field {
  width: 100%;
  min-height: 44px;
  margin-bottom: 12px;
}

.guild .field-label {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  min-height: 44px;
}

/* Applications */
.guild__application {
  padding: 14px;
  margin-bottom: 10px;
}

.guild__application-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.guild__application-name {
  font-weight: 700;
}

.guild__application-id {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.guild__application-status-tag {
  align-self: flex-start;
  margin-top: 5px;
  background: rgba(252, 255, 107, 0.14);
  color: var(--special-100);
}

.guild__application-status-tag--approved {
  background: rgba(74, 222, 128, 0.16);
  color: #86efac;
}

.guild__application-status-tag--rejected {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}

.guild__application-actions {
  display: flex;
  gap: 8px;
}

.guild__application-actions .btn {
  flex: 1;
  min-height: 44px;
}

/* Toast */
.guild__toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--primary-500);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 14px 20px;
  border-radius: 8px;
  z-index: 1200;
  max-width: 90%;
  text-align: center;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.guild__toast--show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Guild Manager (v2.0 會長資金互轉) */
.guild-manager {
  padding: 16px;
  padding-bottom: 90px;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gm__hero .gm__guild-name {
  font-size: 18px;
  font-weight: 800;
  margin: 8px 0 4px;
}

.gm__meta {
  font-size: 12px;
  opacity: 0.7;
}

.gm__wallet-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gm__wallet-main strong {
  font-size: 22px;
  font-weight: 800;
}

.gm__wallet-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.gm__hint {
  font-size: 12px;
  opacity: 0.65;
  margin-top: 8px;
  line-height: 1.5;
}

.gm__member-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.gm__member-actions .btn {
  flex: 1;
  min-height: 44px;
}

.gm__search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.gm__search .field {
  flex: 1;
}

.gm__search .btn {
  min-height: 44px;
  white-space: nowrap;
}

.gm__pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.gm__pager .btn {
  min-width: 44px;
  min-height: 44px;
}

.gm__filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.gm__filter .btn {
  flex: 1;
  min-height: 44px;
}

.gm__filter-btn--active {
  background: var(--special-100);
  border-color: var(--special-100);
  color: var(--primary-500);
  font-weight: 800;
}

.gm__tx {
  padding: 12px;
  margin-bottom: 8px;
}

.gm__tx-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gm__tx-head strong {
  margin-left: auto;
  font-size: 16px;
}

.gm__tx-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.75;
  margin-top: 6px;
}

.gm__tx-id {
  font-size: 11px;
  opacity: 0.55;
  margin-top: 4px;
  word-break: break-all;
}

.gm__direction {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.gm__direction .btn {
  flex: 1;
  min-height: 44px;
}

.gm__confirm-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.gm__confirm-row strong {
  text-align: right;
  word-break: break-all;
}

/* Guild Manager 交易紀錄 Dialog */
.gm__tx-dialog .modal-content {
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}

.gm__tx-dialog #modal-content-inner {
  overflow-y: auto;
}

.gm__tx-entry .guild__list-header {
  margin-bottom: 0;
}

/* Guild Manager 交易列 v2（記帳式） */
.gm__tx {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
}

.gm__tx-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.gm__tx--in .gm__tx-icon {
  background: rgba(52, 211, 153, 0.16);
  color: #6ee7b7;
}

.gm__tx--out .gm__tx-icon {
  background: rgba(129, 140, 248, 0.16);
  color: #a5b4fc;
}

.gm__tx-main {
  flex: 1;
  min-width: 0;
}

.gm__tx-title {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gm__tx-sub {
  font-size: 12px;
  opacity: 0.65;
  margin-top: 2px;
}

.gm__tx-id {
  font-size: 10px;
  opacity: 0.45;
  margin-top: 2px;
  font-family: monospace;
  word-break: break-all;
}

.gm__tx-amt {
  flex: 0 0 auto;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.gm__tx-amt strong {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.gm__tx--in .gm__tx-amt strong {
  color: #6ee7b7;
}

.gm__tx--out .gm__tx-amt strong {
  color: #e0e7ff;
}

.gm__tx-dot {
  font-size: 11px;
  opacity: 0.8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gm__tx-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.gm__tx-dot--ok {
  color: #6ee7b7;
}

.gm__tx-dot--pending {
  color: #fcd34d;
}

/* 公會介面按鈕高度下修 */
.guild .btn,
.guild-manager .btn,
.guild__form-modal .btn,
.gm__tx-dialog .btn {
  min-height: 36px;
}

.gm__topbar {
  display: flex;
  justify-content: flex-start;
}

/* Guild pages v2：會員資料頁設計語言 */
.guild-wrapper {
  min-height: 100vh;
  background:
    radial-gradient(circle at 100% 0%, rgba(127, 32, 249, 0.2), transparent 32%),
    var(--primary-500);
}

.guild,
.guild-manager {
  width: min(100%, 640px);
  max-width: 640px;
}

.guild__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.guild__back {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--text-100);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.guild__eyebrow,
.guild__section-kicker {
  color: var(--special-100);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
}

.guild__title {
  margin-top: 3px;
  font-size: clamp(24px, 6vw, 32px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.guild__pill {
  margin-left: auto;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--primary-500);
  background: var(--special-100);
  font-size: 10px;
  font-weight: 800;
}

.guild__count {
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  font-weight: 400;
}

.guild__identity {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(127, 32, 249, 0.32), rgba(0, 128, 246, 0.16));
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.guild__badge {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--primary-400);
  border: 2px solid rgba(255, 255, 255, 0.2);
  font-size: 26px;
  font-weight: 800;
}

.guild__identity-copy {
  min-width: 0;
  flex: 1;
}

.guild__identity-copy h2 {
  font-size: 20px;
  overflow-wrap: anywhere;
}

.guild__identity-copy p {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
}

.guild__section {
  margin-top: 24px;
}

.guild__section-heading {
  margin-bottom: 11px;
}

.guild__section-heading h2 {
  margin-top: 4px;
  font-size: 18px;
}

.guild__details {
  padding: 4px 18px;
}

.guild__detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.guild__detail-row > span:first-child {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}

.guild__detail-row > strong:last-child,
.guild__detail-row > span:last-child > strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.guild__member-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.guild__member-name strong {
  color: var(--text-100);
  font-size: 14px;
}

.guild__member-name small {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}

.guild__member-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.guild__status {
  font-style: normal;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.guild__launch {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-100);
  text-align: left;
}

.guild__launch:active {
  transform: scale(0.985);
}

.guild__launch-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  place-items: center;
  border-radius: 11px;
  background: rgba(252, 255, 107, 0.12);
  font-size: 18px;
}

.guild__launch > span:nth-child(2) {
  display: grid;
  flex: 1;
  gap: 3px;
  min-width: 0;
}

.guild__launch strong {
  font-size: 13px;
}

.guild__launch small {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}

.guild__launch > svg {
  color: rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

.guild__manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.guild__manage-actions .btn {
  flex: 1 1 auto;
}

.guild__leave {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 10px;
  color: var(--alert-200, #fca5a5);
  font-size: 13px;
  text-align: center;
  border-radius: 10px;
}

/* 會長頁：餘額大數字與列 */
.gm__balance {
  font-size: clamp(30px, 8vw, 40px);
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.gm__refresh-btn {
  align-self: flex-start;
  flex-shrink: 0;
  padding: 8px 13px;
  font-size: 11px;
}

.gm__wallet {
  flex-wrap: wrap;
}

.gm__platforms {
  flex: 1 1 100%;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.gm__wallet .gm__hint,
.gm__wallet .guild__empty,
.gm__wallet .guild__error {
  flex: 1 1 100%;
}

.gm__platforms .guild__detail-row {
  min-height: 40px;
}

.gm__wallet .gm__hint {
  width: 100%;
}

.gm__member-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.gm__member-actions .btn {
  padding: 7px 10px;
  font-size: 11px;
}

.gm__search-input {
  flex: 1;
}

.gm__meta {
  margin-top: 10px;
}

.guild__launch-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

/* 會長頁：膠囊搜尋列 */
.gm__search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 6px 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(4, 11, 31, 0.45);
}

.gm__search:focus-within {
  border-color: var(--special-100);
  box-shadow: 0 0 0 2px rgba(252, 255, 107, 0.12);
}

.gm__search-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.45);
}

.gm__search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-100);
  font-size: 13px;
}

.gm__search-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.gm__search-go {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--special-100);
  color: var(--primary-500);
  font-size: 12px;
  font-weight: 800;
}

.gm__search-go:active {
  transform: scale(0.96);
}

.gm__member-balance {
  color: var(--special-100);
  font-weight: 700;
}

/* 交易紀錄 Dialog 按鈕：恢復實心風格，壓薄上下 */
.gm__tx-dialog .btn {
  min-height: 30px;
  padding-top: 4px;
  padding-bottom: 4px;
}

/* 公會 dialog 按鈕：同交易紀錄 dialog，壓薄上下 */
.guild__form-modal .btn {
  min-height: 30px;
  padding-top: 4px;
  padding-bottom: 4px;
}
